Unified Modeling Language Basic Concepts UML What is
Unified Modeling Language Basic Concepts UML
What is the UML*? n n UML stands for Unified Modeling Language The UML combines the best of the best from: – Data Modeling concepts (Entity Relationship Diagrams) – Business Modeling (Work Flow) – Object Modeling – Component Modeling n n The UML is a standard language for specifying, visualizing, documenting and constructing the artifacts of a software-intensive system It can be used with all processes, throughout the development life cycle, and across different implementation technologies *Note: This presentation includes materials from Grady Booch, James Rumbaugh and Ivar Jacobson’s overviews on different aspects of UML available at http: //www. rational. com/uml/resources UML
UML Heritage General-purpose OO modeling language n – convergence of a number of popular OO methods UML 2. 0 OMT (Rumbaugh et al. ) UML 1. 4 1996 UML 0. 9 Booch Mar. 1999 UML 1. 1 Nov. 1997 OOSE (Jacobson et al. ) Catalysis UML ROOM etc.
Contributions to the UML Harel Meyer Before and after conditions Statecharts Gamma, et al Frameworks and patterns, HP Fusion Booch Operation descriptions and message numbering Booch method Embley Rumbaugh Singleton classes and high-level view OMT Jacobson Wirfs-Brock OOSE Responsibilities Shlaer - Mellor Object lifecycles UML Odell Classification
Creating the UML 2. 0 UML 1. 4 UML 1. 3 UML 1. 1 Planned major revision, 2001 (UML 2. 0) public feedback OMG Acceptance, Nov 1997 Final submission to OMG, Sep ‘ 97 First submission to OMG, Jan ´ 97 UML partners UML 0. 9 Web - June ´ 96 OOPSLA ´ 95 Other methods UML 1. 0 Unified Method 0. 8 Booch method OMT OOSE
UML Usage: Overview n The UML may be used to: – Represent the Elements of a system or a domain and their Relationships in a Static Structure using class and object diagrams – Model the Behavior of objects with state transition diagrams – Reveal the Physical Implementation Architecture with component & deployment diagrams – Display the Boundary of a System & its major Functions using use cases and actors – Illustrate Use Case Realizations with interaction diagrams UML
UML for Information Modeling n n n Provides a uniform modeling formalism and a set of (object-oriented) constructs (notation) for representing the elements of a domain of interest as well as their relationships in a Static Structural Model Use Cases can be used to model usage Example (DMTF, IETF): development of a common model to serve as an underlying information framework for the specification of a common directory schema; the common model & schema support the operation of multiple applications and systems in the enterprise UML
UML: Basic Types of Concepts n UML Modeling elements n Relationships n Diagrams
Basic Modeling Elements n Structural elements – type, class, instance, collaboration, use case, component, node n Behavioral elements – interaction, state machine n Grouping elements – package, subsystem UML
Classes and Instances n Specifications for one or more distinct objects with a common form (structure and behavior) instance class phone 1: Telephone busy = true Telephone busy : boolean off. Hook() on. Hook () ring() UML off. Hook() on. Hook () ring() phone 2: Telephone busy = false off. Hook() on. Hook () ring()
Attributes n n The data/static structure aspect of a class is represented by its attributes Attributes may be found by examining class definitions, the problem requirements, and by applying domain knowledge Each course offering has a number, location and time UML Course. Offering number location time
Operations n n The behavior of a class is represented by its operations Operations may be found by examining interaction diagrams registration form registration manager Registration. Manager add. Course(joe, math 01) UML add. Course(Student, Course)
Relationships n Relationships provide a pathway for communication between objects n Sequence and/or collaboration diagrams are examined to determine what links between objects need to exist to accomplish the behavior -- if two objects need to “talk” there must be a link between them UML Copyright © 1997 by Rational Software Corporation
Basic Relationship Types n n n Association Dependency Aggregation Generalization Realization UML
Relationships: Defined n An association is a bi-directional connection between classes – An association is shown as a line connecting the related classes n An aggregation is a stronger form of relationship where the relationship is between a whole and its parts – An aggregation is shown as a line connecting the related classes with a diamond next to the class representing the whole n A dependency relationship is a weaker form of relationship showing a relationship between a client and a supplier where the client does not have semantic knowledge of the supplier. – A dependency is shown as a dashed line pointing from the client to the supplier UML Copyright © 1997 by Rational Software Corporation
Generalization (Inheritance) n A generalization is a relationship between a more general and a more specific element – Inheritance is the main property of generalizationspecialization relationships defined between a superclass and its subclasses – Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy n Realization is a relationship defined between a type and its implementation classes UML Copyright © 1997 by Rational Software Corporation
Relationships: Notation n n Association Dependency Client Aggregation Part Generalization Superclass Realization UML type name Supplier Aggregate Subclass Implementation class
Models and Diagrams A model is a complete description of a system from a particular perspective Use Case Diagrams Sequence Diagrams Scenario Diagrams Collaboration Diagrams Scenario Diagrams Statechart Diagrams UML Use Case Diagrams State Diagrams Class Diagrams Models State Diagrams Object Diagrams State Diagrams Component Diagrams Deployment Diagrams Activity Diagrams
Why Build Models? n To understand the problem better n To communicate with stakeholders n To find errors or omissions n To plan out the design n To generate code UML
UML Model Views n n Requirements (use case diagrams) Static structure (class diagrams) – kinds of objects and their relationships n Dynamic behavior (state machines) – possible life histories of an object n Interactive behavior (activity, sequence, and collaboration diagrams) – flow of control among objects to achieve systemlevel behavior n Physical implementation structures (component and deployment diagrams) UML – software modules and deployment on physical nodes
Diagrams n A diagram is a view into a model – Presented from the aspect of a particular stakeholder – Provides a partial representation of the system – Is semantically consistent with other views n In the UML, there are nine standard diagrams – Static views: use case, class, object, component, deployment – Dynamic views: sequence, collaboration, statechart, activity UML
Use Case Diagram n Captures system functionality as seen by users UML
Use Case Diagram n n n Captures system functionality as seen by users Built in early stages of development Purpose – – n Specify the context of a system Capture the requirements of a system Validate a system’s architecture Drive implementation and generate test cases Developed by analysts and domain experts UML
Class Diagram n UML Captures the vocabulary of a system
Class Diagram n n n Captures the vocabulary of a system Built and refined throughout development Purpose – Name and model concepts in the system – Specify collaborations – Specify logical database schemas n Developed by analysts, designers, and implementers UML
Class Diagram: Example n Shows the entities in a system and their general relationships Person client 0. . * creditor 0. . * Financial Institution owner 0. . * generalization association Bank residence 0. . * House UML Trust Company
Object Diagram n Captures instances and links UML
Object Diagram n n n Shows instances and links Built during analysis and design Purpose – Illustrate data/object structures – Specify snapshots n Developed by analysts, designers, and implementers UML
Component Diagram n Captures the physical structure of the implementation UML
Component Diagram n n n Captures the physical structure of the implementation Built as part of architectural specification Purpose – Organize source code – Construct an executable release – Specify a physical database n Developed by architects and programmers UML
Deployment Diagram n Captures the topology of a system’s hardware UML
Deployment Diagram n n n Captures the topology of a system’s hardware Built as part of architectural specification Purpose – Specify the distribution of components – Identify performance bottlenecks n Developed by architects, networking engineers, and system engineers UML
Sequence Diagram n Captures dynamic behavior (time-oriented) UML
Sequence Diagram n n Captures dynamic behavior (time-oriented) Purpose – Model flow of control – Illustrate typical scenarios UML
Sequence Diagram: Example n Assertions of legal interactions between objects (e. g. , operator-assisted call) Caller Operator Callee sequence diagram call ack number call ack transfer talk time UML
Collaboration Diagram n Captures dynamic behavior (message-oriented) UML
Collaboration Diagram n n Captures dynamic behavior (message-oriented) Purpose – Model flow of control – Illustrate coordination of object structure and control UML
Collaboration Diagram: Example n A collaboration diagram displays object interactions organized around objects and their links to one another course form : Course. Form 1: set course info 2: process 3: add course : Registrar the. Manager : Curriculum. Manager a. Course : Course 4: new course UML
Statechart Diagram n Captures dynamic behavior (event-oriented) UML
Statechart Diagram n n Captures dynamic behavior (event-oriented) Purpose – Model object lifecycle – Model reactive objects (user interfaces, devices, etc. ) UML
Activity Diagram n Captures dynamic behavior (activity-oriented) UML
Summary: the UML n An industry standard for analysis and design of object-oriented systems – based on extensive experience and best practices – gaining rapid acceptance (training, tools, books) n Comprises: – set of modeling concepts – graphical notation n Concepts are organized into diagram types – class, state machine, collaboration, use case, sequence, activity, component, deployment The UML can be used in many different domains to capture domain-specific concepts and ideas UML n
References n Grady Booch, James Rumbaugh, Ivar Jacobson, The Unified Modeling Language User Guide, Addison-Wesley, 1999. n UML documentation - http: //www. rational. com/uml/resources n “UML in Action, ” Communications of the ACM, October 1999, V. 42, N. 10 n Whitepapers: – (1) "Why Use the UML? " by Martin Fowler – (2) "How the UML Models Fit Together, " by Scot Ambler – (3) "UML Applied: Nine Tips to Incorporating UML into Your Project" by D. Rosenberg – (1) , (2) and (3) are available at http: //www. sdmagazine. com/uml (Focus on UML). – There are several whitepapers on UML available at “The UML Home” http: //www. rational. com/uml/resources/whitepapers - UML
- Slides: 43