Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jerry Gao Ph.D.9/2001 The UML: Object-Oriented Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University email:

Similar presentations


Presentation on theme: "Jerry Gao Ph.D.9/2001 The UML: Object-Oriented Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University email:"— Presentation transcript:

1 Jerry Gao Ph.D.9/2001 The UML: Object-Oriented Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University email: jerrygao@email.sjsu.edu URL: http://www.engr.sjsu.edu/gaojerry Sept., 2001

2 Jerry Gao Ph.D.9/2001 Object-Oriented Modeling The Unified Modeling Language (UML) Object-Oriented Modeling: - Focus on classes, objects and their relationships in the system - Represent the system using class diagrams and object diagrams - Is an iterative process The major elements of the object-oriented modeling: - classes, objects and their relationships. Purpose of object-oriented modeling: - to describe the system in terms of classes and objects - to provide a complete object-oriented view of the system - to help the understanding of the system through object-oriented analysis and modeling

3 Jerry Gao Ph.D.9/2001 A Class Diagram and An Object Diagram The Unified Modeling Language (UML) 1..* Author Name:String age: integer Computer Name:String memory: integer Uses 0..1 Class diagram Bob:Author Name:”Bob J.” age: 32 Bob’s Job PC Computer Name:”Dell 466” memory: 64 Object diagram

4 Jerry Gao Ph.D.9/2001 Object-Oriented Modeling The Unified Modeling Language (UML) How to perform object-oriented modeling? - Step #1: Identify classes and objects in the system. - Find classes in the system - Identify their names and attributes - Identify their operations or functions - Step #2: Find the relationships between classes - Find association relationships between classes - Find aggregation relationships between classes - Find inheritance (generalization) relationship between classes - Define the roles and cardinality of each class in the relationships. - Step #3: Generate object diagrams based class diagrams

5 Jerry Gao Ph.D.9/2001 Finding Classes The Unified Modeling Language (UML) Finding classes by asking the following questions: - Do we have information that should be stored or analyzed? If so, check information-oriented classes. such as input/output - Do we have external systems? If so, check the interface classes. - Do we use any components, libraries? If so, check component-oriented classes and library-oriented classes. - Do we have any customers or users? If so, check user-oriented classes. - Do we handle any devices? If so, check hardware-oriented interface classes. - Do we have any business structure or organization involved in the system?If so, find organization-oriented classes.

6 Jerry Gao Ph.D.9/2001 Class Examples The Unified Modeling Language (UML) Student Name:String age: integer SS#: String GPA: float ReadStudent(); UpdateStudent(); CreateStudent(); PrintStudent(); Figure Size: Size position: Position Type: FigureType draw(); setFiguer(); scaleFigure(); returnPosition(); operations attributes

7 Jerry Gao Ph.D.9/2001 Association Relationship Between Classes The Unified Modeling Language (UML) StudentComputer Owns StudentComputer Owns 1..*0..* Multiplicity: default one-to-one 0..1 zero-to-one 0..* or *zero-to-many 1..* one-to-many

8 Jerry Gao Ph.D.9/2001 Roles in Association Relationship Between Classes The Unified Modeling Language (UML) Person married to wife husband A husband is married to a wife. Both husband and wife are people. If a person is not married, then he or she cannot play the role of husband or wife, which means the married to association is not applicable. Car Person drives * * company cardriver role A person plays the role of a driver, and a car plays the role of a company car the relationship.

9 Jerry Gao Ph.D.9/2001 Aggregation Relationship Between Classes The Unified Modeling Language (UML) NavyWarship Contains TeamPerson members * * ** Normal Aggregation Shared Aggregation A team is composed of team members. One person could be a member of many teams.

10 Jerry Gao Ph.D.9/2001 Aggregation Relationship Between Classes The Unified Modeling Language (UML) Composition Aggregation window listbox text button menu * * * * contains

11 Jerry Gao Ph.D.9/2001 Generalization Relationship Between Classes The Unified Modeling Language (UML) Normal Generalization -> Inheritance Part-time Student Full-time Student Part-time Student Full-time Student

12 Jerry Gao Ph.D.9/2001 A Class Diagram for Financial Trading The Unified Modeling Language (UML) CustomerPortfolioTrader Instrument BondStock Option 1 Owns1..*1..* Handles1 0..* Contains

13 Jerry Gao Ph.D.9/2001 Packages The Unified Modeling Language (UML) Subsystem B Subsystem A Subsystem E Subsystem C Subsystem D dependency

14 Jerry Gao Ph.D.9/2001 Packages The Unified Modeling Language (UML) Subsystem B Subsystem A Subsystem D Subsystem C Subsystem E

15 Jerry Gao Ph.D.9/2001 The UML: Dynamic Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University email: jerrygao@email.sjsu.edu URL: http://www.engr.sjsu.edu/gaojerry Sept., 2001

16 Jerry Gao Ph.D.9/2001 Dynamic Modeling The Unified Modeling Language (UML) Dynamic Modeling: - Focus on dynamic behaviors in the system - Use state, sequence, collaboration, and activity diagrams to present the behaviors of the system - Demonstrate how the objects interact dynamically The results of dynamic modeling: - State diagrams: -> describing object states and their changes in terms of events. - Sequence diagrams: -> describing how objects interact and communicate with each other. - Collaboration diagrams: -> describing how objects collaborate together by interactions - Activity diagrams: -> another shows the object interactions for functionality and actors.

17 Jerry Gao Ph.D.9/2001 The Notation of State Diagram The Unified Modeling Language (UML) State 1State 2 Event State starting point State end point State Name State Vars Activities

18 Jerry Gao Ph.D.9/2001 A State Diagram for An Elevator The Unified Modeling Language (UML) On first floor Moving up Moving Down Idle Moving to first floor Go up(floor) Active at floor Go up(floor) Arrive at floor Go down(floor) Arrive at first floor Time out

19 Jerry Gao Ph.D.9/2001 A State Diagram for An Elevator The Unified Modeling Language (UML) On first floor Moving up do/moving to floor Moving down do/moving to floor Idle timer = 0 do/increase timer Moving to first floor Go up(floor) Active at floor Go up(floor) Arrive at floor Go down(floor) Arrive at first floor [Timer = time out] Guard-condition

20 Dynamic Modeling Instructor: Jerry Gao Ph.D. San Jose State University email: jerrygao@email.sjsu.edu URL: http://www.engr.sjsu.edu/gaojerry Sept., 2001

21 Topic: The Unified Modeling Language Jerry Gao Ph.D.9/2001 Sending Messages between State Diagrams All Rights Reserved OffOn On() Off() Play() Stop() OffOn/Stop On() Off() Off()/Stop() On/Play Play() Stop() CD Player Stop() Play()On() Off() Remote control

22 Topic: The Unified Modeling Language Jerry Gao Ph.D.9/2001All Rights Reserved An And-Substates Example Low SpeedHigh Speed ForwardBackward Running concurrent substates

23 Sequence Diagram Instructor: Jerry Gao Ph.D. San Jose State University email: jerrygao@email.sjsu.edu URL: http://www.engr.sjsu.edu/gaojerry Sept., 2001

24 Sequence Diagram Sequence diagrams: - illustrate how objects interact with each other. - focus on interacting message sequences between objects :ObjectName Simple message Synchronous message [Guard-condition] Return Activation lifeline

25 Sequence Diagram Example :Computer Print(ps-file) Activation lifeline :PrinterServer:Printer Print(ps-file) Object [no queue] Print(ps-file) Guard-condition Synchronous message Return simple message

26 Sequence Diagram Example :Computer Print(file) :PrinterServer:Printer Print(file) [printer free] Print(file) :Queue [printer busy] Store(file)


Download ppt "Jerry Gao Ph.D.9/2001 The UML: Object-Oriented Modeling The Unified Modeling Language (UML) Instructor: Jerry Gao Ph.D. San Jose State University email:"

Similar presentations


Ads by Google