SlideShare a Scribd company logo
1
Object-Oriented
Software Design (lecture 7)
2
Basic Mechanisms:
Objects:
A real-world entity.
A system is designed as a set of
interacting objects.
Consists of data (attributes) and
functions (methods) that operate on
data
Hides organization of internal
information (Data abstraction)
Examples: an employee, a book etc.
Object-oriented
Concepts
3
Object-oriented
Concepts
Data
Object
m8 m7
m6
m5
m4m3
m2
m1
Model of an object
mi are methods
of the object
4
Class:
Instances are objects
Template for object creation
Examples: set of all employees, different
types of book
Object-oriented
Concepts
5
Methods and message:
Operations supported by an object
Means for manipulating the data of
other objects
Invoked by sending message
Examples: calculate_salary, issue-
book, member_details, etc.
Object-oriented
Concepts
6
Inheritance:
Allows to define a new class (derived
class) by extending or modifying
existing class (base class)
Represents Generalization-
specialization relationship
Allows redefinition of the existing
methods (method overriding)
Object-oriented
Concepts
7
Multiple Inheritance:
Subclass can inherit attributes and
methods from more than one base class
Multiple inheritance is represented by
arrows drawn from the subclass to each
of the base classes
Object-oriented
Concepts
8
Object-oriented
Concepts
LibraryMember
ResearchPostGradUnderGrad
StaffStudentsFaculty
Base Class
Derived
Classes
LibraryMember
ResearchPostGradUnderGrad
StaffStudentsFaculty
Base Class
Multiple
Inheritance
9
Key Concepts:
Abstraction:
Consider aspects relevant for certain
purpose
Suppress non-relevant aspects
Supported at two levels i.e. class level
where base class is an abstraction
& object level where object is a data
abstraction entity
Object-oriented
Concepts
10
Advantages of abstraction:
Reduces complexity of software
Increases software productivity
It is shown that software
productivity is inversely
proportional to software
complexity
Object-oriented
Concepts
11
Encapsulation:
Objects communicate outside world
through messages
Objects data encapsulated within its
methods
Object-oriented
Concepts
12
Object-oriented
Concepts
Methods
Data
m3
m2
m1
m4
m5
m6
Concept of encapsulation
13
Polymorphism:
Denotes to poly (many) morphism
(forms)
Same message result in different
actions by different objects (static
binding)
Object-oriented
Concepts
14
Dynamic binding:
In inheritance hierarchy, an object can be
assigned to another object of its ancestor
class
A method call to an ancestor object would
result in the invocation of appropriate
method of object of the derived class
Object-oriented
Concepts
15
Dynamic binding:
Exact method cannot be known at compile
time
Dynamically decided at runtime
Object-oriented
Concepts
16
Composite objects:
Object containing other objects
Object-oriented
Concepts
17
Code and design reuse
Increased productivity
Ease of testing & maintenance
Better understandability
Its agreed that increased
productivity is chief advantage
Advantages
of Object-oriented
design
18
Initially incur higher costs, but
after completion of some
projects reduction in cost
become possible
Well-established OO
methodology and environment
can be managed with 20-50% of
traditional cost of development
Advantages
of Object-oriented
design
19
UML is a modelling language
Not a system design or
development methodology
Used to document object-
oriented analysis and design
Independent of any specific
design methodology
Object
modelling using UML
20
Based Principally on
OMT [Rumbaugh 1991]
Booch’s methodology[Booch 1991]
OOSE [Jacobson 1992]
Odell’s methodology[Odell 1992]
Shlaer and Mellor [Shlaer 1992]
UML
21
UML
UML
Booch
MethodologyOOSE
OMT
Different object modelling techniques in UML
22
Model is required to capture only
important aspects
UML a graphical modelling tool,
easy to understand and construct
Helps in managing complexity
Why UML is required?
23
Nine diagrams to capture
different views of a system
Provide different perspectives of
the software system
Diagrams can be refined to get
the actual implementation of the
system
UML diagrams
24
Views of a system
User’s view
Structural view
Behavioral view
Implementation view
Environmental view
UML diagrams
25
UML diagrams
User’s View
-Use Case
Diagram
Structural View
- Class Diagram
- Object Diagram
Implementation View
- Component Diagram
Environmental View
- Deployment Diagram
Behavioural View
- Sequence Diagram
- Collaboration Diagram
- State-chart Diagram
- Activity Diagram
Diagrams and views in UML
26
NO
Use case model, class diagram and
one of the interaction diagram for a
simple system
State chart diagram in case of many
state changes
Deployment diagram in case of large
number of hardware components
Are all views required?
27
Use Case model
Consists of set of “use cases”
An important analysis and design
artifact
Other models must confirm to this
model
Not really an object-oriented model
Represents a functional or process
model
28
Use Cases
Different ways in which system can be
used by the users
Corresponds to the high-level requirements
Represents transaction between the user
and the system
Define behavior without revealing internal
structure of system
Set of related scenarios tied together by a
common goal
29
Use Cases
Normally, use cases are independent
of each other
Implicit dependencies may exist
Example: In Library Automation
System, renew-book & reserve-book
are independent use cases. But in
actual implementation of renew-book,
a check is made to see if any book
has been reserved using reserve-
book
30
Example of
Use Cases
For library information system
issue-book
Query-book
Return-book
Create-member
Add-book, etc.
31
Representation of
Use Cases
Represented by use case diagram
Use case is represented by ellipse
System boundary is represented
by rectangle
Users are represented by stick
person icon (actor)
Communication relationship
between actor and use case by line
External system by stereotype
32
Example of
Use Cases
Use case model
Tic-tac-toe game
Play Move
Player
33
Why develop
Use Case diagram?
Serves as requirements specification
Users identification helps in
implementing security mechanism
through login system
Another use in preparing the
documents (e.g. user’s manual)
34
Factoring
Use Cases
Complex use cases need to be
factored into simpler use cases
Represent common behavior across
different use cases
Three ways of factoring
Generalization
Includes
Extends
35
Factoring Using
Generalization
Pay membership fee
Pay through library pay cardPay through credit card
Use case generalization
36
Factoring Using
Includes
Base use case
Use case inclusion
Common
use case
<<include>>
Base use case
Base use caseBase use caseBase use case
Base use case
<<include>>
<<include>>
<<include>>
<<include>>
Paralleling model
37
Factoring Using
Extends
Base
use case
Use case extension
Common
use case
<<extends>>
38
Class diagram
Describes static structure of a
system
Main constituents are classes and
their relationships:
Generalization
Aggregation
Association
Various kinds of dependencies
39
Class diagram
Entities with common features, i.e.
attributes and operations
Classes are represented as solid
outline rectangle with compartments
Compartments for name,
attributes & operations
Attribute and operation compartment
are optional for reuse purpose
40
Example of
Class diagram
Different representations of the LibraryMember class
LibraryMember
Member Name
Membership Number
Address
Phone Number
E-Mail Address
Membership Admission Date
Membership Expiry Date
Books Issued
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
LibraryMember
Member Name
Membership Number
Address
Phone Number
E-Mail Address
Membership Admission Date
Membership Expiry Date
Books Issued
LibraryMember
41
Association
Relationship
Association between two classes
Library Member Book
1 *borrowed by
42
Aggregation
Relationship
Represent a whole-part relationship
Represented by diamond symbol at
the composite end
Cannot be reflexive(i.e. recursive)
Not symmetric
It can be transitive
43
Aggregation
Relationship
Representation of aggregation
Document Line
1 *
Paragraph
1 *
44
Composition
Relationship
Representation of composition
Order
1 *
Item
Life of item is same as the order
45
Class Dependency
Representation of dependence between class
Dependent Class Independent Class
46
Object diagram
Different representations of the LibraryMember object
LibraryMember
Mritunjay
B10028
C-108, Laksmikant Hall
1119
Mrituj@cse
25-02-04
25-03-06
NIL
IssueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
LibraryMember
Mritunjay
B10028
C-108, Laksmikant Hall
1119
Mrituj@cse
25-02-04
25-03-06
NIL
LibraryMember
47
Interaction diagram
Models how groups of objects
collaborate to realize some
behaviour
Typically each interaction diagram
realizes behaviour of a single use
case
48
Interaction diagram
Two kinds: Sequence &
Collaboration
Two diagrams are equivalent but
portrays different perspective
These diagram play a very important
role in the design process
49
Sequence diagram
Shows interaction among objects as two-
dimensional chart
Objects are shown as boxes at top
If object created during execution then
shown at appropriate place
Objects existence are shown as
dashed lines (lifeline)
Objects activeness, shown as
rectangle on lifeline
50
Sequence diagram
Messages are shown as arrows
Message labelled with message
name
Message can be labelled with
control information
Two types of control information:
condition ([]) & an iteration
(*)
51
Example of
Sequence diagram
:Library
Boundary
:Library
Book
Renewal
Controller
:Library
Book
Register
:Book
:Library
Member
renewBook
displayBorrowing
selectBooks
[reserved]
apology
confirm
find MemberBorrowing
bookSelected
* find
update
[reserved]
apology
confirm
updateMemberBorrowing
Sequence Diagram for the renew book use case
52
Collaboration diagram
Shows both structural and
behavioural aspects
Objects are collaborator, shown as
boxes
Messages between objects shown as a
solid line
Message is shown as a labelled
arrow placed near the link
Messages are prefixed with sequence
numbers to show relative sequencing
53
Example of
Collaboration diagram
:Library
Boundary
:Library
Book
Renewal
Controller
:Library
Book
Register
:Book
:Library
Member
1: renewBook
3: display
Borrowing
4: selectBooks
[reserved]
8: apology
12: confirm
2: findMemberBorrowing
5: book
Selected
6: * find
9: update
[reserved]
7: apology
10: confirm
updateMemberBorrowing
Collaboration Diagram for the renew book use case
54
Activity diagram
New concept, possibly based on
event diagram of Odell [1992]
Represent processing activity, may
not correspond to methods
Activity is a state with an internal
action and one/many outgoing
transition
55
Activity diagram
Can represent parallel activity and
synchronization aspects
Swim lanes enable to group
activities based on who is performing
them
Example: academic department vs.
hostel
56
Activity diagram
Normally employed in business process
modelling
Carried out during requirement analysis
and specification
Can be used to develop interaction
diagrams
57
Example of
Activity diagram
check
student
records
Academic Section
receive
fees
allot
room
receive
fees
allot
hostel
create
hospital
record
conduct
medical
examination
register
in
course
Accounts Section Hostel Office Hospital Department
issue
identity card
Activity diagram for student admission procedure at IIT
58
State Chart diagram
Based on the work of David Harel
[1990]
Model how the state of an object
changes in its lifetime
Based on finite state machine (FSM)
formalism
59
State Chart diagram
Elements of state chart diagram
Initial State: Filled circle
Final State: Filled circle inside
larger circle
State: Rectangle with rounded
corners
Transitions: Arrow between states,
also boolean logic condition (guard)
60
Example of
State Chart diagram
Unprocessed
Order
Fulfilled
Order
Pending
Order
Accepted
Order
Rejected
Order
order received
[reject] checked [accept] checked
[some items not
available] processed
[all items
available]
newsupply
[some items available]
processed / deliver
Example: State chart diagram for an order object
61
Design Patterns
Standard solutions to commonly
recurring problems
Provides a good solution to model
Pattern has four important parts
The problem
The context (problem)
The solution
The context (solution)
62
Example Pattern
Expert
Problem: Which class should be
responsible for doing certain things
Solution: Assign responsibility to
the class that has the information
necessary to fulfil the required
responsibility
63
Example Pattern
Creator
Problem: Which class should be
responsible for creating a new
instance of some class?
Solution: Assign a class C1 the
responsibility to create class C2 if
C1 is an aggregation of objects of
type C2
C1 contains object of type C2
64
Example Pattern
Controller
Problem: Who should be responsible
for handling the actor requests?
Solution: Separate controller object
for each use case.
65
Example Pattern
Facade
Problem: How should the services be
requested from a service package?
Context (problem): A package
(cohesive set of classes), example:
RDBMS interface package
Solution: A class (DBfacade) can be
created which provides a common
interface to the services of the
package
66
Example 1: Tic-Tac-Toe
Computer Game
A human player and the computer make
alternate moves on a 3 3 square.
A move consists of marking a
previously unmarked square.
The user inputs a number between 1
and 9 to mark a square
Whoever is first to place three
consecutive marks along a straight line
(i.e., along a row, column, or diagonal)
on the square wins.
67
Example 1: Tic-Tac-Toe
Computer Game
As soon as either of the human player
or the computer wins,
a message announcing the winner should
be displayed.
If neither player manages to get three
consecutive marks along a straight
line,
and all the squares on the board are filled
up,
then the game is drawn.
The computer always tries to win a
game.
68
Example 1: Use Case
Model
Tic-tac-toe game
Play Move
Player
69
Example 1: Sequence
Diagram
:playMove
Boundary
:playMove
Controller
:board
acceptMove
Sequence Diagram for the play move use case
move
checkMoveValidity
[invalidMove]
announceInvalidMove
[invalidMove]
announceInvalidMove
[game over]
announceResult[game over]
announceResult
checkWinner
playMove
checkWinner
[game over]
announceResult
[game over]
announceResult
getBoardPositionsdisplayBoardPositions
[game not over]
promptNextMove
70
Example 1: Class Diagram
Board
int position[9]
checkMove Validity
checkResult
playMove
Controller
announceInvalidMove
announceResult
PlayMoveBoundary
announceInvalidMove
announceResult
displayBoard
71
Example 2: Supermarket
Prize Scheme
Supermarket needs to develop
software to encourage regular
customers.
Customer needs to supply his
residence address, telephone
number, and the driving licence
number.
Each customer who registers is
assigned a unique customer
number (CN) by the computer.
72
Example 2: Supermarket
Prize Scheme
A customer can present his CN to
the staff when he makes any
purchase.
The value of his purchase is
credited against his CN.
At the end of each year, the
supermarket awards surprise gifts
to ten customers who make
highest purchase.
73
Example 2: Supermarket
Prize Scheme
Also, it awards a 22 carat gold
coin to every customer whose
purchases exceed Rs. 10,000.
The entries against the CN are
reset on the last day of every year
after the prize winner’s lists are
generated.
74
Example 2: Use Case
Model
Supermarket
Prize scheme
register
customerCustomer
register
sales
select
winners
Sales Clerk
Manager
Clerk
75
Example 2: Sequence Diagram
for the Select Winners Use
Case
:SelectWinner
Boundary
:SelectWinner
Controller
:Sales
History
:Sales
Record
:Customer
Register
Select
Winners
Sequence Diagram for the select winners use case
:Customer
Record
SelectWinners
announces
SelectWinners
*computeSales
*browse
[for each winner]
find WinnerDetails [for each winner]
browse
76
Example 2: Sequence Diagram
for the Register Customer
Use Case
:SelectWinner
Boundary
:SelectWinner
Controller
:Customer
Register
register
Sequence Diagram for the register customer use case
:Customer
Record
[duplicate]
displayCIN
*match
create
register
:Customer
Record
checkDuplicate
showError
generateCIN
register
77
Example 2: Sequence Diagram
for the Register Sales Use
Case
:Register
Sales
Boundary
:Sales
History
:Sales
Record
registerSales
Sequence Diagram for the register sales use case
RegisterSales
create
confirm
:Register
Sales
Controller
registerSales
confirm
78
Example 2: Sequence Diagram
for the Register Sales Use
Case
:Register
Sales
Boundary
:Sales
History
:Sales
Record
registerSales
Refined Sequence Diagram for the register sales use case
RegisterSales
create
confirm
79
Example 1: Class Diagram
SalesHistory
selectWinners
registerSales
SalesRecords
computerSales
browse
create
CustomerRegister
findWinnerDetails
register
salesDetails
CustomerRecord
browse
checkDuplicate
create
name
address
1
*
1
*
80
Summary
We discussed object-oriented
concepts
Basic mechanisms: Such as
objects, class, methods, inheritance
etc.
Key concepts: Such as abstraction,
encapsulation, polymorphism,
composite objects etc.
81
Summary
We discussed an important OO language
UML
Its origin, as a standard, as a model
Use case representation, its
factorisation such as generalization,
includes and extends
Different diagrams for UML representation
In class diagram we discussed some
relationships association, aggregation,
composition and inheritance
82
Summary
Some more diagrams such as
interaction diagrams (sequence
and collaboration), activity
diagrams, state chart diagram
We discussed OO software
development process and patterns
In this we discussed some patterns
example and domain modelling

More Related Content

PDF
Conmutación de Etiquetas Mult-Protocolo
PDF
5G positioning for the connected intelligent edge
PPTX
Chapter 8 : IP addressing
PPTX
Network automation
PDF
Simplifying AI for Communications, Radar, and Wireless Systems
PDF
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
PPTX
Internet of Things with Cloud Computing and M2M Communication
Conmutación de Etiquetas Mult-Protocolo
5G positioning for the connected intelligent edge
Chapter 8 : IP addressing
Network automation
Simplifying AI for Communications, Radar, and Wireless Systems
Slides for Ph.D. Thesis Defense of Dheryta Jaisinghani at IIIT-Delhi, INDIA
Internet of Things with Cloud Computing and M2M Communication

What's hot (13)

PPTX
CCNA Wireless Lan (WLAN)
PDF
3GPP 5G SA Detailed explanation 3(5G SA NR Attach Registration Call Flow)
PPTX
Fundamentos de red: 9. Ethernet
PDF
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
PDF
Setting off the 5G Advanced evolution with 3GPP Release 18
PPTX
Simple Network Management Protocol
PPSX
Huawei soft switch
PPTX
ITN_Module_9.pptx
PPT
CCNA Routing Protocols
PPTX
Digital image processing
PDF
Enabling Multi-access Edge Computing (MEC) Platform-as-a-Service for Enterprises
PPTX
COM2304: Introduction to Computer Vision & Image Processing
PDF
UNIT I INTRODUCTION TO INTERNET OF THINGS
CCNA Wireless Lan (WLAN)
3GPP 5G SA Detailed explanation 3(5G SA NR Attach Registration Call Flow)
Fundamentos de red: 9. Ethernet
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Setting off the 5G Advanced evolution with 3GPP Release 18
Simple Network Management Protocol
Huawei soft switch
ITN_Module_9.pptx
CCNA Routing Protocols
Digital image processing
Enabling Multi-access Edge Computing (MEC) Platform-as-a-Service for Enterprises
COM2304: Introduction to Computer Vision & Image Processing
UNIT I INTRODUCTION TO INTERNET OF THINGS
Ad

Viewers also liked (20)

PDF
3 interaction and_state_modeling
PPT
UML Diagrams
PPTX
Library management system
PPT
UML Architecture and Views
PDF
ADVANCED SYSTEM ANALYSIS On Automated Library Management System
PPTX
BPMN Process Modeling Levels
PPT
CS554 � Introduction to Rational Rose
PPTX
Uml assignment help
PPTX
Library management system
PDF
Unified Modelling Language
PPT
PPSX
DISE - OOAD Using UML
PPTX
Library management
PPT
Collaboration Diagram
PPT
5.state diagrams
 
PDF
使用者認證
PPTX
The Ultimate Sequence Diagram Tutorial
PPTX
Object oriented methodologies
PPTX
OCL tutorial
DOCX
Online voting system project
3 interaction and_state_modeling
UML Diagrams
Library management system
UML Architecture and Views
ADVANCED SYSTEM ANALYSIS On Automated Library Management System
BPMN Process Modeling Levels
CS554 � Introduction to Rational Rose
Uml assignment help
Library management system
Unified Modelling Language
DISE - OOAD Using UML
Library management
Collaboration Diagram
5.state diagrams
 
使用者認證
The Ultimate Sequence Diagram Tutorial
Object oriented methodologies
OCL tutorial
Online voting system project
Ad

Similar to uml123 copy (20)

PPT
UML Diagrams, examples, descriptions and tutorials
PDF
Oo aand d-overview
PDF
Software Engineering : OOAD using UML
PPT
Unit 1( modelling concepts & class modeling)
PDF
OBJECT ORIENTED CONCEPTS,UML DIAGRAMS,DFD
PPT
Object oriented analysis and design. SE 221
PPTX
Different Types Diagrams
DOCX
Ooad unit 1
PPT
Ooad ch 2
PPT
ASP.NET System design 2
PPT
Oomd unit1
PPTX
Software enginering.group-no-11 (1)
PPT
Uml unified-modeling-language-presented by dileep
PPT
Introduction to Object orientation , Modeling as a Design Technique Modeling ...
PDF
PDF
System Desigren_OOD-9asdasdasdsasdasdasd.pdf
PPTX
Object Oriented Analysis and Design - OOAD
PPT
OBJECT ORIENTED ANALYSIS FOR EASY UNDERSTANDING .ppt
UML Diagrams, examples, descriptions and tutorials
Oo aand d-overview
Software Engineering : OOAD using UML
Unit 1( modelling concepts & class modeling)
OBJECT ORIENTED CONCEPTS,UML DIAGRAMS,DFD
Object oriented analysis and design. SE 221
Different Types Diagrams
Ooad unit 1
Ooad ch 2
ASP.NET System design 2
Oomd unit1
Software enginering.group-no-11 (1)
Uml unified-modeling-language-presented by dileep
Introduction to Object orientation , Modeling as a Design Technique Modeling ...
System Desigren_OOD-9asdasdasdsasdasdasd.pdf
Object Oriented Analysis and Design - OOAD
OBJECT ORIENTED ANALYSIS FOR EASY UNDERSTANDING .ppt

More from Amit Sachan (8)

PPT
17204 sentence combining ppt
PDF
17204 idioms
PPT
16898 first conditional
PDF
17204 idioms & proverbs new and final
PDF
17204 formal letter format
PDF
17204 foreign phrases
PPT
17204 final direct and indirect speech
PPT
17204 compound sentences 1 ppt
17204 sentence combining ppt
17204 idioms
16898 first conditional
17204 idioms & proverbs new and final
17204 formal letter format
17204 foreign phrases
17204 final direct and indirect speech
17204 compound sentences 1 ppt

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Well-logging-methods_new................
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Artificial Intelligence
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
PPT on Performance Review to get promotions
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
web development for engineering and engineering
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Well-logging-methods_new................
additive manufacturing of ss316l using mig welding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Artificial Intelligence
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
R24 SURVEYING LAB MANUAL for civil enggi
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT on Performance Review to get promotions
CYBER-CRIMES AND SECURITY A guide to understanding
web development for engineering and engineering
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
bas. eng. economics group 4 presentation 1.pptx
Mechanical Engineering MATERIALS Selection
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
CH1 Production IntroductoryConcepts.pptx

uml123 copy

  • 2. 2 Basic Mechanisms: Objects: A real-world entity. A system is designed as a set of interacting objects. Consists of data (attributes) and functions (methods) that operate on data Hides organization of internal information (Data abstraction) Examples: an employee, a book etc. Object-oriented Concepts
  • 4. 4 Class: Instances are objects Template for object creation Examples: set of all employees, different types of book Object-oriented Concepts
  • 5. 5 Methods and message: Operations supported by an object Means for manipulating the data of other objects Invoked by sending message Examples: calculate_salary, issue- book, member_details, etc. Object-oriented Concepts
  • 6. 6 Inheritance: Allows to define a new class (derived class) by extending or modifying existing class (base class) Represents Generalization- specialization relationship Allows redefinition of the existing methods (method overriding) Object-oriented Concepts
  • 7. 7 Multiple Inheritance: Subclass can inherit attributes and methods from more than one base class Multiple inheritance is represented by arrows drawn from the subclass to each of the base classes Object-oriented Concepts
  • 9. 9 Key Concepts: Abstraction: Consider aspects relevant for certain purpose Suppress non-relevant aspects Supported at two levels i.e. class level where base class is an abstraction & object level where object is a data abstraction entity Object-oriented Concepts
  • 10. 10 Advantages of abstraction: Reduces complexity of software Increases software productivity It is shown that software productivity is inversely proportional to software complexity Object-oriented Concepts
  • 11. 11 Encapsulation: Objects communicate outside world through messages Objects data encapsulated within its methods Object-oriented Concepts
  • 13. 13 Polymorphism: Denotes to poly (many) morphism (forms) Same message result in different actions by different objects (static binding) Object-oriented Concepts
  • 14. 14 Dynamic binding: In inheritance hierarchy, an object can be assigned to another object of its ancestor class A method call to an ancestor object would result in the invocation of appropriate method of object of the derived class Object-oriented Concepts
  • 15. 15 Dynamic binding: Exact method cannot be known at compile time Dynamically decided at runtime Object-oriented Concepts
  • 16. 16 Composite objects: Object containing other objects Object-oriented Concepts
  • 17. 17 Code and design reuse Increased productivity Ease of testing & maintenance Better understandability Its agreed that increased productivity is chief advantage Advantages of Object-oriented design
  • 18. 18 Initially incur higher costs, but after completion of some projects reduction in cost become possible Well-established OO methodology and environment can be managed with 20-50% of traditional cost of development Advantages of Object-oriented design
  • 19. 19 UML is a modelling language Not a system design or development methodology Used to document object- oriented analysis and design Independent of any specific design methodology Object modelling using UML
  • 20. 20 Based Principally on OMT [Rumbaugh 1991] Booch’s methodology[Booch 1991] OOSE [Jacobson 1992] Odell’s methodology[Odell 1992] Shlaer and Mellor [Shlaer 1992] UML
  • 22. 22 Model is required to capture only important aspects UML a graphical modelling tool, easy to understand and construct Helps in managing complexity Why UML is required?
  • 23. 23 Nine diagrams to capture different views of a system Provide different perspectives of the software system Diagrams can be refined to get the actual implementation of the system UML diagrams
  • 24. 24 Views of a system User’s view Structural view Behavioral view Implementation view Environmental view UML diagrams
  • 25. 25 UML diagrams User’s View -Use Case Diagram Structural View - Class Diagram - Object Diagram Implementation View - Component Diagram Environmental View - Deployment Diagram Behavioural View - Sequence Diagram - Collaboration Diagram - State-chart Diagram - Activity Diagram Diagrams and views in UML
  • 26. 26 NO Use case model, class diagram and one of the interaction diagram for a simple system State chart diagram in case of many state changes Deployment diagram in case of large number of hardware components Are all views required?
  • 27. 27 Use Case model Consists of set of “use cases” An important analysis and design artifact Other models must confirm to this model Not really an object-oriented model Represents a functional or process model
  • 28. 28 Use Cases Different ways in which system can be used by the users Corresponds to the high-level requirements Represents transaction between the user and the system Define behavior without revealing internal structure of system Set of related scenarios tied together by a common goal
  • 29. 29 Use Cases Normally, use cases are independent of each other Implicit dependencies may exist Example: In Library Automation System, renew-book & reserve-book are independent use cases. But in actual implementation of renew-book, a check is made to see if any book has been reserved using reserve- book
  • 30. 30 Example of Use Cases For library information system issue-book Query-book Return-book Create-member Add-book, etc.
  • 31. 31 Representation of Use Cases Represented by use case diagram Use case is represented by ellipse System boundary is represented by rectangle Users are represented by stick person icon (actor) Communication relationship between actor and use case by line External system by stereotype
  • 32. 32 Example of Use Cases Use case model Tic-tac-toe game Play Move Player
  • 33. 33 Why develop Use Case diagram? Serves as requirements specification Users identification helps in implementing security mechanism through login system Another use in preparing the documents (e.g. user’s manual)
  • 34. 34 Factoring Use Cases Complex use cases need to be factored into simpler use cases Represent common behavior across different use cases Three ways of factoring Generalization Includes Extends
  • 35. 35 Factoring Using Generalization Pay membership fee Pay through library pay cardPay through credit card Use case generalization
  • 36. 36 Factoring Using Includes Base use case Use case inclusion Common use case <<include>> Base use case Base use caseBase use caseBase use case Base use case <<include>> <<include>> <<include>> <<include>> Paralleling model
  • 37. 37 Factoring Using Extends Base use case Use case extension Common use case <<extends>>
  • 38. 38 Class diagram Describes static structure of a system Main constituents are classes and their relationships: Generalization Aggregation Association Various kinds of dependencies
  • 39. 39 Class diagram Entities with common features, i.e. attributes and operations Classes are represented as solid outline rectangle with compartments Compartments for name, attributes & operations Attribute and operation compartment are optional for reuse purpose
  • 40. 40 Example of Class diagram Different representations of the LibraryMember class LibraryMember Member Name Membership Number Address Phone Number E-Mail Address Membership Admission Date Membership Expiry Date Books Issued issueBook( ); findPendingBooks( ); findOverdueBooks( ); returnBook( ); findMembershipDetails( ); LibraryMember Member Name Membership Number Address Phone Number E-Mail Address Membership Admission Date Membership Expiry Date Books Issued LibraryMember
  • 41. 41 Association Relationship Association between two classes Library Member Book 1 *borrowed by
  • 42. 42 Aggregation Relationship Represent a whole-part relationship Represented by diamond symbol at the composite end Cannot be reflexive(i.e. recursive) Not symmetric It can be transitive
  • 44. 44 Composition Relationship Representation of composition Order 1 * Item Life of item is same as the order
  • 45. 45 Class Dependency Representation of dependence between class Dependent Class Independent Class
  • 46. 46 Object diagram Different representations of the LibraryMember object LibraryMember Mritunjay B10028 C-108, Laksmikant Hall 1119 Mrituj@cse 25-02-04 25-03-06 NIL IssueBook( ); findPendingBooks( ); findOverdueBooks( ); returnBook( ); findMembershipDetails( ); LibraryMember Mritunjay B10028 C-108, Laksmikant Hall 1119 Mrituj@cse 25-02-04 25-03-06 NIL LibraryMember
  • 47. 47 Interaction diagram Models how groups of objects collaborate to realize some behaviour Typically each interaction diagram realizes behaviour of a single use case
  • 48. 48 Interaction diagram Two kinds: Sequence & Collaboration Two diagrams are equivalent but portrays different perspective These diagram play a very important role in the design process
  • 49. 49 Sequence diagram Shows interaction among objects as two- dimensional chart Objects are shown as boxes at top If object created during execution then shown at appropriate place Objects existence are shown as dashed lines (lifeline) Objects activeness, shown as rectangle on lifeline
  • 50. 50 Sequence diagram Messages are shown as arrows Message labelled with message name Message can be labelled with control information Two types of control information: condition ([]) & an iteration (*)
  • 51. 51 Example of Sequence diagram :Library Boundary :Library Book Renewal Controller :Library Book Register :Book :Library Member renewBook displayBorrowing selectBooks [reserved] apology confirm find MemberBorrowing bookSelected * find update [reserved] apology confirm updateMemberBorrowing Sequence Diagram for the renew book use case
  • 52. 52 Collaboration diagram Shows both structural and behavioural aspects Objects are collaborator, shown as boxes Messages between objects shown as a solid line Message is shown as a labelled arrow placed near the link Messages are prefixed with sequence numbers to show relative sequencing
  • 53. 53 Example of Collaboration diagram :Library Boundary :Library Book Renewal Controller :Library Book Register :Book :Library Member 1: renewBook 3: display Borrowing 4: selectBooks [reserved] 8: apology 12: confirm 2: findMemberBorrowing 5: book Selected 6: * find 9: update [reserved] 7: apology 10: confirm updateMemberBorrowing Collaboration Diagram for the renew book use case
  • 54. 54 Activity diagram New concept, possibly based on event diagram of Odell [1992] Represent processing activity, may not correspond to methods Activity is a state with an internal action and one/many outgoing transition
  • 55. 55 Activity diagram Can represent parallel activity and synchronization aspects Swim lanes enable to group activities based on who is performing them Example: academic department vs. hostel
  • 56. 56 Activity diagram Normally employed in business process modelling Carried out during requirement analysis and specification Can be used to develop interaction diagrams
  • 57. 57 Example of Activity diagram check student records Academic Section receive fees allot room receive fees allot hostel create hospital record conduct medical examination register in course Accounts Section Hostel Office Hospital Department issue identity card Activity diagram for student admission procedure at IIT
  • 58. 58 State Chart diagram Based on the work of David Harel [1990] Model how the state of an object changes in its lifetime Based on finite state machine (FSM) formalism
  • 59. 59 State Chart diagram Elements of state chart diagram Initial State: Filled circle Final State: Filled circle inside larger circle State: Rectangle with rounded corners Transitions: Arrow between states, also boolean logic condition (guard)
  • 60. 60 Example of State Chart diagram Unprocessed Order Fulfilled Order Pending Order Accepted Order Rejected Order order received [reject] checked [accept] checked [some items not available] processed [all items available] newsupply [some items available] processed / deliver Example: State chart diagram for an order object
  • 61. 61 Design Patterns Standard solutions to commonly recurring problems Provides a good solution to model Pattern has four important parts The problem The context (problem) The solution The context (solution)
  • 62. 62 Example Pattern Expert Problem: Which class should be responsible for doing certain things Solution: Assign responsibility to the class that has the information necessary to fulfil the required responsibility
  • 63. 63 Example Pattern Creator Problem: Which class should be responsible for creating a new instance of some class? Solution: Assign a class C1 the responsibility to create class C2 if C1 is an aggregation of objects of type C2 C1 contains object of type C2
  • 64. 64 Example Pattern Controller Problem: Who should be responsible for handling the actor requests? Solution: Separate controller object for each use case.
  • 65. 65 Example Pattern Facade Problem: How should the services be requested from a service package? Context (problem): A package (cohesive set of classes), example: RDBMS interface package Solution: A class (DBfacade) can be created which provides a common interface to the services of the package
  • 66. 66 Example 1: Tic-Tac-Toe Computer Game A human player and the computer make alternate moves on a 3 3 square. A move consists of marking a previously unmarked square. The user inputs a number between 1 and 9 to mark a square Whoever is first to place three consecutive marks along a straight line (i.e., along a row, column, or diagonal) on the square wins.
  • 67. 67 Example 1: Tic-Tac-Toe Computer Game As soon as either of the human player or the computer wins, a message announcing the winner should be displayed. If neither player manages to get three consecutive marks along a straight line, and all the squares on the board are filled up, then the game is drawn. The computer always tries to win a game.
  • 68. 68 Example 1: Use Case Model Tic-tac-toe game Play Move Player
  • 69. 69 Example 1: Sequence Diagram :playMove Boundary :playMove Controller :board acceptMove Sequence Diagram for the play move use case move checkMoveValidity [invalidMove] announceInvalidMove [invalidMove] announceInvalidMove [game over] announceResult[game over] announceResult checkWinner playMove checkWinner [game over] announceResult [game over] announceResult getBoardPositionsdisplayBoardPositions [game not over] promptNextMove
  • 70. 70 Example 1: Class Diagram Board int position[9] checkMove Validity checkResult playMove Controller announceInvalidMove announceResult PlayMoveBoundary announceInvalidMove announceResult displayBoard
  • 71. 71 Example 2: Supermarket Prize Scheme Supermarket needs to develop software to encourage regular customers. Customer needs to supply his residence address, telephone number, and the driving licence number. Each customer who registers is assigned a unique customer number (CN) by the computer.
  • 72. 72 Example 2: Supermarket Prize Scheme A customer can present his CN to the staff when he makes any purchase. The value of his purchase is credited against his CN. At the end of each year, the supermarket awards surprise gifts to ten customers who make highest purchase.
  • 73. 73 Example 2: Supermarket Prize Scheme Also, it awards a 22 carat gold coin to every customer whose purchases exceed Rs. 10,000. The entries against the CN are reset on the last day of every year after the prize winner’s lists are generated.
  • 74. 74 Example 2: Use Case Model Supermarket Prize scheme register customerCustomer register sales select winners Sales Clerk Manager Clerk
  • 75. 75 Example 2: Sequence Diagram for the Select Winners Use Case :SelectWinner Boundary :SelectWinner Controller :Sales History :Sales Record :Customer Register Select Winners Sequence Diagram for the select winners use case :Customer Record SelectWinners announces SelectWinners *computeSales *browse [for each winner] find WinnerDetails [for each winner] browse
  • 76. 76 Example 2: Sequence Diagram for the Register Customer Use Case :SelectWinner Boundary :SelectWinner Controller :Customer Register register Sequence Diagram for the register customer use case :Customer Record [duplicate] displayCIN *match create register :Customer Record checkDuplicate showError generateCIN register
  • 77. 77 Example 2: Sequence Diagram for the Register Sales Use Case :Register Sales Boundary :Sales History :Sales Record registerSales Sequence Diagram for the register sales use case RegisterSales create confirm :Register Sales Controller registerSales confirm
  • 78. 78 Example 2: Sequence Diagram for the Register Sales Use Case :Register Sales Boundary :Sales History :Sales Record registerSales Refined Sequence Diagram for the register sales use case RegisterSales create confirm
  • 79. 79 Example 1: Class Diagram SalesHistory selectWinners registerSales SalesRecords computerSales browse create CustomerRegister findWinnerDetails register salesDetails CustomerRecord browse checkDuplicate create name address 1 * 1 *
  • 80. 80 Summary We discussed object-oriented concepts Basic mechanisms: Such as objects, class, methods, inheritance etc. Key concepts: Such as abstraction, encapsulation, polymorphism, composite objects etc.
  • 81. 81 Summary We discussed an important OO language UML Its origin, as a standard, as a model Use case representation, its factorisation such as generalization, includes and extends Different diagrams for UML representation In class diagram we discussed some relationships association, aggregation, composition and inheritance
  • 82. 82 Summary Some more diagrams such as interaction diagrams (sequence and collaboration), activity diagrams, state chart diagram We discussed OO software development process and patterns In this we discussed some patterns example and domain modelling