Unit 7 Flashcards

1
Q

How can conditions be represented in a sequence diagram?

A

(b2, p145)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can multiple conditions originating from the same point be represented in a sequence diagram?

A

(b2, p146)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can multiple message sends be represented in sequence diagrams?

A

(b2, p147)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How are optional operations represented in sequence diagrams?

A

(b2, p148)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are if then operations represented in sequence diagrams?

A

(b2, p149)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are loops represented in sequence diagrams?

A

(b2, p150)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How are preconditions checked when using defensive programming?

A

In defensive programming, the checking of the precondition is done by the operation itself (the receiver of the message).

(b2, p153)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How are preconditions checked when using DbC?

A

In DbC, the checking of the precondition is done by the caller of the operation (the sender of the message).

(b2, p153)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the three strategies that can be adopted for implementing use cases?

A
  1. One central class
    • Interface sends all messages to a single general object, which then forwards the message to other classes.
    • Interface is only aware of this one object.
    • Each use case is a method of this general object.
    • It is possible that the central class will become overloaded with use cases, so it is a good idea to split the system into several packages which would each make use of one class to respond to interface messages.
  2. Actor classes
    • Messages are sent to objects that correspond to the real-world actor who initiated the operation.
    • There is a complication when there are two actors that can initiate an interaction.
  3. Use cases as classes
    • A new class is defined for each use case and would have a method like run, with a suitable number of arguments.
    • The user interface would create a single instance of the appropriate class, intialise it suitably, then send the run message.
    • Can improve reuse.

(b2, p155)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the main disadvantage of defensive programming?

A

The main disadvantage of defensive programming is that the same constraints within each precondition may be checked repeatedly in different operations.

(b2, p157)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a state machine?

A

A state machine is a model that shows how an object changes from state to state in response to events.

(b2, p161)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the six components of state machines?

A
  1. States, represented by the round-cornered rectangles containing their names.
  2. Events, repesented by labels on the transition arrows.
  3. Transitions, represented by arrows and identified by the events that give rise to them. Transitions occur as a response to an event and cause a change of state.
  4. Guards, represented by text in square brackets. Guards are used to choose which transition to take if the same event appears on more than one transition.
  5. Initial state, represented by a solid black circle. Initial state shows which state a new object will enter first. There can only be one initial state.
  6. Final state, represented by a black circle surrounding a solid black circle. Final state shows that processing has been terminated. There can be multiple final states.
  7. Possibly entry and exit events, represented by including ‘entry / ‘ or ‘exit / ‘, followed by the method name and any parameters.

(b2, p162-166)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Draw a state machine diagram for the following lending library scenario:

Newly purchased copies of a book are put on to the shelf for lending to the library’s members. Damaged copies are removed from stock. At certain times of the year, each library is allowed to select copies of books to go on sale to the public.

A

(b2, 166)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a self-transition, in relation to state diagrams?

A

Self-transitions originate in one state and return to the same state. They are commonly found in state machines that model loops or cycles.

(b2, p170)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a package, in terms of UML?

A

A package can be used to group model elements into a single unit. Packages may be nested.

(b2, p181)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Can UML packages interact with each other?

A

No. They do not have interfaces and cannot have instances, so cannot interact with each other.

(b2, p181)

17
Q

What are the three main reasons for partitioning a software system?

A
  1. To manage size and complexity
  2. For information hiding
  3. For logical decomposition

(b2, p181)

18
Q

How would you represent packages in a three-layered architecture approach?

A

(b2, p184)