SlideShare a Scribd company logo
Object Oriented
Design Heuristics
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Object Oriented Design Heuristics
■ Heuristics are techniques used for solving a problem
■ Coding and designing are different skills
■ Design principles are complicated and difficult to implement but design heuristics
are easier to learn and apply
■ Design heuristics are simple rules of thumb which help us avoid design pitfalls
– Heuristics help and identify where design can be improved
– Heuristics are not hard and fast rules
– Not all heuristics work together
– Some heuristics are opposite to each other
– There are always trade-offs in design depending on which heuristics are applied
– Sometimes heuristics are ignored in designs that are considered good
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Classes and Objects
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Classes and Objects
■ Hide data
– All data should be hidden within its class
■ No dependence on clients
– Users of a class must be dependent on its public interface, but a class should not
be dependent on its users
■ Minimize methods
– Minimize the number of messages in the protocol of a class
■ Minimal public interface
– Implement a minimal public interface which all classes understand
■ Avoid interface clutter
– Do not clutter the public interface of a class with things that users of that class are
not able to use or are not interested in using
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Classes and Objects
■ Minimize classes interdependencies
– A class should only use operations in the public interface of another class or have
nothing to do with that class
■ One key abstraction
– A class should capture one and only one key abstraction
■ Group related data and behavior
– Keep related data and behavior in one place
■ Separate related data and behavior
– Spin off non-related information into another class
■ Classes vs roles
– Be sure the abstractions you model are classes and not the roles objects play
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Topologies of Procedure vs Object
Oriented Applications
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Procedure vs Object Oriented Applications
■ Distribute system uniformly
– Distribute system intelligence horizontally as uniformly as possible, that is, the top-
level classes in a design should share the work uniformly
■ Avoid God classes
– Do not create god classes/objects (classes that control all other classes). Be very
suspicious of classes whose name contains Driver, Manager, System, Sub System
■ Avoid many accessors
– Beware of classes that have many accessor methods defined in their public
interface. May imply that data and behavior is not being kept at the same place
■ Avoid non-communicating behavior
– Beware of classes which have too much non-communicating behavior, i.e. methods
which operate on a proper subset of the data members of a class
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Relationships between Classes &
Objects
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Relationships between Classes & Objects
■ Minimize class collaborations
– Minimize the number of classes with which another class collaborates
■ Minimize message collaborations
– Minimize the number of message sends between a class and its collaborator
■ Containment rule
– If a class contains objects of another class, then the containing class should be
sending messages to the contained objects
■ Avoid contained objects relationships
– Objects which share lexical scope, i.e. those contained in the same containing
class, should not have uses relationships between them
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
The Inheritance Relationship
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Inheritance Relationship
■ Inheritance for specialization
– Inheritance should only be used to model a specialization hierarchy
■ Dependency inversion rule
– Derived classes must have knowledge of their base class by definition, but base
classes should not know anything about their derived classes
■ Common data class
– If two or more classes only share common data (no common behavior) then that
common data should be placed in a class which will be contained by each sharing
class
■ Common base class
– If two or more classes have common data and behavior (i.e. methods) then those
classes should each inherit from a common base class which captures those data
and methods
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
The Association Relationship
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Association Relationship
■ Containment vs association
– When given a choice in an object-oriented design between a containment
relationship and an association relationship, choose the containment relationship
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
Reference
■ Object Oriented Design Heuristics by Arthur Riel, Addison-Wesley, 1996
FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY

More Related Content

PDF
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
PDF
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
PDF
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
PDF
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
PDF
Coursera matlab 2015
PDF
Coursera matlab 2015
PDF
Tyeagins Resume
PDF
Statement of Accomplishment-MATLAB_VANDERBILT UNIVERSITY
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
1-Introduction to Software Engineering (Object Oriented Software Engineering ...
Coursera matlab 2015
Coursera matlab 2015
Tyeagins Resume
Statement of Accomplishment-MATLAB_VANDERBILT UNIVERSITY

Viewers also liked (20)

PDF
6-Animation in Game (Game Development - UMT Spring 2017/2018)
PDF
Visual Design with Data
PDF
How to Become a Thought Leader in Your Niche
PDF
Object-Oriented Design Heuristics
PDF
Software Engineering with Objects (M363) Final Revision By Kuwait10
PDF
3-Graphics in Game (Game Development - UMT Spring 2017/2018)
PPT
Function oriented design
PPT
OOP in Java
PDF
281113 master i skoleledelse
PDF
Example presentation Bas van den Beld
PPTX
Example Presentation Design
PDF
6 Things to Get Resumes Noticed
PPTX
Roxhens
PPT
Example Presentation Intro2gd
PPTX
Our tastes - Alba and Isabela
PDF
Experiences and Challenges in the Transport Integrated Net of Curitiba and th...
PPTX
PPT
Adding Power to Your PowerPoint
PPTX
Scientific Method - Portfolio Presentation Example
PPTX
Maaz
6-Animation in Game (Game Development - UMT Spring 2017/2018)
Visual Design with Data
How to Become a Thought Leader in Your Niche
Object-Oriented Design Heuristics
Software Engineering with Objects (M363) Final Revision By Kuwait10
3-Graphics in Game (Game Development - UMT Spring 2017/2018)
Function oriented design
OOP in Java
281113 master i skoleledelse
Example presentation Bas van den Beld
Example Presentation Design
6 Things to Get Resumes Noticed
Roxhens
Example Presentation Intro2gd
Our tastes - Alba and Isabela
Experiences and Challenges in the Transport Integrated Net of Curitiba and th...
Adding Power to Your PowerPoint
Scientific Method - Portfolio Presentation Example
Maaz
Ad

Similar to 4-Object Oriented Design Heuristics (Object Oriented Software Engineering - BNU Spring 2017) (20)

PPT
Object Oriented Design
PPT
Object Oriented Design
PDF
Object oriented software engineering concepts
PPT
AI_Module_2_Engineering_Computer_Science.ppt
PPT
Lecture01
PPTX
Object Oriented Analysis and Design - OOAD
PPTX
Software Engineering and Project Management - Introduction, Modeling Concepts...
PPT
Ooad ch 2
PPT
Lecture#01, object orientation
PPTX
SAD02 - Object Orientation
PPTX
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
PPT
chapter 5 Objectdesign.ppt
PDF
10 Modeling Object and Classes.pdf Software
PPTX
Introduction
PPT
Software Engineering Lec5 oop-uml-i
PPT
Ooad ch 1_2
PPTX
Itp oo mand-d
PPT
Unit 1( modelling concepts & class modeling)
PPTX
CPP16 - Object Design
PPTX
CPP Object Oriented Concepts(OOPS).pptx
Object Oriented Design
Object Oriented Design
Object oriented software engineering concepts
AI_Module_2_Engineering_Computer_Science.ppt
Lecture01
Object Oriented Analysis and Design - OOAD
Software Engineering and Project Management - Introduction, Modeling Concepts...
Ooad ch 2
Lecture#01, object orientation
SAD02 - Object Orientation
1a-OO-Basics.pptx lạoanfanfanfjasnfjnfkaskfklas
chapter 5 Objectdesign.ppt
10 Modeling Object and Classes.pdf Software
Introduction
Software Engineering Lec5 oop-uml-i
Ooad ch 1_2
Itp oo mand-d
Unit 1( modelling concepts & class modeling)
CPP16 - Object Design
CPP Object Oriented Concepts(OOPS).pptx
Ad

More from Hafiz Ammar Siddiqui (10)

PDF
4-Game Physics (Game Design and Development)
PDF
3-Game Graphics (Game Design and Development)
PDF
2-Game Design (Game Design and Development)
PDF
1-Introduction (Game Design and Development)
PDF
9-Software Verification and Validation (Object Oriented Software Engineering ...
PDF
7-Refactoring (Object Oriented Software Engineering - BNU Spring 2017)
PDF
9-Game Design (Game Development - UMT Spring 2017/2018)
PDF
6-Software Design Reviews (Object Oriented Software Engineering - BNU Spring ...
PDF
5-Object Oriented Analysis (Object Oriented Software Engineering - BNU Spring...
PDF
1-Introduction (Game Development - UMT Spring 2017/2018)
4-Game Physics (Game Design and Development)
3-Game Graphics (Game Design and Development)
2-Game Design (Game Design and Development)
1-Introduction (Game Design and Development)
9-Software Verification and Validation (Object Oriented Software Engineering ...
7-Refactoring (Object Oriented Software Engineering - BNU Spring 2017)
9-Game Design (Game Development - UMT Spring 2017/2018)
6-Software Design Reviews (Object Oriented Software Engineering - BNU Spring ...
5-Object Oriented Analysis (Object Oriented Software Engineering - BNU Spring...
1-Introduction (Game Development - UMT Spring 2017/2018)

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Cell Types and Its function , kingdom of life
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Institutional Correction lecture only . . .
PDF
Complications of Minimal Access Surgery at WLH
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Basic Mud Logging Guide for educational purpose
PDF
Classroom Observation Tools for Teachers
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Supply Chain Operations Speaking Notes -ICLT Program
Cell Types and Its function , kingdom of life
O7-L3 Supply Chain Operations - ICLT Program
Institutional Correction lecture only . . .
Complications of Minimal Access Surgery at WLH
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Insiders guide to clinical Medicine.pdf
Microbial disease of the cardiovascular and lymphatic systems
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
102 student loan defaulters named and shamed – Is someone you know on the list?
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Basic Mud Logging Guide for educational purpose
Classroom Observation Tools for Teachers
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Final Presentation General Medicine 03-08-2024.pptx

4-Object Oriented Design Heuristics (Object Oriented Software Engineering - BNU Spring 2017)

  • 1. Object Oriented Design Heuristics FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 2. Object Oriented Design Heuristics ■ Heuristics are techniques used for solving a problem ■ Coding and designing are different skills ■ Design principles are complicated and difficult to implement but design heuristics are easier to learn and apply ■ Design heuristics are simple rules of thumb which help us avoid design pitfalls – Heuristics help and identify where design can be improved – Heuristics are not hard and fast rules – Not all heuristics work together – Some heuristics are opposite to each other – There are always trade-offs in design depending on which heuristics are applied – Sometimes heuristics are ignored in designs that are considered good FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 3. Classes and Objects FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 4. Classes and Objects ■ Hide data – All data should be hidden within its class ■ No dependence on clients – Users of a class must be dependent on its public interface, but a class should not be dependent on its users ■ Minimize methods – Minimize the number of messages in the protocol of a class ■ Minimal public interface – Implement a minimal public interface which all classes understand ■ Avoid interface clutter – Do not clutter the public interface of a class with things that users of that class are not able to use or are not interested in using FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 5. Classes and Objects ■ Minimize classes interdependencies – A class should only use operations in the public interface of another class or have nothing to do with that class ■ One key abstraction – A class should capture one and only one key abstraction ■ Group related data and behavior – Keep related data and behavior in one place ■ Separate related data and behavior – Spin off non-related information into another class ■ Classes vs roles – Be sure the abstractions you model are classes and not the roles objects play FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 6. Topologies of Procedure vs Object Oriented Applications FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 7. Procedure vs Object Oriented Applications ■ Distribute system uniformly – Distribute system intelligence horizontally as uniformly as possible, that is, the top- level classes in a design should share the work uniformly ■ Avoid God classes – Do not create god classes/objects (classes that control all other classes). Be very suspicious of classes whose name contains Driver, Manager, System, Sub System ■ Avoid many accessors – Beware of classes that have many accessor methods defined in their public interface. May imply that data and behavior is not being kept at the same place ■ Avoid non-communicating behavior – Beware of classes which have too much non-communicating behavior, i.e. methods which operate on a proper subset of the data members of a class FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 8. Relationships between Classes & Objects FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 9. Relationships between Classes & Objects ■ Minimize class collaborations – Minimize the number of classes with which another class collaborates ■ Minimize message collaborations – Minimize the number of message sends between a class and its collaborator ■ Containment rule – If a class contains objects of another class, then the containing class should be sending messages to the contained objects ■ Avoid contained objects relationships – Objects which share lexical scope, i.e. those contained in the same containing class, should not have uses relationships between them FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 10. The Inheritance Relationship FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 11. Inheritance Relationship ■ Inheritance for specialization – Inheritance should only be used to model a specialization hierarchy ■ Dependency inversion rule – Derived classes must have knowledge of their base class by definition, but base classes should not know anything about their derived classes ■ Common data class – If two or more classes only share common data (no common behavior) then that common data should be placed in a class which will be contained by each sharing class ■ Common base class – If two or more classes have common data and behavior (i.e. methods) then those classes should each inherit from a common base class which captures those data and methods FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 12. The Association Relationship FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 13. Association Relationship ■ Containment vs association – When given a choice in an object-oriented design between a containment relationship and an association relationship, choose the containment relationship FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY
  • 14. Reference ■ Object Oriented Design Heuristics by Arthur Riel, Addison-Wesley, 1996 FROM: HAFIZ AMMAR SIDDIQUI – COURSE: OBJECT ORIENTED SOFTWARE ENGINEERING – INSTITUTE: BEACONHOUSE NATIONAL UNIVERSITY