Chapter 4. Demonstrating Behavior with UML

In This Chapter

  • Drawing out objects in UML

  • Expanding use cases into use case diagrams

  • Ordering steps with sequence diagrams

  • Showing how objects collaborate

  • Noting the flow of activities

  • Stating the different states of an object

In this chapter, we take you through the five dynamic diagrams in UML. These are the diagrams that show how objects work together and change over time. Some of them you may find more useful than others, and that's fine — you don't have to use all the diagrams you see in this chapter. You are free to use those that you find the most useful.

Drawing Objects

In UML, you can draw class diagrams that show the classes in your system, or you can get right down to it and draw an object diagram, which contains actual instances or objects. Because you are drawing instances, you might have multiple objects of a single class on a single object diagram.

Note

When you draw objects on a UML diagram, they look pretty much the same as class diagrams, but with one important difference: For an object, the name at the top of the rectangle is underlined. With classes, the name is not underlined. Be sure to remember this difference so your diagrams don't confuse other people. Probably the best way to explore an object diagram is to see it compared to a class diagram. Take a peek at Figure 4-1, and you can see a class diagram at the top and an object diagram at the bottom.

Two classes are in the diagram. The names are not underlined and the two classes ...

Get C++ All-In-One For Dummies®, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.