Professional Documents
Culture Documents
1
UNIT I
UNIFIED Introduction to OOAD with OO Basics
PROCESS AND
Unified Process
USE CASE
DIAGRAMS UML diagrams
Use Case
CO 1
Case study– the Next Gen POS system
K3
SESSION OUTCOME
4
Class Diagram
Attributes
Operations
5
Class Diagram
Person
Attributes
Operations
6
Class Diagram
• An attribute is a named property of a class that describes the object being
modeled.
• In the class diagram, attributes appear in the second compartment just
below the name-compartment.
• Attributes are usually listed in the form:
Operations
7
Class Diagram
Person
name : String
/age : Date
Operations
8
Class Diagram
Operations
9
Class Diagram
Person
name : String
/age : Date
Work()
Play()
10
Class Diagram
Operations / methods Rectangle
- width : int
• visibility name (parameters) : return_type - height : int
• visibility: + public
/area : double
# protected +Rectangle(width: int, height: int)
- private +distance(r,Rectangle): double
~ package (default)
• underline static methods Student
• parameter types listed as (name: type)
• omit return_type on constructors and -name : String
when return type is void
- Id : int
• method example: #getID():int
+ distance(p1: Point, p2: Point): double +getName():String
~getEmailAddress():String
+getTotalStudents():int 11
Class Diagram
The Relationship between Classes and Objects
• A class is an abstract definition of an object
• It defines the structure and behavior of each object in the
class
• It serves as a template for creating objects.
12
Class Diagram
Relationships in Classes Diagram
• In UML, object interconnections (logical or physical), are
modeled as relationships.
• Associations
• Dependencies
• Generalizations
13
Class Diagram
Association Relationship
• Association indicates a loose relationship between two objects,
which may interact with each other for some time.
Student Instructor
14
Class Diagram
Association Relationship (Contd..)
• We can indicate the multiplicity of an association by adding
multiplicity adornments to the line denoting the association.
1..*
Student Instructor
15
Class Diagram
Association Relationship (Contd..)
• The example indicates that every Instructor has one or more
Students.
1..*
Student Instructor
16
Class Diagram
Association Relationship (Contd..)
• We can also name the association
membership
Student Team
1..* 1..*
• We can specify dual associations.
member of
1..* 1..*
Student Team
president of
1 1..*
17
Class Diagram
Association Relationship (Contd..)
• We can constrain the association relationship by defining the
navigability of the association.
Router DomainNameServer
18
Class Diagram
Association Relationship (Contd..)
• Associations can also be objects themselves, called link classes or
an association classes.
Registration
modelNumber
serialNumber
warrentyCode
Product Warranty
19
Class Diagram
Association Relationship (Contd..)
• A class can have a self association.
next
LinkedListNode
previous
20
Class Diagram
Dependency Relationships
A dependency indicates a semantic relationship between two or
more elements.
The dependency from CourseSchedule to Course exists because Course is
used in both the add and remove operations of CourseSchedule.
CourseSchedule
Course
add(c : Course)
remove(c : Course)
21
Class Diagram
Aggregations
An aggregation specifies a whole-part relationship between an
aggregate (a whole) and a constituent part, where the part can
exist independently from the aggregate.
22
Class Diagram
Composition
A composition indicates a strong ownership and coincident
lifetime of parts by the whole (i.e., they live and die as a whole).
Compositions are denoted by a filled-diamond adornment on the
association.
Scrollbar
1 1
Window Titlebar
1 1
Menu
1 1 .. *
23
Class Diagram
Generalization Relationships
Person
A generalization connects a
subclass to its superclass.
It denotes an inheritance of
attributes and behavior from
Student
the superclass to the subclass
and indicates a specialization
in the subclass of the more
general superclass.
24
Class Diagram
Generalization Relationships
TeachingAssistant
25
Class Diagram
Multiplicity
Customer Simple
1
Class Aggregation
Composition Simple
Generalization Association
Checkout Screen
DVD Movie VHS Movie Video Game
26
Class Diagram
30