You are on page 1of 30

CS 8592 - OBJECT-ORIENTED

ANALYSIS AND DESIGN

DEPARTMENT OF INFORMATION TECHNOLOGY


REGULATION 2017
SEMESTER: 6

S CLOUDIN, ASSOCIATE PROFESSOR – IT


KCG COLLEGE OF TECHNOLOGY

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

Develop UML Inception


Use case
diagrams for a Use case Modelling
given scenario
Relating Use cases –include, extend
and generalization
K3 When to use Use-cases
UNIT II
STATIC UML Class Diagram
Domain model refinement
DIAGRAMS Elaboration
Finding conceptual class Hierarchies
Domain Model
Aggregation and Composition
Finding conceptual classes and
CO 2 description classes Relationship between sequence
diagrams and use cases
Associations
Develop UML
When to use Class Diagrams
static diagram Attributes
like class
diagram for a
given scenario

K3
SESSION OUTCOME

Students will be able to

• Develop Class Diagram for a given


scenario

4
Class Diagram

• A class is a description of a set of objects that share the same


attributes, operations, relationships, and semantics.

• Graphically, a class is rendered as a rectangle, usually including its


name, attributes, and operations in separate, designated
compartments.
ClassName

Attributes

Operations
5
Class Diagram

• The Class Name is the only required tag in the graphical


representation of a class.

• It always appears in the top-most compartment.

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:

attributeName : Type Person


name : String
address : Address

Operations
7
Class Diagram

• A derived attribute is one that can be computed from other


attributes, but doesn’t actually exist.

• For example, a Person’s age can be computed from his birth


date. A derived attribute is designated by a preceding ‘/’ as in:

Person
name : String
/age : Date

Operations
8
Class Diagram

Attributes can be:


• + public Person
• # protected +name : String
#address : Address
• - private #birthdate: Date
• / derived /age : Date
-ssn : Id

Operations

9
Class Diagram

• Operations / Methods describe the class behavior and appear in


the third compartment.

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.

• There are three kinds of relationships in UML

• 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.

• They are not dependent on each other—if one object is


destroyed, the other can continue to exist, and there can be any
number of each item in the relationship.

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.

• The example indicates that a Student has one or more


Instructors:

1..*
Student Instructor

15
Class Diagram
Association Relationship (Contd..)
• The example indicates that every Instructor has one or more
Students.
1..*
Student Instructor

• We can also indicate the behavior of an object in an association


(i.e., the role of an object) using rolenames.
teaches learns from
Student Instructor
1..* 1..*

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.

• Here, a Router object requests services from a DNS object by sending


messages to (invoking the operations of) the server. The direction of the
association indicates that the server has no knowledge of the Router.

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.

Aggregations are denoted by a hollow-diamond adornment on the


association.
Engine
Car
Transmission System

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

UML permits a class to inherit from multiple superclasses,


although some programming languages (e.g., Java) do not
permit multiple inheritance.
Student Employee

TeachingAssistant
25
Class Diagram

Multiplicity

Customer Simple
1
Class Aggregation

Abstract Rental Invoice


Class

Rental Item 1..*


1 0..1

Composition Simple
Generalization Association

Checkout Screen
DVD Movie VHS Movie Video Game

26
Class Diagram

Software Design (UML)


Class Diagram

Software Design (UML)


Class Diagram
SUMMARY

Class Diagrams and Relationships

30

You might also like