Download presentation
Presentation is loading. Please wait.
1
The Unified Modeling Language (UML)
Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001
2
The Unified Modeling Language (UML)
Presentation Outline - Introduction to UML - An Overview of UML - UML Notation - Use-Case Modeling - Modeling Classes, Objects, and Their Relationships - Dynamic Modeling - Advanced Dynamic Modeling: Real-Time Systems - Physical Architectures Jerry Gao Ph.D. 9/2001 All Rights Reserved
3
The Unified Modeling Language (UML)
Introduction To UML What is UML? The UML is a modeling tool (or methodology) for software engineers and system analysts. It is designed to support all phases of software development, including - Requirements analysis and specification - Software design specification - Software code generation - Testing systems and modules in a black box view Why UML? - Software developments need consistent and standard modeling tool (or methods) to all phases of software development >- understandable, consistent, simple, and powerful - Too many methods Jerry Gao Ph.D. 9/2001
4
The Unified Modeling Language (UML)
Introduction To UML The goals of UML (stated by the designers): - To model systems using Object-Oriented Concepts - To establish an explicit coupling to conceptual as well as executable artifacts - To address the issue of scale inherent in complex, mission-critical systems - To create a modeling language usable by both humans and machines. Use of UML: (The UML has a broad spectrum of usage) - business modeling - software modeling in all phases of development for various systems Jerry Gao Ph.D. 9/2001
5
The Unified Modeling Language (UML)
Introduction To UML History of UML: - Grady Booch and James Rumbaugh at Rational Software Corp. Started the work on UML in In the initial work, they unite the Booch method and the MOT-2 method. - In 1995 systems, Ivar Jacobson (OOSE and Objectory methods) joined them. - Rational bought Objective System (the Swedish company) They started to work on UML to create a unified modeling method and tool Jerry Gao Ph.D. 9/2001
6
The Unified Modeling Language (UML)
Introduction To UML The Acceptance of UML: - During 1996, a number of companies and organizations joined Rational to form the UML Partners consortium , many companies joined them: IBM, OCON, HP, DEC, Microsoft, Oracle, TI,… OMG has decide to use UML as their standard and is working on the final details of the specification. Jerry Gao Ph.D. 9/2001
7
The Unified Modeling Language (UML)
The View of UML Component View Local View Use-Case View Deployment View Concurrency View Jerry Gao Ph.D. 9/2001
8
The Unified Modeling Language (UML)
An Overview of UML Use-Case View: - Describe the functionality of the system from an external view - Focus on system function usage from the user point of view - Described in use-case diagrams - Used to support users, operators, designers, developers, and testers What are the system functions? Use-Case Diagrams External view Software Application System Jerry Gao Ph.D. 9/2001
9
Use-Case Diagram for An Insurance Business
The Unified Modeling Language (UML) Use-Case Diagram for An Insurance Business Signing an insurance policy Sale statistics Insurance Salesperson Customer Customer statistics Jerry Gao Ph.D. 9/2001
10
The Unified Modeling Language (UML)
An Overview of UML Logical View: - Describe how the system functionality is provided - Focus on internal logic structures and elements of the system - Provide diagrams to represent static structure & dynamic behaviors of the system - Used to support designers and developers How do they work? Static modeling diagrams Dynamic modeling diagrams internal view Software Application System Jerry Gao Ph.D. 9/2001
11
A Class Diagram for Financial Trading
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
12
A Class Diagram and An Object Diagram
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
13
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
14
A Sequence Diagram For A Printer Server
The Unified Modeling Language (UML) A Sequence Diagram For A Printer Server Print(file) :Computer :PrinterServer :Printer :Queue Print(file) [printer free] Print(file) [printer busy] Store(file) Jerry Gao Ph.D. 9/2001
15
A Collaboration Diagram For A Printer Server
The Unified Modeling Language (UML) A Collaboration Diagram For A Printer Server :Queue :Computer [printer busy] 1.2:Store(file) 1:Print(file) [printer free]1.1:Print(file) :PrinterServer :Printer Jerry Gao Ph.D. 9/2001
16
The Unified Modeling Language (UML)
Component View of UML Component View: - Describe the implementation modules and their dependencies. - Focus on system structure at the component integration level - Provide component diagrams with component structures and dependencies - Used to support developers What is the system structure and component interactions? Component diagrams Component view Component Software Application System Jerry Gao Ph.D. 9/2001
17
The Unified Modeling Language (UML) An Activity Diagram Example
Show MessageBox “Disk full” on Screen [Disk full] PrintFile() Show MessageBox “Print” on Screen [free disk space] Remove MessageBox ^Printer.Print(file) Create postscript file Jerry Gao Ph.D. 9/2001
18
The Unified Modeling Language (UML) A Component Diagram Example
Window Handler (whnd.cpp) Window Handler (whnd.obj) Graphic lib (graphic.dll) Comm Handler (comhnd.cpp) Comm Handler (comhnd.obj) Client Program (client.exe) Main Class (main.cpp) Main Class (main.obj) Jerry Gao Ph.D. 9/2001
19
The Unified Modeling Language (UML)
An Overview of UML Concurrency View: - View the system as processes and processors. - Focus on parallel execution, concurrent threads, their communications and synchronization - Provide dynamic diagrams and implementation diagrams - Designed for developers and integrators of the system What are processes? How do they interact? Implementation modeling diagrams Dynamic modeling diagrams Concurrency view process P1 P2 P3 Software Application System Jerry Gao Ph.D. 9/2001
20
The Unified Modeling Language (UML)
An Overview of UML Deployment View: - Describe show the physical deployment of the system (or physical architecture) in terms of devices and computers - Focus on physical parts of the system and their connections - Provide deployment diagrams - Used to support developers, integrators, and testers What is the physical architecture? Deployment diagrams physical view Jerry Gao Ph.D. 9/2001
21
A Deployment Diagram (physical architecture)
The Unified Modeling Language (UML) A Deployment Diagram (physical architecture) Client A: Compaq Pro PC Database Server VAX Application Server: Silicon Graphics O2 <<TCI/IP>> <<DecNet>> <<TCI/IP>> Client B: Compaq Pro PC Jerry Gao Ph.D. 9/2001
22
The Unified Modeling Language (UML) UML Notation - Model Elements
Class Attributes Operations Object Attributes Operations State Node Interface Use case Component Package Note Jerry Gao Ph.D. 9/2001
23
The Unified Modeling Language (UML) UML Notation - Model Elements
Association Dependency Generalization Aggregation Class anObject: Class Jerry Gao Ph.D. 9/2001
24
The Unified Modeling Language (UML) The Results of the UML Modeling
Use-case Diagrams Class Diagrams State Diagrams Sequence Diagrams Collaboration Diagrams Activity Diagrams Component Diagrams Deployment Diagrams Common Repository Jerry Gao Ph.D. 9/2001
25
The Unified Modeling Language (UML) The UML: Use-Case Modeling
Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001 Jerry Gao Ph.D. 9/2001
26
The Unified Modeling Language (UML)
Use-Case Modeling Use-Case Modeling: - use the use-case diagrams to describe a system - represent the functionality of the system - present a use-case view of the system - an iterative process The major components of a use-case model: - use cases, actors, and the system and relationships. - The functionality is represented by a number of use cases. - Each of them specifies a complete functional feature. Purpose of use cases: - to describe the functional requirements of the system - to provide a clear and consistent description of what the system do - to provide a basis for system tests - to make functional requirements traceable Jerry Gao Ph.D. 9/2001
27
Use-Case Diagram for An Insurance Business
The Unified Modeling Language (UML) Use-Case Diagram for An Insurance Business Signing an insurance policy Sale statistics Insurance Salesperson Customer Customer statistics Jerry Gao Ph.D. 9/2001
28
The Unified Modeling Language (UML)
Use-Case Modeling How to perform use-case modeling? - Step #1: Finding actors. - An actor is someone interacting with the system. such as users, operators, or another system… - Actor is a type, not instance. - Step #2: Find the relationships between actors - Generalization relationship between actors (inheritance) - Step #3: Define use cases. - A use case represents a complete functionality of the system from an actor point’s of view - Step #4: Identify the relationships between use cases Jerry Gao Ph.D. 9/2001
29
The Unified Modeling Language (UML)
Use-Case Modeling Finding actors by asking the following questions: - Who will use the system? - Who will support and maintain the system? - Who will perform administration work for the system? - What other systems or (hardware) are interested the results from the system? - What other systems or (hardware) may generate input information or signals to the system? Jerry Gao Ph.D. 9/2001
30
Generalization between customer actors
The Unified Modeling Language (UML) Generalization between customer actors Customer Personal Visitor Customer Telephone Customer Jerry Gao Ph.D. 9/2001
31
The Unified Modeling Language (UML)
Use-Case Modeling Characteristics of use cases: - A use case is always initiated by an actor. - A use case provides value to an actor. - A use case is complete. - Use cases are connected to actors through associations. Relationships between use cases: - Extends relationship: one use case extends another use case by adding actions to a general use case. - Use relationship: one use case uses another use case. - Grouping: a number of use cases handle similar functionality. Jerry Gao Ph.D. 9/2001
32
The Unified Modeling Language (UML) Notations for Use Cases in UML
System Name Use-case A Actor Name Use-case B Communication Association Use-case C Use-case name Jerry Gao Ph.D. 9/2001
33
Relationships Between Use Cases in UML
The Unified Modeling Language (UML) Relationships Between Use Cases in UML Signing insurance policy Signing insurance policy <<Extends>> <<uses>> <<uses>> Signing Life Insurance Signing Car Purchase Insurance Signing Car Insurance Jerry Gao Ph.D. 9/2001
34
The Unified Modeling Language (UML)
Describing Use Cases The description of the use case is normally done through a text description. It also can be described through an activity diagram. It is about how the actors and the use cases interact. The description of a use case should include: - Objective for the use case - How the use case is initiated - The flow of messages between actors and the use case - Alternative flow in the use case - How the use case finishes with a value to the actor Jerry Gao Ph.D. 9/2001
35
The Unified Modeling Language (UML)
A Use Case Example Jerry Gao Ph.D. 9/2001
36
An Activity Diagram Example
The Unified Modeling Language (UML) An Activity Diagram Example Inserts coins into machine Check that enough coins have been inserted? Show that drink now can be chosen Show that drink is not available Chose drink [drink not available] [drink available] Deliver drink Jerry Gao Ph.D. 9/2001
37
The Unified Modeling Language (UML) The UML: Object-Oriented Modeling
Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001 Jerry Gao Ph.D. 9/2001
38
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 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 Jerry Gao Ph.D. 9/2001
39
A Class Diagram and An Object Diagram
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
40
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
41
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
42
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
43
Association Relationship Between Classes
The Unified Modeling Language (UML) Association Relationship Between Classes Student Computer Owns Student 1..* 0..* Computer Owns Multiplicity: default one-to-one zero-to-one 0..* or * zero-to-many 1..* one-to-many Jerry Gao Ph.D. 9/2001
44
Roles in Association Relationship Between Classes
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
45
Aggregation Relationship Between Classes
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
46
Aggregation Relationship Between Classes
The Unified Modeling Language (UML) Aggregation Relationship Between Classes text Composition Aggregation * listbox * window button contains * menu * Jerry Gao Ph.D. 9/2001
47
Generalization Relationship Between Classes
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
48
A Class Diagram for Financial Trading
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
49
The Unified Modeling Language (UML)
Packages dependency Subsystem D Subsystem A Subsystem B Subsystem C Subsystem E Jerry Gao Ph.D. 9/2001
50
The Unified Modeling Language (UML)
Packages Subsystem A Subsystem B Subsystem C Subsystem D Subsystem E Jerry Gao Ph.D. 9/2001
51
The Unified Modeling Language (UML) The UML: Dynamic Modeling
Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001 Jerry Gao Ph.D. 9/2001
52
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 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. Jerry Gao Ph.D. 9/2001
53
The Unified Modeling Language (UML) The Notation of State Diagram
Event State State starting point end point State Name State Vars Activities Jerry Gao Ph.D. 9/2001
54
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
55
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
56
Dynamic Modeling Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001
57
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
58
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
59
Sequence Diagram Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001
60
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
61
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
62
Sequence Diagram Example
Print(file) :Computer :PrinterServer :Printer :Queue Print(file) [printer free] Print(file) [printer busy] Store(file)
63
Collaboration Diagram
Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001
64
Collaboration Diagram
Collaboration diagrams: - illustrate the interactions of objects. - focus on space instead of time. Applications: - may be used to show the execution of an operation - may be used to show a use-case execution - simply an interaction scenario in the system
65
Collaboration Diagram
Oper() Object name: class Oper() The Oper( ) operation call itself.
66
Sequence Diagram Example
Print(ps-file) :Computer 1:Print(ps-file) [printer free] 1.1:Print(ps-file) :PrinterServer :Printer
67
Collaboration Diagram Example
NewCustomer() [free memory] 1:Create() :Customer{new} :MainWindow {parameter} 3:Show(Customer) 2:Create() 3:Update(data) :CustomerWindow {transient}
68
Collaboration Diagram Example
2: nextjob=GetJob() 1.1 *[all queues]:len = Length(){broadcast} 1.3:invoke(job) :Queue :Elevator {parameter}job :Elevator control {local}nextjob :Order{new} 1:GetElevator(floorid) job 1.2: Create( ) Push( ) :Button
69
Activity Diagram Instructor: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001
70
Activity Diagram Activity diagrams: - focus on work performed in the implementation of an operation and activities in a use-case instance or in an object - capture actions and results in terms of object state changes. Activity diagrams are used for different purposes: - to capture the work that will be performed when an operation is executing. - to capture the internal work in an object. - to show how a set of related actions may be performed, and how they will affect objects around them. - to show an instance of a use-case may be performed in terms of actions and object state changes. - to show how a business works in terms of workers, workflows, organization, and objects.
71
Activity Diagram Example - Show a sequence of interactions
Show MessageBox “Printing” on screen Create postscript file CustomerWindow.PrinterAllCustomers() Send postscript file to printer Remove MessageBox
72
Activity Diagram Example - Show a sequence of interactions
Show MessageBox “Printing” on screen Create postscript file CustomerWindow.PrinterAllCustomers() Remove MessageBox ^Printer.Printer(file) Send-clause
73
Activity Diagram Example - Show a sequence of interactions
[disk full] Show MessageBox “Disk full” on the screen CustomerWindow.PrinterAllCustomers() [free disk space] Show MessageBox “Printing” on screen ^Printer.Printer(file) Create postscript file Remove MessageBox Send-clause
74
Activity Diagram Example - Show a sequence of interactions
Sampler.Run(channel, frequency) initiate Updating displayer Measuring Performing concurrent actions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.