Using UML Patterns and Java ObjectOriented Software Engineering
Using UML, Patterns, and Java Object-Oriented Software Engineering Art for Chapter 2, Modeling with UML
Figure 2 -1, A UML use case diagram describing the functionality of a simple watch. Simple. Watch Read. Time Watch. User Set. Time Watch. Repair. Person Change. Battery Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2
Figure 2 -2, A UML class diagram describing the elements of a simple watch. Simple. Watch 2 Push. Button Bernd Bruegge & Allen H. Dutoit 1 1 Display 1 1 1 2 1 Battery Time Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
Figure 2 -3, A UML sequence diagram for the Simple. Watch. : Simple. Watch : Watch. User press. Button 1() blink. Hours() press. Button 1() blink. Minutes() press. Button 2() : Display : Time increment. Minutes() refresh() press. Buttons 1 And 2() commit. New. Time() stop. Blinking() Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
Figure 2 -4, A UML statechart diagram for Set. Time use case of the Simple. Watch. button 1&2 Pressed Blink Hours button 2 Pressed Increment Hours button 1 Pressed button 1&2 Pressed Blink Minutes button 2 Pressed Increment Minutes button 1 Pressed Stop Blinking Bernd Bruegge & Allen H. Dutoit Blink Seconds button 2 Pressed Object-Oriented Software Engineering: Using UML, Patterns, and Java Increment Seconds 5
Figure 2 -5, An example of a UML activity diagram. Allocate Resources Open Incident Coordinate Resources Archive Incident Document Incident Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
Figure 2 -6, A Model is an abstraction describing a subset of a System. A View depicts selected aspects of a Model. Views and Models of a single System may overlap each other. Scale model Electrical All blueprints Airplane Fuel Flight simulator Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
Figure 2 -7, Example of describing a model with two different notations. UML Book 1 * Chapter composed-of Booch Book Bernd Bruegge & Allen H. Dutoit N composed-of Chapter Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
Watch time date Set. Date(d) Calculator. Watch calculator. State Enter. Calc. Mode() Input. Number(n) Figure 2 -8, A UML class diagram depicting two classes: Watch and Calculator. Watch is a refinement of Watch, providing calculator functionality normally not found in normal Watches. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
Figure 2 -9, An example of abstract class. Organic. Compound Benzene Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
Figure 2 -10, A UML class diagram depicting instances of two classes. «instance. Of» simple. Watch 1291: Watch calculator. Watch 1515 : Calculator. Watch Bernd Bruegge & Allen H. Dutoit Watch «instance. Of» Calculator. Watch Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
Figure 2 -11, Examples of message sends. : Simple. Watch : Watch. User press. Button 2() : Time. Zone get. Time() GMTTime get. Time. Delta() GMTTime Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Application Domain Model Solution Domain System Model Traffic. Control Summary. Display Traffic. Controller Aircraft Flight. Plan Airport Map. Display Flight. Plan. Database Traffic. Control Figure 2 -12, The application domain model represents entities of the environment which are relevant to an air traffic control system (e. g. , aircraft, traffic controllers). Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
Figure 2 -13, An example of a UML use case diagram: Incident initiation in an accident management system. FRIEND Report Field. Officer Emergency Open. Incident Dispatcher Allocate. Resources Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
Figure 2 -16, An example of an «include» relationship. «include» Open. Incident «include» Help. Dispatcher Allocate. Resources Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
Figure 2 -18, An example of an «extend» relationship. «extend» Open. Incident Connection. Down «extend» Allocate. Resources Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Figure 2 -20, An example of a generalization relationship. Authenticate With. Password Authenticate With. Card Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
Figure 2 -22, An example of a UML class diagram: classes that participate in the Report. Emergency use case. Emergency. Report reports. Generated Bernd Bruegge & Allen H. Dutoit 1 Incident 1. . * incidents. Generated * Dispatcher Field. Officer name: String badge. Number: Integer * reports 1 author name: String badge. Number: Integer Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 initiator 18
Figure 2 -23, An example of a UML object diagram: objects that participate in the warehouse. On. Fire scenario. bob: Field. Officer report_1291 incident_1515 name = “Bob D. ” badge. Number = 132 john: Dispatcher alice: Field. Officer name = “John D. ” badge. Number = 12 name = “Alice W. ” badge. Number = 23 Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
Figure 2 -24, Example of a one-directional association. * Polygon Bernd Bruegge & Allen H. Dutoit * Point Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Figure 2 -25, An example of an association class. Allocates role: String notification. Time: Time Field. Officer name: String badge. Number: Integer Bernd Bruegge & Allen H. Dutoit Incident 1 resources incident 1. . * Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
Figure 2 -26, Alternative model for Allocation 1 role: String notification. Time: Time Field. Officer 1 incident name: String badge. Number: Integer Bernd Bruegge & Allen H. Dutoit 1. . * resources Object-Oriented Software Engineering: Using UML, Patterns, and Java 1 Incident 22
Figure 2 -27, Examples of aggregations. State 1 * Police. Station Directory Bernd Bruegge & Allen H. Dutoit County 1 * Township Police. Officer 1 * File Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
Figure 2 -28, Examples of multiplicity. Police. Officer Fire. Unit Field. Officer Bernd Bruegge & Allen H. Dutoit 1 1 1 owner property * * author report * Badge. Number Fire. Truck Incident. Report Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
Figure 2 -29, Example of a hierarhical file system. * File. System. Element 1 Directory Bernd Bruegge & Allen H. Dutoit File Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
Figure 2 -30, Example of a nonhierarchical file system. * File. System. Element * Directory Bernd Bruegge & Allen H. Dutoit File Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
Figure 2 -31, Example of how a qualified association uses reduces multiplicity. Without qualification Directory 1 File * filename With qualification Directory Bernd Bruegge & Allen H. Dutoit filename 1 0. . 1 Object-Oriented Software Engineering: Using UML, Patterns, and Java File 27
Figure 2 -32, An example of a generalization. Police. Officer name: String badge. Number: Integer initiator author Field. Officer 1 Dispatcher * reports. Generated Emergency. Report Bernd Bruegge & Allen H. Dutoit 1 * incidents 1 1. . * Object-Oriented Software Engineering: Using UML, Patterns, and Java Incident 28
Figure 2 -33, Examples of operations provided by the Incident class. Incident assign. Resource(r) close() Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Figure 2 -34, Example of a sequence diagram: setting the time on 2 Bwatch. : Simple. Watch : Watch. User press. Button 1() blink. Hours() press. Button 1() blink. Minutes() press. Button 2() : Display : Time increment. Minutes() refresh() press. Buttons 1 And 2() commit. New. Time() stop. Blinking() Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30
Figure 2 -35, Examples of conditions and iterators in sequence diagrams. a b c [i>0] op 1() [i<=0] op 2() *op 3() Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
Figure 2 -36, Example of a collaboration diagram: Setting the time on 2 Bwatch. : 2 Bwatch. Owner 1: p ress. Buttons 1 And 2() 2: press. Button 1() 3: press. Button 2() 4: press. Buttons 1 And 2() : 2 Bwatch. Input 1. 1: blink. Hours() 2. 1: blink. Minutes() 4. 2: stop. Blinking() : 2 Bwatch. Display 3. 1: i ncrement. Minutes() 4. 1: c ommit. New. Time() : 2 Bwatch. Time Bernd Bruegge & Allen H. Dutoit 3. 2: r efresh() Object-Oriented Software Engineering: Using UML, Patterns, and Java 32
Figure 2 -37, A UML statechart diagram for the Incident class. Active Inactive incident. Handled Bernd Bruegge & Allen H. Dutoit Closed incident. Documented Archived incident. Archived Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Figure 2 -38, Statechart diagram for 2 Bwatch set time function. press. Buttons. LAnd. R Measure. Time Set. Time after 2 min. after 20 years press. Buttons. LAnd. R/beep after 20 years Dead. Battery Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34
Figure 2 -39, Internal transitions associated with the Set. Time state. press. Both. Buttons Measure. Time Set. Time do/count ticks entry/blink hours press. Button 1/blink next number press. Button 2/increment current number exit/stop blinking after 2 min. press. Both. Buttons/beep after 20 years Measure. Time Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 35
Figure 2 -40, Refined statechart associated with the Set. Time state. Set. Time b 1 Blink. Hours b 2/incr hour b 1 Blink. Minutes Blink. Seconds b 2/incr min. b 2/incr sec. b 1 Blink. Year Blink. Month b 2/incr year b 2/incr mo. b 1 Bernd Bruegge & Allen H. Dutoit Blink. Day b 2/incr day b 1 Object-Oriented Software Engineering: Using UML, Patterns, and Java 36
Figure 2 -41, A UML activity diagram for Incident. Handle Incident Bernd Bruegge & Allen H. Dutoit Document Incident Object-Oriented Software Engineering: Using UML, Patterns, and Java Archive Incident 37
Figure 2 -42, Example of decision in the Open. Incident process. [low. Priority] Open Incident Allocate Resources [fire & high. Priority] [not fire & high. Priority] Notify Fire Chief Notify Police Chief Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 38
Figure 2 -43, An example of complex transitions in a UML activity diagram. Allocate Resources Open Incident Coordinate Resources Archive Incident Document Incident Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 39
Figure 2 -44, An example of swimlanes in a UML activity diagram. Allocate Resources Open Incident Coordinate Resources Document Incident Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java Dispatcher Archive Incident Field. Officer 40
Incident. Management Report Emergency Dispatcher Open. Incident Field. Officer Allocate. Resources Incident. Archive. Incident Librarian Search. Archive Sys. Administration Manage. Users Manage. Terminals Sys. Admin Figure 2 -45, Example of packages: use cases of FRIEND organized by actors. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 41
Figure 2 -46, Example of packages. Incident. Management Field. Officer Dispatcher Incident. Archive Sys. Administration Librarian Bernd Bruegge & Allen H. Dutoit Sys. Admin Object-Oriented Software Engineering: Using UML, Patterns, and Java 42
Figure 2 -47, Example of packages. Field. Station Dispatcher Field. Officer Emergency. Report Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java Incident 43
Figure 2 -48, An example of a note. Notes can be attached to a specific element in a diagram. Field. Station Dispatcher Field. Officer Emergency. Report Bernd Bruegge & Allen H. Dutoit The Emergency. Report class is defined in Field. Station and used in both stations. Object-Oriented Software Engineering: Using UML, Patterns, and Java Incident 44
Figure 2 -49, Examples of stereotypes. «entity» Year «entity» Month Bernd Bruegge & Allen H. Dutoit «control» Change. Date. Control «entity» Day «boundary» Button. Boundary «boundary» LCDDisplay. Boundary Object-Oriented Software Engineering: Using UML, Patterns, and Java 45
Figure 2 -50, An example of constraint. Emergency. Report reports 1 1. . * Incident {ordered by time of receipt} Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 46
- Slides: 46