1 / 26

Jerry Gao Ph.D. 9/2001

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

walker
Télécharger la présentation

Jerry Gao Ph.D. 9/2001

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. The Unified Modeling Language (UML) Object-Oriented Modeling 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 processThe 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 Jerry Gao Ph.D. 9/2001

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

  4. The Unified Modeling Language (UML) Object-Oriented Modeling 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 Jerry Gao Ph.D. 9/2001

  5. The Unified Modeling Language (UML) Finding Classes 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. Jerry Gao Ph.D. 9/2001

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

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

  8. The Unified Modeling Language (UML) Roles in Association Relationship Between Classes Person role wife husband married to 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. drives * * Person Car company car driver A person plays the role of a driver, and a car plays the role of a company car the relationship. Jerry Gao Ph.D. 9/2001

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

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

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

  12. The Unified Modeling Language (UML) A Class Diagram for Financial Trading 1 Owns 1..* 1..* Handles 1 Customer Portfolio Trader 0..* Contains Contains 0..* Instrument Stock Option Bond Stock Jerry Gao Ph.D. 9/2001

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

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

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

  16. The Unified Modeling Language (UML) Dynamic Modeling 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 dynamicallyThe 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. Jerry Gao Ph.D. 9/2001

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

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

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

  20. Dynamic Modeling Instructor: Jerry Gao Ph.D.San Jose State Universityemail: jerrygao@email.sjsu.eduURL: http://www.engr.sjsu.edu/gaojerrySept., 2001

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

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

  23. Sequence Diagram Instructor: Jerry Gao Ph.D.San Jose State Universityemail: jerrygao@email.sjsu.eduURL: http://www.engr.sjsu.edu/gaojerrySept., 2001

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

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

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

More Related