• Home
  • Textbooks
  • Using UML: Software Engineering with Objects and Components
  • Essentials of state and activity diagrams

Using UML: Software Engineering with Objects and Components

Perdita Stevens

Chapter 11

Essentials of state and activity diagrams - all with Video Answers

Educators


Chapter Questions

Problem 73

Consider the alternative of having just a single message, say borrowOrReturn, in response to which a Copy object toggles the value of onShelf. What are the consequences
of such a design change?

Check back soon!

Problem 74

How else might unexpected messages be dealt with? What are the advantages and
disadvantages of the approaches you consider?

Check back soon!

Problem 75

After reading Chapter 6.) What difference does it make if the class has a class invariant?

Check back soon!

Problem 76

In Chapter 5 we said that it is not useful to show attributes of a class whose sole purpose
is to implement the associations shown in the class diagram: this violates the WRITE
ONCE rule, which states that wherever possible you should avoid recording information
twice if that means you have to keep the versions consistent (see Chapter 2). Yet here
we needed some way to refer to the Book object associated with the Copy object.
Do you think our decision to invent an attribute book of Copy for the purpose was
reasonable? Should we now update our class model to show this attribute? What are the
options, and what are their pros and cons?

Check back soon!

Problem 77


Even though Figures 11.2, 11.3, and 11.4 mean the same, there are various reasons why
you might prefer one form. Consider maintenance for example. What do you think?

Check back soon!

Problem 78


Why can we not just add an extra state to show a Book with one copy remaining and so
avoid using guards? If you cannot see a reason, try drawing the state diagram that would
result.

Check back soon!

Problem 79


Suppose that you decide to use a protocol state machine to model the behavior of an
object. Thus you cannot use actions on the transitions to model an object’s reaction
to an event. What UML diagrams, or other techniques, might be useful to model its
reaction?

Check back soon!

Problem 80


What are the pros and cons of using protocol state machines versus using general state
machines?

Check back soon!

Problem 81


Consider in detail the changes that would be necessary if we split the class Copy
as described above. Do you think this would be an improvement, or not?

Check back soon!
View

Problem 82


Another major factor in making this kind of decision is how often the change of
state or class is likely to be needed. Why is this important?

Rashmi Sinha
Rashmi Sinha
Numerade Educator
01:52

Problem 83


Consider the CS4 Administration System described in Chapter 15. Instead of the
two classes Lecturer and DirectorOfStudies, we could have had a single class
Lecturer with an attribute isDirectorOfStudies. Consider what difference
this would make and whether you think it would be an improvement.

Manik Pulyani
Manik Pulyani
Numerade Educator

Problem 84


Many people (Clemens Szyperski in [44], for example) say that a component should
not have any persistent state, so in particular its state diagram should have just one
state. Why is this?

Check back soon!