COMP 2633 - Quiz 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is *refactoring*?

modifies software to improve its readablity, maintainability, and extensibility without changing what it actually does; external behaviour does *not* change, but the internal structure is improved

Why does low cohesion increase the difficulty of maintaining a system?

logical changes in the program affect multiple modules, and changes in one module require changes in related modules

In a highly coupled system, an assembly of modules might require...

more effort and/or time due to increased inter-module dependency

Why does low cohesion increase the difficulty of reusing a module?

most applications won't need the random set of operations provided by a module

The structural organization of *collaboration* diagrams consists of...

objects and links

Graphically, a sequence diagram is a table that shows...

objects arranged along the X axis and messages, ordered in increasing time, along the Y axis

What is the context of the *singleton* creational pattern?

*Context:* In some applications, it is important to have exactly one instance of a class

What are the forces involved in the *singleton* creational pattern?

*Forces:* Can make an object globally accessible as a global variable, but this violates encapsulation. Could use class (static) operations and attributes, but polymorphic redefinition is not always possible.

What is the problem tied to the *observer* behavioural pattern?

*Problem:* Define a one-to-many dependency among objects so that when on object changes state, all of its dependents are notified and updated automatically

What is the problem tied to the *facade* structural pattern?

*Problem:* How can we access a large number of classes with a complex internal interaction in a simple but safe way?

What is the problem tied to the *singleton* creational pattern?

*Problem:* How can we guarantee that one and only one instance of a class can be created?

What is the problem tied to the *command* behavioural pattern?

*Problem:* Need a flexible organization of methods that allows them to be context sensitive in a structured way

What is the *singleton* creational pattern solution?

*Solution:* Create a class with a class operation getInstance(). When the class is first accessed, this creates a relevant object instance and returns the object identity to client. On subsequent calls of getInstance(), no new instance is created - instead, the existing object is returned

What is the *facade* structural pattern solution?

*Solution:* Introduce a dedicated interface class that simplifies the view of the class collection.

What is the *command* behavioural pattern solution?

*Solution:* Place behaviour/operations in their own class instead of in a method

What is the *observer* behavioural pattern solution?

*Solution:* Separating abstract from concrete subjects and observers

Design specifies _______ the system will accomplish its tasks.

*how*

Analysis identifies ______ the system must do

*what*

Possible areas of coupling between classes A and B include...

- A has an *attribute* that is of type B - A calls on the *services* of B - A has a *method* that references B (either via parameter or return type) - A is a subclass of/implements B (*inheritance*)

Disadvantages of *low* cohesion are...

- Increased difficulty in understanding modules - Increased difficulty in maintaining a system - Increased difficulty in reusing a module

What are the *problems* with the waterfall lifecycle model?

- real projects rarely follow such a simple sequential life cycle - iterations are almost inevitable - lapsed time between systems engineering and the final installation - unresponsive to changes during project

What are some reasons for bad software?

- requirements change over time, making it hard to update your code - time and money cause you to take shortcuts - you learn a better way to do something

What are the *strengths* of the waterfall lifecycle model?

- tasks in phases may be assigned to specialized teams - project progress evaluated at the end of each phase - manage projects with high levels of risks

*When* do we refactor?

- when you add functionality - when you need to fix a bug - when you do a peer review

What are two basic ways to *evaluate* your design at any time?

1) Cohesion 2) Coupling

What are the main phases of the *problem solving model*?

1) Data gathering 2) Problem redefinition -> focus on understanding what the problem is about 3) Finding ideas -> concerned with understanding more about the nature of the problem and possible solutions 4) Finding solutions 5) Implementation

What are the steps for *producing* sequence diagrams?

1) Decide on context (i.e., identify behaviour / use case to be modeled) 2) Identify structural elements (i.e. model objects, lifelines, activations, messages, and timing constraints) 3) Refine and elaborate as required

What are the 4 essential elements of *design patterns*?

1) Pattern name 2) Problem: intent, context, when to apply 3) Solution: UML like structure, abstract code 4) Consequences: results and tradeoffs

What is the *Project Life Cycle structure*?

1) Starting the project 2) Organizing and preparing 3) Carrying out project work 4) Closing the project

What are 5 types of UML behavioral diagrams?

1) Use case diagrams 2) Sequence diagrams 3) Collaboration diagrams 4) Statechart diagrams 5) Activity diagrams

What are the *3 types* of design patterns?

1) creational 2) structural 3) behavioural

What is the *feature envy* code smell and why is it bad?

A method in class A seems way too interested in the workings/data fields of class B; the feature envy from A to B is an indication of tight coupling from A to B

What is a *pattern*?

A recurring solution to a standard problem, in a context

Given two lines of code, A and B, they are coupled when...

B must change behaviour only because A changed

What are the phases of the *waterfall model*?

Conception -> Initiation -> Analysis -> Design -> Construction -> Testing -> Production/Implementation -> Maintenance

What is the general goal for cohesion/coupling?

High Cohesion and Low Coupling

How are activity diagrams *different* from interaction (collaboration, sequence) diagrams?

Interaction diagrams emphasize the flow of control from *object to object*, activity diagrams emphasize the flow of control from *activity to activity*

Why is refactoring dangerous?

It can introduce problems, because anytime you modify software, you may introduce bugs

How many final nodes can there be in an activity diagram?

Multiple

What's the order of software design?

Requirements -> Analysis -> Design

Activity diagrams start with an *initial node*, which is represented using...

a black circle

In activity diagrams, a *final node* is represented using...

a black circle in a white circle

What is the *shotgun surgery* code smell and why is it bad?

a certain type of change in the system repeatedly leads to making lots of small changes to a group of classes; generally implies that a single logical idea or function is spread out over multiple classes

What is the *lazy class* code smell?

a class that no longer "pays its way"

In sequence diagrams, a *return* from a previous message is rendered as...

a dashed line from the receiver of the message back to the sender

In sequence diagrams, a message arrow comes with...

a description or signature; the format is... attribute = signal_or_message_name (arguments) : return_type

In sequence diagrams, *loops* are used to represent...

a fragment that may execute multiple times, and the guard condition indicates the basis of iteration

The *prototyping* model is a systems development method in which...

a prototype is built, tested, and then reworked as necessary until an acceptable prototype is finally complete

What is the *waterfall model*?

a sequential design process in which progress is seen as flowing steadily downwards

What is the *refused bequest* code smell?

a subclass ignores most of the functionality provided by its superclass; subclass may not pass the 'is-a' test.

In activity diagrams, fork/join nodes are used to represent...

actions carried out in parallel

*Activity* diagrams consist of...

activities and links

The goal of refactoring is *not* to ___________, but to make code ___________.

add new functionality; easier to maintain in the future

What are *behavioural* design patterns?

address problems of assigning responsibilities to classes; suggest both static relationships and patterns of communication (use cases)

What are *creational* design patterns?

address problems of creating an object in a flexible way; separate creation from operation/use

What are *structural* design patterns?

address problems of using Object Oriented constructs like inheritance to organize classes and objects

In sequence diagrams, an object messaging itself is rendered as...

an activation bar *within* that object's activation bar, with an arrow that points to and from this smaller activation bar

What is the *temporary field* code smell and why is it bad?

an attribute of an object is only set in certain circumstances; but an object should need ALL of its attributes

In sequence diagrams, a *reference* refers to...

an interaction defined on another diagram; the frame is drawn to cover the lifelines involved in the interaction; you can define parameters and a return value

In activity diagrams, *decision nodes and merge nodes* are represented using...

an unfilled diamond

*Collaboration* diagrams are part of the...

analysis model

The *prototype* model allows for early demonstrations of system functionality to help identify...

any misunderstanding between developer and client

In activity diagrams, *control flows* are represented using...

arrows with open arrowheads

What are *code smells*?

bad things done in code; used to identify when to refactor

What is *physical design*?

based on the actual implementation platform and the language that will be used

*Why* do we refactor?

because we understand getting the design right the first time is hard and you get many benefits from refactoring, such as: - code size is often reduced - confusing code is restructured into simpler code

In sequence diagrams, a *sequence fragment* is represented as a...

box, called a combined fragment, which encloses a portion of the interactions within a sequence diagram

In sequence diagrams, an object is rendered as a ...

box, with the type of the object indicated by a colon followed by the object type

Managing the *prototyping* life cycle requires...

careful decision making

*Low coupling* means that _________ and is a sign of ____ design.

changes in one spot do not effect every other location; good

*High coupling* means that _________ and is a sign of ____ design.

changes in one spot effect every other location; bad

Why is the *large class* code smell bad?

classes try to do too much, which reduces cohesion

The *prototype* model helps find...

client requirements that have been missed and difficulties in interface

*Sequence diagrams* are good at showing ____________, but not so good at ____________.

collaborations among the objects; precise definition of behaviour

Design pattern names form a...

common vocabulary

For a project to be successful, the project team must balance the...

competing demands of scope, time, cost, quality, resources, and risk to produce the specified product, service, or result

In sequence diagrams, *alternative multiple fragments* are used for...

conditional behaviours like if/else if/else

In activity diagrams, *guard conditions* are represented with...

conditions in square brackets

The overall goal of software engineering is to...

create high quality software efficiently

In Agile software development, __________ comes before contract negotiation.

customer collaboration

*Activity* diagrams are part of...

design

Design patterns help improve...

developer communication

Design patterns help _______ systems.

document

In sequence diagrams, if there are multiple objects of the same type interacting, they can...

each be given a unique name

Design patterns explicitly capture...

expert knowledge and design tradeoffs and make it more widely available

With the *prototype* model, the _______________ of the system can be tested, even though, by its very nature, the prototype is incomplete.

feasibility and usefulness

An *activity* diagram is essentially a flowchart, showing the...

flow of control from activity to activity

*Activity* diagrams describe the...

flow of control in a system

With the *prototype* model, the prototype my divert attention from...

functional to solely interface issues

Why is the *long parameter list* code smell bad?

hard to understand; can become inconsistent

In sequence diagrams, *messages* are rendered as...

horizontal arrows being passed from object to object as time advances down the object lifelines

*Cohesion* is a measure of...

how strongly-related each piece of functionality expressed by the design of a software module is

Why is the *duplicated code* code smell bad?

if you modify one instance of duplicated code but not others, you may introduce a bug

What is *logical design*?

independent of the implementation language and platform

In Agile software development, ___________ come before processes and tools.

individuals and interactions

Coupling talks about the ___________ while cohesion describes how ___________.

inter-dependencies between the various modules; related functions with a module are

*Sequence* diagrams are...

interaction diagrams

The *prototype* model is an ___________ process that takes place between the ___________.

iterative, trial-and-error; developers and the users

The *prototype* model is best used as part of the...

larger development lifecycle to avoid many of the problems we have discussed in class

Cohesion is decreased if the functionalities embedded in a class, accessed through its methods have...

little in common

Why is the *long method* code smell bad?

long methods are more difficult to understand

Cohesion is decreased if the methods carry out...

many varied activites, often using coarsely-grained or unrelated sets of data

For a project to be successful, the project team must select the appropriate processes to...

meet project goals and objectives

For a project to be successful, the project team must use a defined approach focused on...

meeting the requirements of the project

The *prototyping* model works best in scenarios where...

not all of the project requirements are known in detail ahead of time

With the *prototype* model, the client may perceive the prototype as...

part of the final system

Analysis and design do not necessarily have to be separated, as it may be useful to have a...

platform-independent design that can be tailored to each platform if the software is to be implemented on different platforms

What is the usual fix to the *shotgun surgery* code smell?

pulling all the parts of the code that have to change together into a single cohesive class

In sequence diagrams, a *return* arrow is similar to what in code?

reaching the end of a method or explicitly calling a return statement

What is the *Project Life Cycle*?

refers to a series of activities which are necessary to fulfill project goals or objectives

*Use case* diagrams are part of the...

requirements model

In Agile software development, __________ comes before following a plan.

responding to change

Design patterns enable large-scale...

reuse of software architectures

In sequence diagrams, common fragment types include...

sd, ref, alt, loop

In sequence diagrams, the object at the start of a message is called the ______ and the object at the end of the message is called the _______.

sender, reciever

*Sequence* diagrams are used to visualize the...

sequence of calls in a system to perform a specific functionality

Patterns solve both ____________ problems and ___________ problems.

software structural; non-functional

The *waterfall* approach is more suited to projects where it is not necessary to see...

some parts of the system delivered during the development process

*Activity* diagrams are used to...

specify, construct, and document the dynamics of a society of objects, or to model the flow of control of an operation

The *waterfall* approach is more suited to projects where requirements are...

stable and not likely to change during the development process

For a project to be successful, the project team must clearly define and agree upon...

stakeholder/customer needs and expectations

Any real time system is expected to be reacted by some kind of internal/external events. These events are responsible for the...

state change of the system

What is the *divergent change* code smell and why is it bad?

symptom of cohesion; one type of change requires changing one subset of methods; another type of change requires changing another subset

*High cohesion* means that _________ and is a sign of ____ design.

tasks all tightly relate; good

*Low cohesion* means that _________ and is a sign of ____ design.

the module performs tasks which are not very related to each other and hence can create problems as the module becomes large; bad

In activity diagrams, activity partitions/swimlanes are labelled with...

the person, organization, department, or system responsible for the activities in that column

*Statechart* diagrams are used to visualize...

the reaction of a system by internal/external factors

What is *logical cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are conceptually related; low cohesion

What is *sequential cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are grouped because the output from one part is the input to another part like an assembly line; mid to high cohesion

What is *functional cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are grouped because they all contribute to a single well-defined task of the class; mid to high cohesion

What is *temporal cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are invoked at or near the same time; low cohesion

What is *procedural cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are steps in the same application area process; mid cohesion

What is *coincidental cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform are totally unrelated; low cohesion

What is *communicational/informational cohesion*, and is it an example of high, mid, or low cohesion?

the tasks an object's methods perform operate on the same information or data - in OOP, this information would be the information contained in the variables of an object; mid to high cohesion

A *sequence* diagram is an interaction diagram that emphasizes...

the time ordering of messages

In sequence diagrams, the *fragment operator* (top left corner) of sequence fragments indicates...

the type of fragment

What is the *data class* code smell and why is it bad?

these are classes that have fields, getters/setters, and nothing else; they are data holders, but objects should be about data AND behaviour

What are the objectives of *Agile software development*?

to introduce less bureaucratic, less focused on documentation, and more focused on user interaction and early delivery of working software

What is the usual fix to the *feature envy* code smell?

try moving the functionality of the interested method in class A to class B, which is already closer to most of the data involved in the task

In OOP, coupling is...

unavoidable

*Use case* diagrams are a set of...

use cases, actors, and their relationships

The *prototype* model requires significant _____ involvement.

user

The *waterfall* approach is more suited to projects where there is less need for...

user involvement

In activity diagrams, *activity partitions/swimlanes* are represented using...

vertical columns

The purpose of *collaboration* diagrams is to...

visualize the organization of objects and their interaction

*When* should you use sequence diagrams?

when you want to look at the behaviour of several objects within a single use case / feature of the system

In Agile software development, ___________ comes before comprehensive documentation.

working software

*Use case* diagrams represent...

a particular functionality of a system

In activity diagrams, *actions/activities* are represented using...

a rectangle with rounded corners and a meaningful name

In a highly coupled system, a change in one module usually forces...

a ripple effect of changes in other modules

*Sequence* diagrams consist of...

a sequence of messages flowing from one object to another

*Low cohesion* refers to a relationship in which one module interacts with another module through...

a simple and stable interface and doesn't need to be concerned with other module's internal implementation (i.e. *encapsulation*)

In activity diagrams, *fork nodes and join nodes* are represented using...

a thick black horizontal bar

In a sequence diagram, each object has an *object lifeline*, which is rendered using a...

dashed line descending from each object

In a highly coupled system, a particular module might be harder to reuse and/or test because...

dependent modules must be included

*Sequence* diagrams are part of...

design

*Statechart* diagrams are part of...

design

What is *stamp coupling*, and is it an example of high, mid, or low coupling?

occurs when modules share a composite data structure and use only a part of it, possibly a different part; mid to low coupling

What is *data coupling*, and is it an example of high, mid, or low coupling?

occurs when modules share data - each datum is an elementary piece and these are the only data shared; mid to low coupling

What is *control coupling*, and is it an example of high, mid, or low coupling?

occurs when one module controls the flow of another by passing it information on what to do; mid to low coupling

What is *content coupling*, and is it an example of high, mid, or low coupling?

occurs when one module modifies or relies on the internal working of another module; high coupling

What is *common coupling*, and is it an example of high, mid, or low coupling?

occurs when two modules share the same global data - changing the shared resource implies changing all the modules using it; high coupling

How many initial nodes can there be in an activity diagram?

only one

*Collaboration* diagrams represent the...

organization of a system and the messages sent/received

In sequence diagrams, a box along the object lifeline indicates...

that the object is running a behaviour -> this is called the activation bar

What is *coupling*?

the degree to which each design module relies on each one of the other modules

*Statechart* diagrams are used to represent...

the event driven state change of a system

In a sequence diagram, an *object lifeline* represents...

the existence of an object over a period of time

What is *no communication coupling*, and is it an example of high, mid, or low coupling?

the modules do not communicate at all with one another; low coupling


Set pelajaran terkait

ACCT 3309-MA Chapter 1-Practice Questions

View Set

The Art of Public Speaking Lucas - ORG215

View Set

How to Read Lit Like a Professor Chapter Examples

View Set

Business Architect Practice Test

View Set

Contraposition or Transposition of Conditional Propositions

View Set

A&P MIDTERM: Contraction of Whole Muscle

View Set