Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unified Modeling Language—UML A Very Brief Introduction

Similar presentations


Presentation on theme: "Unified Modeling Language—UML A Very Brief Introduction"— Presentation transcript:

1 Unified Modeling Language—UML A Very Brief Introduction
Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

2 The Unified Modeling Language—UML
UML Has Become The Standard Graphical Languages (Notation) Unfortunately, It Has Been Turned Into A Large Bin That Contains Everything UML Lets One Visualize, Construct, Document Things: Conceptual Things: Business Processes, Requirements, System Functions. Concrete Things: Classes, Database Schemas, Components Three Leading OO Gurus, Booch, Rumbaugh (OMT), And Jacobson, Joined Forces In One Company, Rational (Now IBM): Rational sells Rose, a CASE tool for UML and OOA&D Other CASE Tools: Config. Mgmt., Requirements Tools, Testing Tools Has Complete Web Information On The UML Rational Has A Well-defined, Documented Process That Uses The UML UML Now A Standard Under Control Of A Larger Community, Not Just Rational Other Methods And Processes Use The UML Too (e.g. HP's Fusion) UML Is A Good Idea—You Should Be Familiar With The Ideas Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

3 Brief Introduction to UML
UML Has Several Graphic Notations Including: Use Cases Scenarios Class Diagrams Interaction Diagrams Package Diagrams State Diagrams Activity Diagrams Object-oriented Design: Package Diagrams, Class Diagrams, Interaction Diagrams, State Diagrams Object-oriented Analysis: Use-cases Conceptual Modeling With A Class Diagram Later.... Maybe To Learn More See (Insert Course #) Web Site Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

4 UML Class Diagram Notation
Documents Types Of Objects And Their Static Relationships: Subtypes Associations Classes Represented As A Box With Three Sections: Class Name (Perhaps Other Class Characteristics, E.g. «abstract») Attributes (With Type, Visibility) Operations (With Parameters, Return Type, Visibility) Public/Protected/Private Indicated By +/#/- Signs Class Associations: Lines Drawn Between Classes Show They Have A Relationship Name Describes Relationship. (Optional If Obvious What It’s For) Multiplicity Provides “How-many” Information (Just Like Database Schemas) Purpose Is To Document Relationship That Will Not Be Present In The Source Code Straight line, no arrows Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

5 UML Class Diagram Notation
Certain Standard Types Of Relationships: Inheritance (AKA Generalization): Classes Have Superclass, Subclass Relationship Aggregation: Basically The “Part-of” Relationship. (There Are Some Subtleties. See Fowler's UML Distilled) Note: All UML Diagram Notations Allow For Notes To Be Attached To Objects Or To The Diagram As A Whole Box For Class With Sub-box for Instance Variables—Each Named Types Of Arrows/Lines: Arrow With White Triangle Pointer Shows Inheritance Arrow With White Diamond Pointer Shows Aggregation Arrow With Black Diamond Pointer Shows Composition Arrow With Line Pointer Shows Navigability Simple Line Shows Relationship (Named) Numbers Show How Many Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

6 Conceptual Model for Problem Report Tool
Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

7 Class Diagrams Class diagrams can be used for 3 perspectives of your system: Conceptual: OO analysis) Specification: Focus On Interfaces, And Classes Really Are Just Types Implementation: Full Details To Lead To Implementation—Blue-print In Design, Reuse Conceptual Model Class Diagram But Add Detail On “How” Add New Classes Required For Implementation: Recall That Conceptual Model Shows Only External Entities, Known To The User. Need More In Order To Implement This As Code. Includes Collections Of Objects, Controllers, Etc. Includes Every Class Used In Final Code, Including Libraries Etc. Code Generation From Diagrams! Class Definitions, Function Stubs, And More. See For Example, Together Tool ( Together Supports Round-trip Engineering: Cycle Between Codes And Diagrams, Without Losing Changes Made When Adding Code And Moving Back To Diagrams Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

8 Another UML Class Diagram Example
Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

9 UML Package Diagrams UML Packages Are Used To Organize Model Elements Into Groups. In A Diagram: A Box With A Tab On The Top-left. For Design, Group Classes To Make Subsystems. You Can List Classes Inside Box, With Visibility Shown (Public, Private, Protected) Packages Are Connected To Show The Import Relationship: Public Classes In Package A Are “Exported” To Packages Importing Package A A Package’s “Public Interface” Is Thus A Combination Of The Visibility Of The Classes Inside The Package, Together With The Member Visibility The Class Itself Defines For Its Members. Some Languages (Java) Have A Package-level Visibility To Allow You To Control A Package-level Interface. In C++ You Can Introduce A Public Facade Class Inside A Package To Allow Access To Otherwise Private Class Interfaces Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

10 UML Package Diagram Example
Packages contain collections of classes: “Plus” Means Class’s Public Members Can Be Used By Another Package That Imports It. The “Minus” Means Private. Imports are not transitive Client can access Policies::OrderRules, but not GUI::Window. Policies can access anything in GUI except EventHandler. Server cannot access any classes in any other package Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

11 UML Sequence Diagram UML Has Two Diagrams To Show Object Interactions:
Sequence Diagram—Similar To Message Sequence Charts Collaboration Diagram (Not Covered) Sequence Diagram Shows Trace Through Series Of Interactions In Time-line Format Used For Individual Scenarios Between Objects (Objects, Not Classes) Each Object Involved Is Shown At The Top. Time Runs Down The Page Time-line Becomes A Thin Vertical Box To Show Time-frame For An Activity Interactions Drawn Between Objects’ Time-lines, Showing: Messages Member Function Calls, Returns Creation/deletion Of An Object Can Use This Notation For Subsystems—Even For Use Cases Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

12 UML Sequence Diagram: Example
Interactions Between Objects, Not Classes! Uml Notation For An Object Is Class : Objname (Always Underlined) Thin, Vertical Box Is Focus Of Control, When Object Is Performing An Action Objects Can Be Created And Then Destroyed (Shown With An “X”) Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

13 UML State Diagrams A State Machine Notation (Based On Harel's Concept Of State Charts) More Expressive Than Older Notations (State-transition Diagrams, State Machines). For An Object Or A Larger System, The Diagram Shows Its States With: The State Name Any Activity Done While In That State Transitions: Shown As An Arrow Between States. Labeled with: event [guard condition] / action (Each part is optional.) An Event Is An Occurrence Of A Stimulus That Triggers A Transition. Guard Condition: Must Also Be True For Transition To Be Triggered. An Action (“Short”, Non-interruptible) May Happen When Transition Occurs Notation Also Supports: Grouping States Into Superstates Concurrency: Simultaneous Behavior (Important For Systems, Less Important When Modeling A Single Object’s Behavior) Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

14 UML State Diagram: Example
Order Processing System: Start Point Is Solid Dot Study Use Of event [guard] / action notation: Transitions Not Taken Unless Guard Condition Is True. Note How Guards Control Change From Checking State Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

15 Object-oriented Design
How Do We Use UML Diagrams To Do Design? Notations Combine To Provide Several Views Use UML Package Diagram To Represent High-level Components (Architecture) Then, Build On Class Diagrams From Analysis To Create Design Class Diagrams: These Serve As A Full Set Of Implementation “Blue-prints.” This Is A Static Or Structural View Of How Modules/components Are Connected. Then, Model The System And Objects Behavior Using: UML Sequence Diagram To Show Object Interactions (Scenarios). UML State Diagrams To Show An Object's (Or System's) States, Transitions, And Behavior Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)

16 Final Comments on OOD UML Class Diagrams Are Now The Standard Way For Documenting Class Structures. Advanced Notation Concepts Support: Templates, Interfaces (In Java), Abstract Classes, Etc. Sequence Diagrams Very Useful: To Model Requirements For Systems Made Up Of Cooperating Components, Protocols, Complex Event Sequences Inside A Design. Many UML Notations Give A Lot Of Leverage In Later Stages Of Development Knowing How To Draw Pictures Is Not The Same As Knowing A Good Method For Design! Unified Modeling Languages - UML A Very Brief Introduction (CS340 John Knight 2004)


Download ppt "Unified Modeling Language—UML A Very Brief Introduction"

Similar presentations


Ads by Google