Page 812 - Introduction to Programming with Java: A Problem Solving Approach
P. 812
778 Chapter 15 Files
APPENDIX 7
UML Diagrams
The Unified Modeling Language (UML) is a descriptive language that helps program designers organize the subject matter of a prospective object-oriented program, and it provides high-level documentation of both structure and behavior. It’s independent of any particular programming language, and it doesn’t compile into an executable program. It’s just an organizational tool. It was developed by the “Three Amigos”— Grady Booch, James Rumbaugh, and Ivar Jacobson, at Rational Software Corp, which is now part of IBM. Currently it is maintained by the non-profit Object Management Group (OMG) consortium.
1
UML specifies many different kinds of visualizing diagrams. In this appendix, we’ll focus on just two
of them—activity diagrams (which depict behavior) and class diagrams (which depict structure). When
UML describes behavior, arrows point to what happens next. When UML describes structure, arrows point
to what provides support, and this is opposite to the direction of “information flow.” So in the following
diagrams.
UML Activity Diagrams
Activity diagrams are UML’s version of the flowcharts we introduced in Chapter 2. They portray an algo- rithm’s flow of control. Figure A7.1 shows an example of a UML activity diagram for the Happy Birthday algorithm presented as a flowchart in Figure 2.9. The solid black circle is an initial state, and the black dot in a white circle is a final state. The oval boxes represent action states or activities. They contain informal descriptions of coherent actions. The arrows are transitions. The labels in square brackets next to some of the transitions are boolean conditions called guards—a particular transition occurs if and only if the ad- jacent guard value is true. The actions or activities shown in Figure A7.1 represent low-level or primitive operations.
At a higher level of scale, the activity described in a single oval could represent a whole set of actions. For example, you could use a single activity symbol to represent the whole looping operation shown in Figure A7.1, like this:
print “Happy birthday!” 100 times
1 The full UML specification is a thousand pages long. For a simple 20-page introduction to the UML specification, see: ftp://ftp.software.ibm.com/software/rational/web/whitepapers/2003/intro_rdn.pdf. For a more complete description, see: Sinan Si Alhir, UML In a Nutshell, O’Reilly, 1998. Also see: Ivar Jacobson, Grady Booch, and James Rumbaugh, The Unified Software De- velopment Process, Addison-Welsey, 2005.
discussion, be prepared for a switch in arrow directionality as we move from activity diagrams to class
Apago PDF Enhancer
778