UML CLASS DIAGRAMS
1 of 40
UML CLASS DIAGRAMS
Featured
BR_Critical Literature Review
leadership
Sample Documentary Credit Received By Global Bank New Delhi
Nitrogen cycle 2
Tapping into global market
8.PERFORMANCE COUNSELLING
Miccai05
Early Humans and the Prehistoric Record Human Plant Interaction
Listening In to Find and Explore New Combinations of customer needs
Motion in One Dimension
degrees of monomials
Summary Restructuring the Postwar World
Slavery the South
Macroeconomy of Late Meiji 1890s 1900s Trade, Budget and Finance, Saving Mobilization
Computer Architecture - Memory Hierarchy Revisited
Fast Marching Method To Correct For Refraction In Ultrasound Computed Tomography
Introduction To Cell Biology
Contourmotion
seven times
Product Portfolio Models
UML CLASS DIAGRAMS - Transcript
CLASS CLASS DIAGRAMS
JAGADISH JOHN
WHY WHAT WHEN HOW
UML Class Diagrams 2
WHY
Clarity in understanding the system requirements Better communication Model driven architecture Designing data base Code generation Reverse engineering Helps to develop a good software
UML Class Diagrams 3
WHAT
A pictorial graphical representation of Names Properties Actions Relationships
UML Class Diagrams
4
WHEN
In a software development life cycle model We have REQUIREMENTS UML DESIGN IMPLEMENTATION TESTING
UML Class Diagrams 5
HOW
UML Class Diagrams
6
Agenda
What is a Class Diagram Essential Elements of a UML Class Diagram Tips Development of class diagram from a use case diagram
UML Class Diagrams 7
What is a Class Diagram
A class diagram describes the types of classes in the system and the various kinds of static relationships that exist among them A central modeling technique that runs through nearly all object oriented methods The richest notation in UML
UML Class Diagrams 8
Essential Elements of a UML Class Diagram
Class Attributes Operations Relationships
Constraint Rules and Notes
UML Class Diagrams 9
Associations Generalization Dependency Realization
Classes
A class is the description of a set of objects having similar attributes operations relationships and behavior
Class Name Attributes Operations
Person
name string height Integer talk walk
UML Class Diagrams
10
Associations
A semantic relationship between two or more classes that specifies connections among their instances A structural relationship specifying that objects of one class are connected to objects of a second possibly the same class Example An Employee works for a Company
Employee Department Company
UML Class Diagrams
11
Associations cont
Role name instructor 1 Association name instructs
Staff Member
Student
Multiplicity
UML Class Diagrams
12
Multiplicity
Associations cont
The number of instances of the class next to which the multiplicity expression appears that are referenced by a single instance of the class that is at the other end of the association path It indicates how many objects of one class relate to one object of another class Provides a lower and upper bound on the number of instances
UML Class Diagrams 13
Code replacement of Association
UML Class Diagrams
14
Associations cont
Multiplicity Indicators
Exactly one Zero or more unlimited One or more Zero or one optional association Specified range Multiple disjoint ranges 1 0 1 0 1 2 4 2 4 6 8
UML Class Diagrams
15
Visibility
Private members can only be referenced in the same class where they are declared Protected members can be referenced in the same class or any descendants of that class Package scope members can be referenced by any classes in the same UML package only Public members can be referenced directly by any class in the same or other package
UML Class Diagrams
16
SHOWING VISIBILITY
class name attribute1 attribute2 operation1 operation2
UML Class Diagrams
17
Aggregation
A special form of association that models a whole part relationship between an aggregate the whole and its parts
Models a is a part part of relationship
Car 2
Door Part
1
House
Whole
UML Class Diagrams
18
Aggregation cont
In an aggregation the part classes can exist without the whole When the part classes are destroyed the whole class will continue to exist When the whole class is destroyed the part classes will still exist Aggregation tests Is the phrase part of used to describe the relationship A door is part of a car Are some operations on the whole automatically applied to its parts Move the car move the door Are some attribute values propagated from the whole to all or some of its parts The car is blue therefore the door is blue
UML Class Diagrams
19
A strong form of aggregation
Composition
The part classes used to make up the whole class cannot exist on their own Multiplicity on the whole side must be zero or one The life time of the part is dependent upon the whole The destruction of the whole class means destruction of the part classes
Table Query
0 1
1
Database
1
Circle
Point
UML Class Diagrams
20
Generalization
Indicates that objects of the specialized class subclass are substitutable for objects of the generalized class super class
is kind of relationship
An abstract class Generalization relationship Circle Shape
abstract
Super Class
Sub Class
UML Class Diagrams
21
Generalization
A sub class inherits from its super class
Attributes Operations Relationships
A sub class may
Add attributes and operations Add relationships Refine override inherited operations
UML Class Diagrams 22
Code replacement of Generalization
UML Class Diagrams
23
Dependency
A dependency indicates a semantic relation between two or more classes in which a change in one may force changes in the other although there is no explicit association between them
Course schedule Course add c Course void remove c Course void
UML Class Diagrams
24
Code replacement of Dependency
UML Class Diagrams
25
Realization
A realization relationship indicates that one class implements a behavior specified by another class an interface or protocol An interface can be realized by many classes A class may realize many interfaces
class
interface
UML Class Diagrams
26
Code replacement of Realization
UML Class Diagrams
27
Constraint Rules and Notes
Constraints and notes annotate among other things associations attributes operations and classes
UML offers many pre defined constraints
Customer
1 total 50 may be canceled
Order
id long value 0
Constraint
Note
UML Class Diagrams
28
Tips
Don t try to use all the various notations Don t draw models for everything concentrate on the key areas Draw implementation models only when illustrating a particular implementation technique
UML Class Diagrams
29
LET S SEE A CASE STUDY
UML Class Diagrams 30
A typical use case diagram
distribute electronically
include
record grades teacher
include
save grades
update grades
include
logon
include
load grades
view grades generate report cards administrator student
UML Class Diagrams
31
Learn how to model a class diagram
Finding classes and their associations Finding attributes and operations First identify all the nouns
here we have Grades and ReportCard
Second identify all the actors
here we have teacher student and administrator
UML Class Diagrams
32
Now we have to create a home for the use cases
Distribute Report Cards Grade Class Record Grades Grade Class Update Grades Grade Class Save Grades Grade Class Load Grades Grade Class Logon View Grades Grade Class Generate Report Cards Report Card Class
UML Class Diagrams
33
Now relationships
A Teacher distributes the Grades A Teacher records the Grades A Teacher updates the Grades A Grade will save itself A Grade will load itself A Teacher views Grades An Administrator views Grades An Administrator generates Report Cards A Student views Grades
UML Class Diagrams 34
After consolidation
A Teacher maintains Grades A Teacher views Grades An Administrator views Grades An Administrator generates Report Cards A Student views Grades
UML Class Diagrams
35
maintains
contains
Teacher
Grades
displays
ReportCard
WebSite
uses
generates
Student
uses
Logon
uses
Administrator
UML Class Diagrams
36
Now multiplicity
maintains contains
Teacher 1 1
Grades 1 1
ReportCard 1
generates
displays
1 OnlineUser
uses
WebSite
Administrator
UML Class Diagrams
37
Grades
maintains
Teacher 1
RecordGrades 1 UpdateGrades Distribute SaveGrades LoadGrades
displays
ReportCard 1 1 Generate
generates
1
1 Administrator
OnlineUser
uses
WebSite Logon View
UML Class Diagrams
38
Grades
maintains RecordGrades Student String Assignment String Grade Integer contains
Teacher
1 1 UpdateGrades Student String Assignment String Grade Integer 1 1
Distribute SaveGrades LoadGrades
ReportCard
Generate
1
generates displays
uses
WebSite
UserName String Password String Logon View
1 Administrator
OnlineUser
UML Class Diagrams
39
THANK YOU
UML Class Diagrams
40












