Oosd-1 (2021-25)
Oosd-1 (2021-25)
Oosd-1 (2021-25)
CSE431
Dr. Bramah Hazela
1
Course Objectives ASETL
2
Pre-requisites
• Software Engineering
3
Course Learning Outcomes
4
Good Books
• Object-Oriented Software Engineering -- a use case
driven approach (revised edition) by Ivar Jacobson
• Craig Larman,"Applying UML and Patterns: An
Introduction to object-oriented Analysis and Design and
iterative development”, Third Edition, Pearson Education,
2005
• UML Distilled (2nd Edition) by Martin Fowler
• MichealBlaha, James Rambaugh, “Object-Oriented
Modeling and Design with UML”, Second Edition, Prentice
Hall of India Private Limited, 2007
• Erich Gamma, Richard Helm, Ralph Johnson, John
Vlissides,“Design patterns: Elements of Reusable object-
oriented software”, Addison-Wesley, 1995, Inc., 1981, Los
Altos, CA.
5
Module I : Object Oriented Design
Descriptors/Topics
6
Objectives
• Understand what object-oriented systems analysis
and design is and appreciate its usefulness.
• Comprehend the concepts of unified modeling
language (UML), the standard approach for modeling
a system in the object-oriented world.
• Apply the steps used in UML to break down the
system into a use case model and then a class
model.
• Diagram systems with the UML toolset so they can be
described and properly designed.
• Document and communicate the newly modeled
object-oriented system to users and other analysts.
Procedural Approach
Procedures
Software System
Module
8
Object-oriented Approach
9
OOA and OOD
9/17/2024
OOA and OOD Models
11
9/17/2024
Object Oriented Analysis Vs
Object Oriented Design
OOA OOD
12
Object-Oriented Programming
13
Object-Oriented System Design
• Reusability
Recycling of program parts should reduce
the costs of development in computer-
based systems.
• Maintaining systems
Making a change in one object has a
minimal impact on other objects.
Object Oriented Design
16
Designing Object Oriented Systems
Object Design
• Object design includes the following phases −
• Object identification
• Object representation, i.e., construction of design models
• Classification of operations
• Algorithm design
• Design of relationships
• Implementation of control for external interactions
• Package classes and associations into modules
Contd… 17
Designing Object Oriented Systems
• System Design
Context
System Architecture
• Object-Oriented Decomposition
• Identifying Concurrency
• Identifying Patterns
• Controlling Events
• Handling Boundary Conditions
18
Object Oriented Modeling
• Object-oriented concepts
• Unified Modeling Language
• Use case and other UML diagrams
• Packages
• Using UML
Object-Oriented Concepts
• Objects
• Classes
• Encapsulation and Data Hiding
• Message Passing
• Inheritance
• Polymorphism
• Generalization and Specialization
• Links and Association
• Aggregation or Composition
Objects
Encapsulation
Encapsulation is the process of binding both attributes and methods
together within a class. Through encapsulation, the internal details of a
class can be hidden from outside. It permits the elements of the class to
be accessed from outside only through the interface provided by the
class.
Data Hiding
Typically, a class is designed such that its data (attributes) can be
accessed only by its class methods and insulated from direct outside
access. This process of insulating an object’s data is called data hiding
or information hiding.
24
Message Passing
25
Inheritance
28
Polymorphism
29
Generalization and Specialization
30
Links and Association
Link
• A link represents a connection through which an object
collaborates with other objects.
Association
• Association is a group of links having common structure and
common behavior. Association depicts the relationship between
objects of one or more classes. A link can be defined as an
instance of an association.
Degree of an Association
• Degree of an association denotes the number of classes involved
in a connection. Degree may be unary, binary, or ternary.
• A unary relationship connects objects of the same class.
• A binary relationship connects objects of two classes.
• A ternary relationship connects objects of three or more classes.
31
Example of Link and Associations
32
Aggregation ,Composition and Association
33
Relationship among Aggregation ,Composition and Association
34
Aggregation Vs Composition
Aggregation Composition
35
Object Oriented Analysis
• Object Modelling
Object modelling develops the static structure of the software
system in terms of objects. It identifies the objects, the classes
into which the objects can be grouped into and the relationships
between the objects. It also identifies the main attributes and
operations that characterize each class.
• Dynamic Modelling
Dynamic Modelling can be defined as “a way of describing how
an individual object responds to events, either internal events
triggered by other objects, or external events triggered by the
outside world”.
Contd.. 36
Object Oriented Analysis
• Functional Modelling
Functional Modelling is the final component of object-oriented
analysis. The functional model shows the processes that are
performed within an object and how the data changes as it
moves between methods. It specifies the meaning of the
operations of object modelling and the actions of dynamic
modelling. The functional model corresponds to the data flow
diagram of traditional structured analysis.
37
Introduction to Object Oriented Methodology
38
Approaches of Modelling
39
UML Background
▪ UML 1.1-1.5, 2.0, 2.1.2, 2.2, 2.3, 2.4.1, 2.5.1(2017) are OMG standard
▪ Vocabulary and the rules focus on representing the logical and physical elements of a
system.
▪ UML is a language used to Visualize, Specify, Construct model of the software system
and Document models of the software system by expressing requirements of the system
during its development and deployment stages.
▪UML is a standard modelling language used for modeling software systems of varying
complexities.
40
UML
▪ Vocabulary and the rules focus on representing the logical and physical elements
of a system.
• The Companies forming a part of the UML consortium are incorporating UML as
a standard in their development process
41
Why UML for Modeling?
• Can be used across the whole life cycle of a software-Promotes iterative refinement
of models
• Makes it easier for programmers and software architects to communicate with variety
of programming languages
42
UML (4+1) View Architecture
Structural view
Implementation View
(Design View)
Use Case
View
(User View)
43
Views in UML
44
Phases in UP
UML Diagram Types
46
The Unified Modeling Language (UML) Concepts
and Diagrams
• Things
• Relationships
• Diagrams
Building Blocks of UML
48
Things
• Structural things are
• Classes, interfaces, use cases, and other elements that
provide a way to create models
• They allow the user to describe relationships
• Behavioral things
• Describe how things work
• Interactions and state machines
• Group things
• Used to define boundaries
• Annotational things
• Can add notes to the diagrams
Relationships
• Structural relationships
• Tie things together in structural diagrams
• Behavioral relationships
• Used in behavioral diagrams
Structural Relationships
• Dependencies
[Graphical notation(---------→)]
• Association
[Graphical notation (Employees Manager )]
• Generalization
• [Graphical notation ( )]
• Realization
• [Graphical notation ( )]
Behavioral Relationships
• Communicates
• Includes
• Extends
• Generalizes
UML Diagrams
• Structural diagrams
• Used to describe the relation between
classes
• Behavior diagrams
• Used to describe the interaction between
people (actors) and a use case (how the
actors use the system)
Structural Diagrams
• Sequence diagrams
• Show the sequence of activities and class
relationships.
• Class diagrams
• Show classes and relationships.
• Statechart diagrams
• Show the state transitions.
An Overview of UML Diagrams Showing How Each Diagram
Leads to the Development of Other UML Diagrams
Structural Things
59
Structural Things
60
Behavioral Things
61
Behavioral Things
62
USE Case Diagram
Syntax:
• Actor --
• Use case --
• Relationship --
• System border --
63
Use Case Description
Each use case may include all or part of the following
<<include>>
goes to Lecture
Paul
Reading books
65
Requirement Elicitation Activities
• Identifying Actors
• Identifying Scenarios
• Identifying USE CASES
• Refining USE CASES
• Identifying Relationship among Actors and USE
CASES
• Identifying Initial analysis objects
• Identifying non functional requirements
66
USE Case Diagram
Semantics:
• An actor represents anything that is outside of the
system and that needs to exchange information
with the system.
-- An individual person (end-user)
-- A group of people
-- An individual can play different roles
-- A machine
-- …..
67
USE Case Diagram (Cont’d)
A use case
• sending a list of variables
• giving the range of the variable
• giving a warning signal
• giving acknowledgement
68
USE Case Diagram (Cont’d)
69
USE Case Diagram(Cont’d)
70
USE Case Diagram(Cont’d)
<<extend>> confirm
search
(spelling info) Extension point:
spelling info
71
USE Case Diagram(Cont’d)
72
USE Case Diagram(Cont’d)
• Example
-- Suppose in an Internet search engine, we have designed two
sequences of searching activities: one sequence of activities is
the normal search and the other one is intelligent search which
is for academy.
-- So we have two use cases corresponding to these two
sequences of activities: one contains the normal search
activities (called base use case) and the other contains the
intelligent search activities.
-- Both handle the request of search, but the second one deal
with special request -- academic request.
Normal Intelligent
search search
73
USE Case Diagram(Cont’d)
74
USE Case Diagram(Cont’d)
• Example:
-- Both the normal and the intelligent search
engines need to read the key words you typed in.
-- The activity of reading key words can then be
picked up from the two use cases and placed into a
new use case.
normal intelligent
New case
75
USE Case Diagram(Cont’d)
Pragmatics:
• Identify system border -- Which action should be taken by
actors and which by system? This is vital important.
• Identify actor(s) -- What are “objects” outside of the system
which want to exchange information with the system? Can we
classify them?
• Identify use case(s) -- What are the main tasks of each
actor? An use case should link to a main task and contain a
complete course of events related to the task.
• Add relationship -- We need to pay extra attention on those
between use cases.
76
CASE STUDY
A recycling machine
• System description: The
system controls a recycling
machine for returnable
bottles, cans and crates. The
machine can be used by
several customers at the
same time and each
customer can return all three
types of item on the same
occasion.
77
CASE STUDY (Cont’d)
The system has to check, for each item, what type has
been returned. The system will register how many
items each customer returns and when the customer
asks for a receipt, the system will print out what was
deposited , the value of the returned items and the total
return sum that will be paid to the customer. An
operator also uses the system. He asks for a printout
of the total number of items that have been deposited
at the end of each day. He has right to change the
deposit values of the items through a console. When
anything wrong with the machine, the operator will be
called by a special alarm signal.
78
CASE STUDY (Cont’d)
• Identify actors:
operator
customer
79
CASE STUDY (Cont’d)
Returning items
Changing item values
80
CASE STUDY (Cont’d)
81
Documentation
• Accumulate
• Print out item,s value and sum
82
Assessment Questions (Contd.)
True OR False
1. Programs written in object oriented language define individual
objects.
2. The individual attributes(properties) of each class of objects define
the objects appearance.
3. Instance variables are also called as object variables.
4. A class that inherits from another class is called a superclass and
the inherited from class is called the subclass.
5. A constructor method can be used to define the initial state of the
object.
83
Assessment Questions
Fill in blanks
1. A mechanism that enables a number of different
procedures to have the same name is called……………………..
2. Objects are identified by assigning them
unique………………………..
3. In OOSD, models are orgainzed around
………………………….concepts
4. ………………….is a feature by virtue of which a class can be
derived into new one.
5.The real life concept of deriving something more specific
from a generalized existing thing is called………………………….
6.A class is made up of two components a set of attributes
called………………. And their behavior called……………………..
84
User View
Requirements Sequence
document diagrams
(text in natural language)
Statechart
diagrams
87
View Items use case extended by several use cases
88
Checkout use case
89
Important tips for drawing a Use Case diagram
Following are some important tips that are to be kept in mind while
drawing a use case diagram:
1.A simple and complete use case diagram should be articulated.
2.A use case diagram should represent the most significant interaction
among the multiple interactions.
3.At least one module of a system should be represented by the use
case diagram.
4.If the use case diagram is large and more complex, then it should be
drawn more generalized.
90
CASE STUDIES
• Consider a cellular phone network. This network
must place the phone call correctly. Also it should
schedule the receiving and conference calls. Draw
its Use Case Diagram.
• Consider a Hospital Management System. Draw its
Use Case Diagram.
• Consider the student course registration system of
Amity University. Draw its Use Case Diagram.
• Draw the Use Case Diagram for the training and
placement division of Amity University.
91
Case Study- NextGen POS
◼ NextGen POS
◼ The Next Generation Point-Of-Sale System
Case Study: NextGen POS
◼ Tasks
◼ Record sales
◼ Handle payments
◼ Control inventory
◼ Print receipts
◼ Easy-to-use
◼ Touch-screen interface
◼ Multi-node vending system
◼ Distributed system
NextGen Pos: System Boundary
◼ External
◼ Cashier
◼ Inventory System
◼ Payment Authorization System
◼ Internal
◼ Point-of-sale system
◼ Complete payment handling
Case Study Focus
95
Sample Layers and Objects in Object Oriented system
96
Layered Architecture Pattern
97
Closed Layers and Request Access
98
Open Layers and Request Flow
99
Layered Architecture (example)
100
Case Study : NextGen POS System
101
Case Study : NextGen POS System
102
NextGen POS: Actors
◼ Primary Actors
◼ Secondary Actors
NextGen POS
Process Sale
Analyze Sale
Manager
Inventory System
Manage System
Administrator
Use Case: Process Sale
:System
Simple: Process Sale scenario
:Cashier
1. Customer arrives at POS
makeNewSale()
checkout with goods to purchase
2. Cashier starts a new sale
3. Cashier enters item identifier enterItem(itemID, quantity)
4. System records sale line itemand
presents item decription, price, description, total
and running total
Cashier repeats 3-4 until indicates [*more items]
done.
endSale()
5. System presents total with taxes
6. Cashier tells customer the total total with tax
and asks for payment
7. Customer pays and system makePayment(amount)
handels payment
change due, receipt
SSD and System Boundary
:System
:Cashier
makeNewSale()
enterItem(itemID, quantity)
endSale()
makePayment(amount)
Principles of Modeling
•Principle-1
The choice of Model is important
•Principle-2
Levels of precision may differ
•Principle-3
The best model are connected to Reality
•Principle-4
No single model is Sufficient
109
Domain Modeling
OOA
Domain Modeling
Domain Modeling
◼ Goal
◼ The problem domain is captured in a domain model
◼ Activities
◼ Identify the conceptual classes with their attributes and their
associations
◼ Input
◼ Use Cases
◼ Result
◼ Conceptual class diagram
◼ Domain objects
◼ Associations among the objects
◼ Attributes of the objects
Domain Model Issues
◼ No Software Artifacts …
◼ No attribute types
◼ No methods
◼ … but Conceptual Class
◼ Symbol – the box
◼ Intension – described in an annotation
◼ … and System Decomposition
◼ Division by conceptual classes
How To Develop The Domain Model
◼ Class Naming
◼ Use existing names of the problem domain
◼ Exclude irrelevant features
◼ Do not add things, that are not there
(mapmaker strategy)
◼ Conceptional Classes
Sales Line
Cashier Customer Manager
Item
Product Product
Payment
Catalog Specification
Analysis vs. Design
Domain Model
A payment Payment Pays-for Sale
in the domain date time
amount 1
model is a
concept.
1
Design Model
association
1
Finding Associations
◼ Multiplicities
◼ Specify domain constraints
multiplicities
Store 1 Item
*
contains
NextGen POS: Step 2 Associations
◼ Unforgettable Relationships
◼ Register Records Sale
◼ To know the current sale, generate total, print receipt
◼ Sale Paid-by Payment
◼ To know if the sale has been paid, relate the amount tendered to
the sale total, and print a receipt
◼ ProductCatalog Records ProductSpecification
◼ To retrieve a product specification, given an itemID
Domain Model
1 1
Paid-by Captured-on Houses
1 1
Payment 1 Register
amount
NextGen POS: Step 3
◼ An attribute is ...
◼ ... a logical data value of an object
attributes
Sale
date
startTime: Time
Attribute Guidelines
◼ Criteria
◼ Choose those attributes for which requirements suggest or imply
a need to remember information
◼ Keep attributes simple
◼ Simple data types
◼ Boolean, Date, Number, String, ...
◼ Common data types
◼ Address, Color, Phone Number, ZIP code,...
More Attribute Guidelines
◼ Complex Attributes
Cashier
Not a simple
Bad name attribute
currentRegister
Cashier Register
Uses
Good
name 1 number
1
More Attribute Guidelines
Payment
Amount: Number Not useful
Payment 1 1
amount: Quantity
Better
Payment
amount: Money
NextGen POS: Step 3
Records-sale-of 1 Item
0..1
*
SalesLineItem 1 Stocks
quantity Store
1..* 1 address
Contained-in name
Logs-completed
1 1
*
Houses
Sale Captured-on
1..*
date time 1
Register
Paid-by 1 1 1
1 Initiated-by 1
Payment Customer
amount partial domain model
Summary
Business Case
–
None easily integrate with many third-party systems.
–
None allow for new terminal technologies such as mobile PDAs.
– There is marketplace dissatisfaction with this inflexible state of affairs, and demand for a
POS that rectifies this.
Case study - Inception
Glossary
Term Definition Format Aliases
Introduction
2. The cashier uses the POS system to record each purchased item.
4. The customer enters payment information, which the system validates and records.
6. The customer receives a receipt from the system and then leaves with the items.
Use case Diagrams
Information
Flow Actor
POST
Buy
Items
Cashier Customer
Log In
Use case
Refund System
Purchased boundary
items
Relating Use cases
The include Relationship
The include Relationship
To separate it into its own subfunction use case, and indicate its inclusion.
– This is simply refactoring and linking text to avoid duplication
NextGen POS
Process
Sale
Cashier «actor»
«include» «include»
Accounting
«include» System
Handle Returns
Manage Users
...
The include Relationship
Using include with Asynchronous Event Handling
• Asychronous Events
– When a user is able to, at any time, select or branch to a particular
window, function, or Web page, or within a range of steps.
• Basic notation is to use a*, b*, ... style labels in the Extensions section
– To imply an extension or event that can happen at any time.
Using include with Asynchronous Event Handling
Why to use include relationship?
• People who follow “include” have less confusion with their writing than
people who mix include with extend and generalizes [Cockburn01].
Concrete/Abstract Use Cases
– Handle Credit Payment is abstract; it doesn't stand on its own, but is always part of
another story, such as Process Sale.
Base/Addition Use Cases
–Process Sale is a base use case with respect to the included Handle Credit Payment.
– Handle Credit Payment is the addition use case in the include relationship to Process
Sale.
• Addition use cases are usually abstract. Base use cases are usually concrete.
The extend Relationship
The extend Relationship
– It has been base-lined as a stable artifact, and can't be touched. How to append to the use
case?
– And within it, describe where and under what condition it extends the behavior of some
Process Sale
Extension Points:
Payment VIP Customer UML notation:
1.The extending use case
«extend» points to the base use case.
Payment, if Customer presents a gift
certificate 2.The condition and
extension point can be
Handle Gift Certificate Payment shown on the line.
The extend Relationship
A signature quality of extend relationship is that the base use case (Process Sale)
has no reference to the extending use case (Handle Gift Certificate Payment)
Use of Extension Point
• Step numbering of base use case can change without affecting the
extending use case
–Extension point may simply "At any point in use case X,“