Introduction to Unified Modeling Language (UML

)
By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar Jacobsen , Addison Wesley, 1999, ISBN 0-201-57168-4

The Unified Modeling Language (UML)
jUML or Unified Modeling Language comes from Rumbaugh, Booch, and Jacobson (the three amigos) who combined efforts to standardize on one modeling language jThis is primarily a graphical communication mechanism for developers and customers jWe will learn some, but not all, of the UML 
it is very complex, few understand all of it

6-2

UML jThe main purpose of UML is to  support communication about the analysis and design of the system being developed  support the movement from the problem domain in the "world" to the solution domain in the machine jtwo views of the same system ‡ one view has diagrams ‡ source code is another view 6-3 .

but everyone uses it  Like a blueprint to show what is going on during analysis.UML is a Modeling Language j UML  graphical notation to describe software design  has rules on how to draw models of jclasses jassociations between classes jmessage sends between objects  has become the de facto industry standard jNot official. design and implementation jSome Projects require UML documentation 6-4 .

Booch. Jacobson states: The UML is a language for  visualizing  specifying  constructing  documenting the artifacts of a software intensive system 6-5 .UML Defined by the Authors The Unified Modeling Language User Guide. Rumbaugh.

attributes.First up: Class Diagrams jA class diagram  expresses class definitions to be implemented  lists name. and methods for each class  shows how instances will connect to one others jUML allows different levels of detail on both the attributes and the methods of one class  could be just the the class name in a rectangle  or like the general form shown on the next slide 6-6 .

6-7 .Software Specification (Class Name) attribute attribute : type attribute : type = initial value classAttribute derivedAttribute ... method1() method2(parameter : Type) : return type abstractMethod() +publicMethod() -privateMethod() #protectedMethod() classMethod() ...

allAccounts : HashMap +AccountCollection () +getAccountWithID (ID: String) : Account +add(accountToAdd: Account) : boolean +iterator() : Iterator Note: iterator is needed by the bank manager 6-8 .AccountCollection .

both of which are written in italic <<interface>> Iterator +hasNext(): boolean +next(): Object +remove(): void 6-9 .Sterotypes jStereotype is a UML element that allows designers to extend the UML vocabulary  Often used to distinguish an abstract class name from an interface.

Different levels of detail jTips for modeling  Express as much or as little detail as needed  Often. a rectangle with a name is enough jperhaps a method or an attribute clarifies  Simple is good  Sketches on paper or white board are effective 6-10 .

Relationships jThree Relationships in UML 1) Dependency 2) Association 3) Generalization jUnderstanding these relationships is more important than the lines that UML uses 6-11 .

you need to change the dependent object  arrow points from dependent to needed objects Jukebox CardReader CDCollection SongSelector 6-12 .1) Dependency: A Uses Relationship jDependencies  occurs when one object depends on another  if you change one object's interface.

2)Association: Structural Relationship jAssociation  a relationship between classes indicates some meaningful and interesting connection  Can label associations with a hyphen connected verb phrase which reads well between concepts association Jukebox getAccountWithID 1 1 JukeboxAccountCollection 6-13 .

Associations jAssociations imply  our knowledge that a relationship must be preserved for some time (1 ms to forever) jBetween what objects do we need to remember a relationship? ‡ Does a Transaction need to remember Account? ‡ Would AccountCollection need to remember Accounts? AccountCollection Stores 1 1.* Account 6-14 ..

five or eight 6-15 .52 T one to fifty two Multiplicity adornments 5 T exactly five 3.  they are bi-directional T * "many"  can have a multiplicity 1.. * T one or more  exist in class diagrams 1.. 8 T exactly three.Notation and Multiplicity Adornments jUML Association:  a line between two concepts and a name zero or more. 5.

Multiplicity jMultiplicity defines how many instances of type A can be associated with one instance of type B at some point can differ Game 1 2. A film is associated with 0 to many actors 6-16 ..6 Player Mother 1 performs-in * 1+ Child Actor * Film can label associations Actor is associated with 0 to many films.

Depends on Context jAre all three associations possible? Car Car 1 1 4 Wheel Wheel 5 Car 1 3 Wheel 6-17 .

Association Names Upcase / hyphenate j Read this Type-VerbPhrase-Type Store 1 Contains 1. * POST Captures 1 1. data flow... instance variables. * Sale Paid-by 1 1 Payment (POST is a Point of Sale Terminal) j Not yet worrying about messages. or classes yet j Just shows which objects have associations Airline 1 Employs 6-18 .

.Aggregation: A Special Association jAggregation: whole/part relationships  An association that models HAS-A relationships  The objects can exist independently or each other  No one object is more important than the other  Place an open diamond on the whole  Could mean School has a HashMap of Students School 1.* * Student 6-19 .

Composition: A Special Association jComposition: Stronger relationship  One can not exist without the other  If the school folds.g. the school can go on AIC e. students live on jbut the departments go away also  If a department closes. use association (just a simple line) 6-20 . School 1.* * Student 1 1..* Department  Model aggregation or composition? When in doubt..

Sequence Diagrams jA class diagram shows a fixed (static) view of a system jA sequence diagram represents a dynamic view of a system by attempting to capture messages sends over time  Can document a scenario such as jUser Selects Song 6-21 .

Sequence Diagrams jObjects are lined up on top in rectangles jObject names :theJukebox jDashed lines represent lifetime of objects jRectangles are activation lines  When the object has control  Activation bar of the receivers of the message is smaller than the sender's activation bar jNot much detail written 6-22 .

http://www.uio.no/in219/verktoy/doc/html/doc/user/mg/dgmsuml6.ifi.htm l 6-23 .

html 6-24 .com/ VPGallery/diagrams/Sequence.visual-paradigm.http://www.

Sign up to vote on this title
UsefulNot useful