uml: unified modeling language l. grewe history graphic modeling language for describing...

19
UML: Unified UML: Unified Modeling Language Modeling Language L. Grewe L. Grewe

Post on 21-Dec-2015

229 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML: Unified Modeling UML: Unified Modeling Language Language

L. GreweL. Grewe

Page 2: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

HistoryHistory

Graphic modeling language for Graphic modeling language for describing object-oriented softwaredescribing object-oriented software

Started in 1994Started in 1994• Combined notations from 3 leading OO Combined notations from 3 leading OO

methodsmethods OMTOMT (James Rumbaugh)(James Rumbaugh) OOSEOOSE (Ivar Jacobson)(Ivar Jacobson) BoochBooch (Grady Booch) (Grady Booch)

Industry standard Industry standard

Page 3: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Why UML?Why UML?

Software larger & complexSoftware larger & complex• Difficult to analyzeDifficult to analyze

Describe SW clearlyDescribe SW clearly

Use Computer-aided software Use Computer-aided software engineering (CASE) toolsengineering (CASE) tools• A picture is worth a thousand A picture is worth a thousand

words…..save time looking at and words…..save time looking at and making visuals.making visuals.

Page 4: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

What is UML?What is UML?

Specify & Visualize Software via Specify & Visualize Software via modeling languagemodeling language• viewsviews• diagramsdiagrams• relationships between classesrelationships between classes

Page 5: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML ConceptsUML Concepts

Use case diagrams/studiesUse case diagrams/studies Class DiagramsClass Diagrams Instance SnapshotsInstance Snapshots Sequence DiagramsSequence Diagrams …….more (for complete understanding .more (for complete understanding

of UML take our SW Engineering of UML take our SW Engineering course)course)

Page 6: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML Concepts….moreUML Concepts….more

Use CaseDiagramsUse Case

DiagramsUse CaseDiagrams

ScenarioDiagramsScenario

DiagramsCollaborationDiagrams

StateDiagramsState

DiagramsComponentDiagrams

ComponentDiagramsComponent

DiagramsDeploymentDiagrams

StateDiagramsState

DiagramsObjectDiagrams

ScenarioDiagramsScenario

DiagramsStatechartDiagrams

Use CaseDiagramsUse Case

DiagramsSequenceDiagrams

StateDiagramsState

DiagramsClassDiagrams

ActivityDiagrams

Models

Page 7: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML: Use case studyUML: Use case study

Use Case Studies to understand system Use Case Studies to understand system and the stakeholders & requirements.and the stakeholders & requirements.

Uses concept of Actors:Uses concept of Actors:• Often serves some kind of role in the SW Often serves some kind of role in the SW

system. (e.g. customer, vendor, etc.)system. (e.g. customer, vendor, etc.)• Define State & Operations for each ActorDefine State & Operations for each Actor• Define Relationships between Actors Define Relationships between Actors

Page 8: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Use Case DiagramUse Case Diagram

Shows actors, entities and actions Shows actors, entities and actions involved in one usage scenarioinvolved in one usage scenario

Have a diagram and often Have a diagram and often corresponding descriptioncorresponding description

Can (often) have more than one for a Can (often) have more than one for a software programsoftware program

Page 9: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Example: Use Case DiagramExample: Use Case Diagram

use case:use case: buy_thing buy_thing participants:participants: (Purchaser, Vendor, Thing) (Purchaser, Vendor, Thing)

pre-condition:pre-condition:vendor.possessions -> includes thing vendor.possessions -> includes thing purchaser.pocket >= thing.price purchaser.pocket >= thing.price

post-condition:post-condition: vendor.possessions = vendor.possessions - thing vendor.possessions = vendor.possessions - thing purchaser.possessions = purchaser.possessions + thing purchaser.possessions = purchaser.possessions + thing vendor.till = vendor.till@pre + thing.price vendor.till = vendor.till@pre + thing.price purchaser.pocket = purchaser.pocket@pre - thing.pricepurchaser.pocket = purchaser.pocket@pre - thing.price

Page 10: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML: Class DiagramsUML: Class Diagrams

Classes are Graphically Represented Classes are Graphically Represented with areas forwith areas for• Class Name, Class Variables, and Class Name, Class Variables, and

OperationsOperations• Properties, Responsibilities, Rules, Properties, Responsibilities, Rules,

Modification History, etc.Modification History, etc.

Page 11: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Example: Class DiagramExample: Class Diagram

BookTitle class BookTitle class

BookTitle InstanceBookTitle Instance

Page 12: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Another Example: Class DiagramsAnother Example: Class Diagrams

Here show class diagrams Here show class diagrams and associations between and associations between the classes.the classes.• Associations Associations

(diamonds/arrows) show (diamonds/arrows) show aggregations/ aggregations/ compositionscompositions

• See class webiste and See class webiste and reading for more details.reading for more details.

Classes: Company, Classes: Company, Department, Office, Department, Office, Headquarters, Person, Headquarters, Person, ContractInformation, ContractInformation, PersonalRecordPersonalRecord

Page 13: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Class Diagrams: relationships Class Diagrams: relationships Between ClassesBetween Classes

AssociationAssociation• Permanent, structural, “has a”Permanent, structural, “has a”• Solid line (arrowhead optional)Solid line (arrowhead optional)

DependencyDependency• Temporary, “uses a”Temporary, “uses a”• Dotted line with arrowheadDotted line with arrowhead

GeneralizationGeneralization• Inheritance, “is a”Inheritance, “is a”• Solid line with open (triangular) arrowheadSolid line with open (triangular) arrowhead

ImplementationImplementation• Dotted line with open (triangular) arrowheadDotted line with open (triangular) arrowhead

OR

Page 14: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Associations w/ Navigation Associations w/ Navigation InformationInformation

Can indicate direction of relationshipCan indicate direction of relationship Represented by solid line with Represented by solid line with

arrowheadarrowhead

Gas Pedal class knows about Engine class Engine class doesn’t know about Gas Pedal class

Page 15: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Cardinality of AssociationsCardinality of Associations

Some relationships may be quantifiedSome relationships may be quantified Cardinality denotes how many objects Cardinality denotes how many objects

the source object can legitimately the source object can legitimately referencereference

ExamplesExamples• ** 0, 1, or more 0, 1, or more• 55 5 exactly 5 exactly• 5..85..8 between 5 and 8, inclusive between 5 and 8, inclusive• 5..*5..* 5 or more 5 or more

Page 16: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

Example: cardinalityExample: cardinality

Says : Bank to Branch is a 1 to many Says : Bank to Branch is a 1 to many association….means a Bank can have many association….means a Bank can have many Branches, but, a Branch is associated with Branches, but, a Branch is associated with one Bank.one Bank.

Page 17: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML Instance SnapshotUML Instance Snapshot

Diagram that shows results of applying a Diagram that shows results of applying a use-case action. use-case action.

Page 18: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

UML Use Case Sequence DiagramUML Use Case Sequence Diagram

Scenario shows the Scenario shows the sequence of events sequence of events in a use-case.in a use-case.

Here the use-case Here the use-case is ian applying for a is ian applying for a job, where tony is job, where tony is the secretary and the secretary and sue is the sue is the manager.manager.

Page 19: UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing

GeneralizationGeneralization

Denotes Denotes inheritanceinheritance between classes between classes Can view as “Can view as “is-ais-a” relationship” relationship Represented by line ending in (open) Represented by line ending in (open)

triangletriangle

Laptop, Desktop, PDA inherit state & behavior from Computers