0% found this document useful (0 votes)
63 views

Object Oriented Design: That's All!?

The document discusses object oriented design principles including: - Cohesion, which groups closely related items together, and coupling, which aims to minimize dependencies between classes. - The SOLID principles for class design: single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion. - Package cohesion principles like reuse/release equivalence, common reuse, and common closure for grouping related classes. - Package structure principles such as avoiding cyclic dependencies and keeping abstraction and stability low.

Uploaded by

ganeshskm
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Object Oriented Design: That's All!?

The document discusses object oriented design principles including: - Cohesion, which groups closely related items together, and coupling, which aims to minimize dependencies between classes. - The SOLID principles for class design: single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion. - Package cohesion principles like reuse/release equivalence, common reuse, and common closure for grouping related classes. - Package structure principles such as avoiding cyclic dependencies and keeping abstraction and stability low.

Uploaded by

ganeshskm
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Object Oriented Design

Thats All!?

Guru Dhevo Guru Sakshat


Bjarne Stroustrup, creator of C++

Bad Design
Rigid
Fragile
Immobile

OOD
Mid 90-ties; many authors/papers
Class design
Package Cohesion
Package Structure

Cohesion & Coupling


Cohesion-love birds together
Coupling-many cages; but just 2 in a cage
Increase Cohesion
Decrease Coupling

Class design SOLID Book-ish


Single Responsibility-one reason alone to change a class
Open-Closed- open for extension closed for modification
Liskov Substitution-derived in place for base should work
Interface Segregation- small and cohesive
Dependency Inversion- interfaces + abstraction

Single Responsibility Principle


Simple
Easy to understand
Easy to unit test
Less/no duplication of logic

Open-Closed Principle
Change alone is Constant
Reusability
Maintainability
Abstraction is GOD!
Dependency on public, global variables is not so good
Runtime-type-identification and abstraction go hand-in-hand

Liskov Substitution Principle


Derived should be as good as base
Extrinsic public behaviour is what object users depend on
Favour composition over inheritance
Design by contract

Interface Segregation Principle


Apply SRP on interfaces
Slim interfaces
No use with NotImplemented

Dependency Inversion Principle


High/Low level classes should not have direct dependency
All details have to be abstracted
Layering

Package Cohesion RCC Book-ish


Reuse/Release Equivalence- the smallest granule of candidates that can be
reused should be released independently
Common Reuse- the reuse buddies go together; put them in the box
Common Closure- reuse candidates need toothbrush, lets package
toothbrush along

Package Structure/Coupling ASS Book-ish


Acyclic Dependencies- marrying relatives banned
Stable Dependencies-depend on elders; I=(Ce / (Ca+Ce))
Closer to 0 is stable

Stable Abstraction-MaxS=MaxA; MinS=Concrete; A=Ac/Tc


Closer to 0 is concrete

You might also like