OOSD Module 2
OOSD Module 2
CSE431
Dr. Bramah Hazela
1
Name of Institution
Module II
Systems modelling using the object oriented
approach and UML
2
Descriptors/Topics Name of Institution
4
Objectives Name of Institution
5
What is a Domain Model?
Name of Institution
6
What’s the Difference? Name of Institution
Conceptual Class:
Software Artifacts:
Sale SalesDatabase
amt
Sale
item
Double amt;
Item item;
void print()
7
Business Object Model Name of Institution
8
Domain Model, visually Name of Institution
9
Conceptual Classes Name of Institution
10
How to Create a Domain ModelName of Institution
12
Noun Phrase Identification Name of Institution
15
POS example Name of Institution
You can create a list, or you can use a set of class diagrams, per the table
below
Sales
Cashier Customer Manager
LineItem
Product Product
Payment
Catalog Specification
16
Classes Name of Institution
attributes
operations
Class Attributes Name of Institution
Person
Person
Person
name : String
address : Address
birthdate : Date
ssn : Id
PhoneBook
You can specify an operation by stating its signature: listing the name, type, and
default value of all parameters, and, in the case of functions, a return type.
Depicting Classes Name of Institution
When drawing a class, you needn’t show attributes and operation in every
diagram.
Person Person
Person
name : String
birthdate : Date
Person ssn : Id
SmokeAlarm
Responsibilities
Class Behavior
BillDetailAcceptor ValidateBillDetail()
Clerk EnterBillDetail
Product
TotalAmountCalculator calculateTotalAmount()
BillPrinter PrintBill()
Bill addProductDetail(),editProductDetail()
,deleteProductDetail()
How to Identify Attributes Name of Institution
Class Attributes
BillDetailAcceptor
Clerk clerkCode,clerkName
BillPrinter
• Dependencies
• Associations
• Aggregation
• Composition
• Generalization
Dependency Relationships Name of Institution
CourseSchedule
Course
add(c : Course)
remove(c : Course)
Generalization Relationships
Name of Institution
Person
A generalization connects a subclass
to its superclass. It denotes an
inheritance of attributes and behavior
from the superclass to the subclass and
indicates a specialization in the subclass
of the more general superclass.
Student
Generalization Relationships (Cont’d)
Name of Institution
Student Employee
TeachingAssistant
Association Relationships Name of Institution
If two classes in a model need to communicate with each other, there must be
link between them.
Student Instructor
Association Relationships (Cont’d) Name of Institution
Student Instructor
1..*
Association Relationships (Cont’d)
Name of Institution
The example indicates that every Instructor has one or more Students:
Student Instructor
1..*
Association Relationships (Cont’d)
Name of Institution
We can also indicate the behavior of an object in an association (i.e., the role
of an object) using rolenames.
membership
Student Team
1..* 1..*
Association Relationships (Cont’d)
Name of Institution
member of
1..* 1..*
Student Team
1 president of 1..*
Association Relationships (Cont’d)Name of Institution
Router DomainNameServer
Association Relationships (Cont’d)Name of Institution
Registration
modelNumber
serialNumber
warrentyCode
Product Warranty
Association Relationships (Cont’d)
Name of Institution
nex
t
LinkedListNode
previous
Association Relationships (Cont’d)
Name of Institution
Engine
Car
Transmission
Association Relationships (Cont’d)Name of Institution
Scrollbar
1 1
Window Titlebar
1 1
Menu
1 1 .. *
Description Classes Name of Institution
44
Conceptual Data Model Name of Institution
45
Conceptual Data Model Elements Name of Institution
• Business Models
Business Use Case Models
Business Analysis Models
• Requirements and Analysis Model
• System USE-Case Model
• Analysis Model
46
Principles Name of Institution
47
Languages Name of Institution
48
Languages Name of Institution
• MERISE
– Object with occurrences
– Relation
– Propertiy
ENROLL
STUDENT SUBJECT
-Name
-Name
-Address IS GIVEN
TEXTBOOK
49
Languages Name of Institution
50
Languages Name of Institution
• Class Diagram
– Class with instances
– Association
– Property
STUDENT
+enrolls +is enrolled SUBJECT
+Name
+FamilyName +SubName
+Address * *
51
Conceptual Model Name of Institution
• Goals
– Starting from the dictionary and the rules this model tries to
reveal the relations among the data and their interaction
• Example – School
Rules Dictionary
1. Every class has a one and only Student’s Address,
one room. Subject,
2. Every subject is teaches by only Number of Hours,
one teacher. Class Name,
3. Every class is taught a subject a Student's Family Name,
fixed number of hours. Teacher‘s Name,
4. Every student can have no more Mark,
one mark in every subject. Room Number,
5. The school manages the Student’s Name
timetable and the rating of
students and teachers..
52
Concepts Name of Institution
53
Defining an Entity ClassName of Institution
54
Association Name of Institution
55
Examples Name of Institution
56
Identifier of an Association
Name of Institution
57
Cardinalities of an Association
Name of Institution
• Cardinalities One to
One
– 0..1 – 0..1 – Every
student can use one
locker
– 0..1 – 1
– 1 – 1 Every student
uses a locker and ther
are no free lockers
58
Cardinalities of an Association
Name of Institution
• Cardinalities One to
Many
– 1 – 1..N
– 0..1 – 1..N
– 1 – 0..N
– 0..1 – 0..N
59
Cardinalities of an Association
Name of Institution
• Cardinalities Many to
Many
– 1..N – 1..N
– 0..N – 1..N
– 0..N – 0..N
60
Cardinalities of an AssociationName of Institution
• Generalization
– Minimal cardinality
• Mandatory participation of every instance - 1
• Optionally participation of every instance - 0
– Maximal cardinality
• To only one instance of the other class – 1
• To multiple instances of the other class - N
61
Dimension of an Association
Name of Institution
Make cours
-HourNumber
-End4 -End3
TEACHER * * SUBJECT
-TeacherName -SubName
-End5
*
ROOM
-RoomNo
62
Dimension of an Association
Name of Institution
• Multidimensional
63
Dimension of an Association
Name of Institution
• One-dimensional
(Reflexive)
64
Aggregate Associations Name of Institution
• Aggregation
• Composition
65
Weak Entities Name of Institution
66
Recommendations Name of Institution
67
Case Study – Management Rules
Name of Institution
69
Case Study - Policlinic Name of Institution
70
Subtypes Name of Institution
• Example – Hardware
components order
71
Subtypes Name of Institution
72
Activity Diagram Name of Institution
73
Activity Diagram Name of Institution
• They are most useful for understanding work flow analysis of synchronous
behaviors across a process.
75
Activity Diagram Name of Institution
76
Activity Diagram ConceptsName of Institution
• An activity is trigged by one or more events and activity may result in one or
more events that may trigger other activity or processes.
• Events start from start symbol and end with finish marker having activities in
between connected by events.
77
Name of Institution
When to Use Activity Diagrams
• The main reason to use activity diagrams is to model the workflow
behind the system being designed.
• Activity diagrams do not give detail about how objects behave or how
objects collaborate.
78
Components Name of Institution
79
Components Name of Institution
80
How to Draw an Activity Diagram Name of Institution
• Diagrams are read from top to bottom and have branches and forks to
describe conditions and parallel activities.
– A fork is used when multiple activities are occurring at the same time.
– All branches at some point are followed by a merge to indicate the end of
the conditional behavior started by that branch.
– After the merge all of the parallel activities must be combined by a join
before transitioning into the final activity state.
81
Activity Diagram Example
Name of Institution
Start State
Activity
Fork
Branch
Merge Join
End State
82
Use Case Name of Institution
83
Name of Institution
84
Notation Name of Institution
2. Transition
Activity1()c Activity2()
1. Activities
Notation - 2 Name of Institution
[x>0]
[x>0]
Activity1()c
[x=0] [x=0]
[x<0] [x<0]
3. Decision Diamond
Name of Institution
Notation - 3
{AND}
{OR}
{XOR}
Notation - 3 Name of Institution
Application/Department/Group/Role Boundaries
Example: Business Level Activity Diagram
of the Library Name of Institution
member Librarian
[borrower]
Find book on shelf
[returning]
[returner]
Wait in queue
[borrowing]
Record borrowing
• Purpose
– Model business workflows
– Model operations
Activity Diagrams (2) Name of Institution
• Then interaction diagrams can be used to help you allocate activities to classes.
113