SlideShare a Scribd company logo
1
OO Design Principles and Heuristics
Dhaval ShahDhaval Shah
2
AgendaAgenda
 What is OO Modeling?
 Why OO Modeling?
 Odors of rotting software
 Basic OO Principles
 OO Design Principles and Heuristics
 Conclusion
 Case Study
3
This session will not:This session will not:
 Make you an expert in OOAD
 Turn you into a system architect
 Provide instruction on UML
4
Warning!Warning!
 Most of these slides maps
directly/indirectly to various articles
available on the web, especially from
objectmentor.com
Thanks Bob!
5
What is OO ModelingWhat is OO Modeling
6
Why OO ModelingWhy OO Modeling
To Manage
Change
To Manage
Change
To Deliver
Faster
To Deliver
Faster
To Deal with
Complexity
To Deal with
Complexity
7
Odors of rotting softwareOdors of rotting software
RigidityRigidity
FragilityFragility
ImmobilityImmobility
ViscosityViscosity
Needless
Complexity
Needless
Complexity
Needless
Repetition
Needless
Repetition
OpacityOpacity
8
OO Design Principles and Heuristics
 Single Responsibility Principle
 Open Close Principle
 Liskov Substitution Principle
 Interface Segregation Principle
 Dependency Inversion Principle
9
Single Responsibility PrincipleSingle Responsibility Principle
A class should have only one
reason to change
10
Single Responsibility Principle [Contd.]
11
Single Responsibility Principle [Contd.]
12
Single Responsibility Principle [Contd.]Single Responsibility Principle [Contd.]
 What is RESPONSIBILITY?
 RESPONSIBILITY is reason for change
 How to spot multiple RESPONSIBILITIES?
13
Single Responsibility Principle [Contd.]Single Responsibility Principle [Contd.]
 Example-
14
Single Responsibility Principle [Contd.]Single Responsibility Principle [Contd.]
 Going from multiple responsibilities to single responsibility -
15
Open Close PrincipleOpen Close Principle
Software entities should be open
for extension but closed for
modification.
16
Open Close Principle [Contd.]Open Close Principle [Contd.]
 Example
17
Open Close Principle [Contd.]Open Close Principle [Contd.]
 Example
18
Liskov Substitution PrincipleLiskov Substitution Principle
Subtypes must be substitutable for their base
types.
 LSP is all about inheritance – One must be able to substitute subclass by
base class without things going terribly wrong
19
Liskov Substitution Principle [Contd.]Liskov Substitution Principle [Contd.]
 Example
20
Liskov Substitution Principle [Contd.]Liskov Substitution Principle [Contd.]
 Example
Board board = new 3DBoard();
Unit unit = board.getUnits(8,4);
21
Liskov Substitution Principle [Contd.]Liskov Substitution Principle [Contd.]
 Solving 3DBoard problem
22
Interface Segregation PrincipleInterface Segregation Principle
Clients should not be forced to depend upon
interfaces that they don't use.
23
Interface Segregation Principle [Contd.]Interface Segregation Principle [Contd.]
 Example
24
Interface Segregation Principle [Contd.]Interface Segregation Principle [Contd.]
 Separation Through Delegation
25
Interface Segregation Principle [Contd.]Interface Segregation Principle [Contd.]
 Separation Through Multiple Inheritance
26
Dependency Inversion PrincipleDependency Inversion Principle
a.High-level modules should not depend on low-
level modules. Both should depend on
abstractions
b.Abstractions should not depend upon details.
Details should depend upon abstractions
27
Interface Segregation Principle [Contd.]Interface Segregation Principle [Contd.]
 Layering
Naive Layering Scheme
28
Interface Segregation Principle [Contd.]Interface Segregation Principle [Contd.]
 Inverted Layering
Inverted Layers
29
ConclusionConclusion
 Good design is needed to successfully deal with change
 The main forces driving your design should be high cohesion and low
coupling
 SOLID principles put you on the right path
WARNING : these principles cannot be applied blindly :)

More Related Content

PDF
Object-oriented design principles
PPT
principles of object oriented class design
PPT
SOLID Design Principles
PDF
SOLID design principles applied in Java
PPTX
Design Patterns: From STUPID to SOLID code
PPTX
Implementing The Open/Closed Principle
PDF
Solid Principles
PDF
SOLID Design Principles applied in Java
Object-oriented design principles
principles of object oriented class design
SOLID Design Principles
SOLID design principles applied in Java
Design Patterns: From STUPID to SOLID code
Implementing The Open/Closed Principle
Solid Principles
SOLID Design Principles applied in Java

What's hot (20)

PPT
SOLID principles
PPTX
Design principles - SOLID
PPTX
Clean code: SOLID
PPT
The OO Design Principles
PPTX
Solid design principles
KEY
"SOLID" Object Oriented Design Principles
PDF
Binding android piece by piece
PPTX
SOLID principles
PDF
SOLID Design principles
PPTX
S.O.L.I.D. Principles for Software Architects
PPTX
Solid Principles
PPTX
Advanced Object-Oriented/SOLID Principles
ODP
Geecon09: SOLID Design Principles
PPTX
SOLID, DRY, SLAP design principles
PDF
Lego For Engineers - Dependency Injection for LIDNUG (2011-06-03)
PPTX
The good, the bad and the SOLID
PPTX
Design principle vs design patterns
PDF
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
PDF
Design Patterns Illustrated
PDF
Contract First Development with Microsoft Code Contracts and Microsoft Pex at...
SOLID principles
Design principles - SOLID
Clean code: SOLID
The OO Design Principles
Solid design principles
"SOLID" Object Oriented Design Principles
Binding android piece by piece
SOLID principles
SOLID Design principles
S.O.L.I.D. Principles for Software Architects
Solid Principles
Advanced Object-Oriented/SOLID Principles
Geecon09: SOLID Design Principles
SOLID, DRY, SLAP design principles
Lego For Engineers - Dependency Injection for LIDNUG (2011-06-03)
The good, the bad and the SOLID
Design principle vs design patterns
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
Design Patterns Illustrated
Contract First Development with Microsoft Code Contracts and Microsoft Pex at...
Ad

Similar to OO design principles & heuristics (20)

PPTX
Improving Software Quality Using Object Oriented Design Principles
PPTX
Learning solid principles using c#
PPTX
Object Oriented Design SOLID Principles
PPTX
Software Design principles
PPTX
PPTX
SOLID Principles
PPTX
An ultimate guide to SOLID Principles, developers must know.
PPT
DesignPrinciples-and-DesignPatterns
PPTX
android principle.pptx
PPTX
Becoming a better developer by using the SOLID design principles
PPTX
S.O.L.I.D. principles of software development
PDF
L22 Design Principles
PDF
How to Master Development's Solid Principles | Tutort Academy
PDF
Solid principles
PPTX
SOLID Principles in OOPS ooooooooo.pptx
PPTX
Soild principles
PPTX
Object Oriented, Design patterns and data modelling worshop
PDF
Solid Principle
PDF
SOLID Design Principle
PPTX
From Good to SOLID: How to become a better PHP developer
Improving Software Quality Using Object Oriented Design Principles
Learning solid principles using c#
Object Oriented Design SOLID Principles
Software Design principles
SOLID Principles
An ultimate guide to SOLID Principles, developers must know.
DesignPrinciples-and-DesignPatterns
android principle.pptx
Becoming a better developer by using the SOLID design principles
S.O.L.I.D. principles of software development
L22 Design Principles
How to Master Development's Solid Principles | Tutort Academy
Solid principles
SOLID Principles in OOPS ooooooooo.pptx
Soild principles
Object Oriented, Design patterns and data modelling worshop
Solid Principle
SOLID Design Principle
From Good to SOLID: How to become a better PHP developer
Ad

More from Dhaval Shah (7)

PPTX
JVM memory management & Diagnostics
PPTX
Transaction boundaries in Microservice Architecture
PPTX
Anatomy of Test Driven Development
PPTX
Microservice Architecture
PPTX
Enterprise application performance - Understanding & Learnings
PPT
Spring Basics
PPT
Spring overview
JVM memory management & Diagnostics
Transaction boundaries in Microservice Architecture
Anatomy of Test Driven Development
Microservice Architecture
Enterprise application performance - Understanding & Learnings
Spring Basics
Spring overview

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
L1 - Introduction to python Backend.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
medical staffing services at VALiNTRY
PPTX
Transform Your Business with a Software ERP System
PPTX
Introduction to Artificial Intelligence
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Nekopoi APK 2025 free lastest update
PDF
AI in Product Development-omnex systems
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
2025 Textile ERP Trends: SAP, Odoo & Oracle
L1 - Introduction to python Backend.pptx
Design an Analysis of Algorithms I-SECS-1021-03
PTS Company Brochure 2025 (1).pdf.......
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
medical staffing services at VALiNTRY
Transform Your Business with a Software ERP System
Introduction to Artificial Intelligence
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo Companies in India – Driving Business Transformation.pdf
Nekopoi APK 2025 free lastest update
AI in Product Development-omnex systems
VVF-Customer-Presentation2025-Ver1.9.pptx
ManageIQ - Sprint 268 Review - Slide Deck
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Navsoft: AI-Powered Business Solutions & Custom Software Development

OO design principles & heuristics