270 likes | 400 Views
(Reference: Jason Roff – UML Beginner’s Guide). UML for Domain Models. Box Top section is class name Second section is class attributes (data members) Third section is class member functions Notation + public access - private access # protected access. Classes.
E N D
(Reference: Jason Roff – UML Beginner’s Guide) UML for Domain Models
Box • Top section is class name • Second section is class attributes (data members) • Third section is class member functions • Notation • + public access • - private access • # protected access Classes
A UML Class Diagram for Course Course -enrollmentLimit -nEnrolledStudents -startTime -endTime -instructor +getInstructor() +getStartTime() +getDuration()
Attribute Format -enrollmentLimit:Integer = 20 -nEnrolledStudents: Integer=0 -startTime: Date -endTime: Date -instructor: String -meetingDays[1..7]: Integer -/meetingHoursWeek:float
Show relationships with line and association name. Class Relationships teaches > Professor Course takes > Student
Multiplicity teaches > Professor Course 1 1..* Professors teach 1 or more courses. Courses have exactly one professor.
Roles teaches > Instructor Professor Course 1 1..* 0..* Teaching Assistant Graduate Student grades > 0..*
Objects are differentiated from class with an underline and a class name qualifier Class Instances (OBJECTS) Course:Cs350 -enrollmentLimit = 20 -nEnrolledStudents = 24 -startTime : 14:00 -endTime: 14:50 -instructor: Ribler
Empty arrow points to base class (superclass) from derived class (subclass) Inheritance (Empty Arrow) Person Student Tutor Professor Teaching Assistant
Composition and Aggregation Car Class List Class Engine Class Sprite Class Composition is expressed with a filled diamond. Aggregation is expressed with a unfilled diamond.
Model workflows for use-cases (analysis) Model object behavior (design) Activity Diagrams
Symbols Start Symbol End Symbol Activity Symbol (contains action name) Name of Action Decision Points
GuArds With Decision Point [new file] [file already exists] Create File Update File
Guard without Decision Point Record Data [new file] [file already exists] Create File Update File
Indicators that an action has taken place Events and Triggers Print File Print(File, Printer) SaveAs(Filename) Ready Save File CreateNew(Filename) Create New File
Show concurrency Forks Login Load Grades Load Classes
JOins Load Grades Load Classes Display Data
Swim Lanes POS System Telephone Operator Database Wrapper Purchase() Display Error Display Error Determine Type Load Inventory Store Inventory Change Inventory [failure] [failure]
Model interaction between active objects • Consist of two components • Active objects • Interactions between active objects Sequence DIagrams SpaceShip Shoot
“LiFElines” Indicate Active Objects SpaceShip UFO Shoot X X indicates the end of the objects life.
Conditions Can be Placed on Messages Indicate Active Objects SpaceShip UFO [UFO in Range] Issue Warning
Synchronous – Flow is suspended until return from the call. (filled arrow head) Return – Synchronous message is no longer blocked. Asynchronous – Non-blocking message. Sender doesn’t wait for reply. Flat – synchronization is unspecidfied. Message Arrows
Creating and Destroying Objects SpaceShip Missile <<create>> <<destroys>> X
Sequence Diagrams use Rounded Rectangles to indicate State SpaceShip UFO [UFO in Range] Issue Warning Under Threat Surrender Taken Prisoner Imprisoned
Branching SpaceShip UFO Asteroid [at peace] shoot [in alien war] shoot
Users can be drawn As Stick Figures ATM Login Logged in Prompt for transaction type