SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
Boutique product development company
It is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
SOLID Principles of OO Design
Waleed Bin Dawood | Software Engineer

Boutique product development company

It is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
"Any fool can write code that a computer can
understand. Good programmers write code that humans
can understand"
Martin Fowler

SOLID Principles of Object Oriented Design
●
●
●
●

Software design
What makes a design good or bad ?
Design/Code Smells
SOLID Principles

Waleed Bin Dawood | Software Engineer
SOLID Principles

What is software design ?

•
•
•
•

The source code is the design
UML diagram represents part of a design
Software design process includes coding, testing,
refactoring…
The programmer is the actual software designer.

Waleed Bin Dawood | Software Engineer
SOLID Principles

Why do we need a good design ?

•
•
•

To deliver fast
To manage change easily
To deal with complexity

Waleed Bin Dawood | Software Engineer
SOLID Principles

How to identify a bad design ?

“In my BillG review meeting, the whole
reporting hierarchy was there...and a
person...whose whole job during the
meeting was to keep an accurate
count of how many times Bill said the F
word. The lower the f***-count, the
better.”
-- Joel Spolsky, My First BillG Review

But may be we need some better criteria :)

Waleed Bin Dawood | Software Engineer
SOLID Principles

How to identify a bad design ?

Design/Code Smells
● Rigidity - The design is hard to change
● Fragility - The design is easy to break
● Immobility - The design is hard to reuse
● Viscosity - It is hard to do the right thing

Waleed Bin Dawood | Software Engineer
SOLID Principles

Good design

What are the characteristics of a good design ?
● High Cohesion
● Low Coupling

How to achieve a good design ?
Follow programming practices of your
language/framework
Follow OO design principles
Use design patterns

•
•
•

Waleed Bin Dawood | Software Engineer
SOLID Principles

Let’s go SOLID

Initial

Stands for
(acronym)

Concept

S

SRP

Single responsibility principle
a class should have only a single responsibility.

O

OCP

Open/closed principle
“software entities … should be open for extension, but closed for modification”.

L

LSP

Liskov substitution principle
“objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program”.

I

ISP

Interface segregation principle
“many client-specific interfaces are better than one general-purpose interface.”

D

DIP

Dependency inversion principle
one should “Depend upon Abstractions. Do not depend upon concretions.”

Waleed Bin Dawood | Software Engineer
SOLID Principles

Single Responsibility Principle

•
•
•
•

“There should never be more than one reason for a class
to change.” -- Robert Martin, SRP paper
Easier : A class should concentrate on doing one thing
and one thing only
It give you high cohesion
It’s often hard to identify different responsibilities

Waleed Bin Dawood | Software Engineer
SOLID Principles

Single Responsibility Principle

•

•

Is SRP violated here ?

Two responsibilities:
o Connection management
o Data Communication

Waleed Bin Dawood | Software Engineer
SOLID Principles

Single Responsibility Principle

•

•

Solution :

Two responsibilities:
o Connection management
o Data Communication

Waleed Bin Dawood | Software Engineer
SOLID Principles

Open/Closed Principle

•
•
•

“Software entities should be open for extension, but
closed for modification.” -- Robert Martin paraphrasing
Bertrand Meyer, OCP Paper
Easier : you should be able to extend the behaviour of a
module without changing it
Abstraction is the key

Waleed Bin Dawood | Software Engineer
SOLID Principles

Open/Closed Principle

•

Is OCP violated here ?

Waleed Bin Dawood | Software Engineer
SOLID Principles

Open/Closed Principle

•

Solution:

Waleed Bin Dawood | Software Engineer
SOLID Principles

Liskov Substitution Principle

•
•

“Functions that use pointers or references to base
classes must be able to use objects of derived classes
without knowing it.” -- Robert Martin, LSP Paper
Easier : Subclasses should behave nicely when used in
place of their parent class

Waleed Bin Dawood | Software Engineer
SOLID Principles

Liskov Substitution Principle

•
•
•
•

How would you model the relationship between a square
and a rectangle ?
Should the square class extends rectangle ?
Many of you would say “yes” or “why not”. Square is a
kind of Rectangle after all. An obvious IS-A relationship

Issues in this Approach:
o Square has unnecessary attribute ‘width’
o What happens when we want to calculate area ?
o What happens if the client code is assuming height
and width to be independent of each other

Waleed Bin Dawood | Software Engineer
SOLID Principles

Dependency Inversion Principle

•
•

“A. High level modules should not depend upon low level
modules. Both should depend upon abstractions.
B. Abstractions should not depend upon details. Details
should depend upon abstractions.”-- Robert Martin, DIP
paper
Easier:
o Use lot of interfaces (program to interface)
o Use abstractions

Waleed Bin Dawood | Software Engineer
SOLID Principles

Interface Segregation Principle

•
•

“Clients should not be forced interfaces that they do not
use.”-- Robert Martin, ISP paper
Easier : avoid fat interfaces (cohesion)

Waleed Bin Dawood | Software Engineer
Human Computer Interaction

Thank you for your time

If you have any questions,
please ask now or forever
hold your peace

Waleed Bin Dawood | Software Engineer
Human Computer Interaction

References

•
•
•
•
•
•
•

http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
http://www.slideshare.net/bbossola/geecon09-solid
http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
http://www.slideshare.net/intellizhang/the-oo-design-principles
http://www.slideshare.net/enbohm/solid-design-principles-9016117
http://www.oodesign.com/design-principles.html
http://objectmentor.com/resources/publishedArticles.html

Waleed Bin Dawood | Software Engineer

Mais conteúdo relacionado

Mais procurados

Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...
Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...
Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...David Rosenblum
 
Cloud computing lab experiments
Cloud computing lab experimentsCloud computing lab experiments
Cloud computing lab experimentsrichendraravi
 
MLOps by Sasha Rosenbaum
MLOps by Sasha RosenbaumMLOps by Sasha Rosenbaum
MLOps by Sasha RosenbaumSasha Rosenbaum
 
SOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureSOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureMohamed Galal
 
Load balancing in cloud computing.pptx
Load balancing in cloud computing.pptxLoad balancing in cloud computing.pptx
Load balancing in cloud computing.pptxHitesh Mohapatra
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)WSO2
 
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Mazhar Ishaq Khokhar
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelmohamed khalaf alla mohamedain
 
Microservices Best Practices
Microservices Best PracticesMicroservices Best Practices
Microservices Best PracticesAliasgar Muchhala
 
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya RaghunathanCamunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathancamunda services GmbH
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice ArchitectureNguyen Tung
 
SAP Cloud Platform Integration L2 Deck 2017Q4
SAP Cloud Platform Integration L2 Deck 2017Q4SAP Cloud Platform Integration L2 Deck 2017Q4
SAP Cloud Platform Integration L2 Deck 2017Q4SAP Cloud Platform
 

Mais procurados (20)

Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...
Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...
Scalability in Software Systems Engineering: The Good, the Bad, and the Ugly ...
 
Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
Cloud computing lab experiments
Cloud computing lab experimentsCloud computing lab experiments
Cloud computing lab experiments
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
MLOps by Sasha Rosenbaum
MLOps by Sasha RosenbaumMLOps by Sasha Rosenbaum
MLOps by Sasha Rosenbaum
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
 
SOLID Principles and The Clean Architecture
SOLID Principles and The Clean ArchitectureSOLID Principles and The Clean Architecture
SOLID Principles and The Clean Architecture
 
Cloud computing What Why How
Cloud computing What Why HowCloud computing What Why How
Cloud computing What Why How
 
Load balancing in cloud computing.pptx
Load balancing in cloud computing.pptxLoad balancing in cloud computing.pptx
Load balancing in cloud computing.pptx
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)
 
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)
 
What is MLOps
What is MLOpsWhat is MLOps
What is MLOps
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Why Microservice
Why Microservice Why Microservice
Why Microservice
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Microservices Best Practices
Microservices Best PracticesMicroservices Best Practices
Microservices Best Practices
 
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya RaghunathanCamunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
SAP Cloud Platform Integration L2 Deck 2017Q4
SAP Cloud Platform Integration L2 Deck 2017Q4SAP Cloud Platform Integration L2 Deck 2017Q4
SAP Cloud Platform Integration L2 Deck 2017Q4
 

Destaque

SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignRiccardo Cardin
 
"SOLID" Object Oriented Design Principles
"SOLID" Object Oriented Design Principles"SOLID" Object Oriented Design Principles
"SOLID" Object Oriented Design PrinciplesSerhiy Oplakanets
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design PrinciplesSteve Zhang
 
Advanced Object-Oriented/SOLID Principles
Advanced Object-Oriented/SOLID PrinciplesAdvanced Object-Oriented/SOLID Principles
Advanced Object-Oriented/SOLID PrinciplesJon Kruger
 
S.O.L.I.D. Principles for Software Architects
S.O.L.I.D. Principles for Software ArchitectsS.O.L.I.D. Principles for Software Architects
S.O.L.I.D. Principles for Software ArchitectsRicardo Wilkins
 
The Solid Principles
The Solid PrinciplesThe Solid Principles
The Solid PrinciplesLuke Smith
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principlesrainynovember12
 
Principios de diseño de código orientado a objetos SOLID
Principios de diseño de código orientado a objetos SOLIDPrincipios de diseño de código orientado a objetos SOLID
Principios de diseño de código orientado a objetos SOLIDLuis Alexander Aldazabal Gil
 
Software design principles
Software design principlesSoftware design principles
Software design principlesRitesh Singh
 
Single Responsibility Principle
Single Responsibility PrincipleSingle Responsibility Principle
Single Responsibility PrincipleEyal Golan
 
STL ALGORITHMS
STL ALGORITHMSSTL ALGORITHMS
STL ALGORITHMSfawzmasood
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingfarhan amjad
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ AdvancedVivek Das
 
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...Complement Verb
 

Destaque (20)

SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented Design
 
"SOLID" Object Oriented Design Principles
"SOLID" Object Oriented Design Principles"SOLID" Object Oriented Design Principles
"SOLID" Object Oriented Design Principles
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design Principles
 
Advanced Object-Oriented/SOLID Principles
Advanced Object-Oriented/SOLID PrinciplesAdvanced Object-Oriented/SOLID Principles
Advanced Object-Oriented/SOLID Principles
 
S.O.L.I.D. Principles for Software Architects
S.O.L.I.D. Principles for Software ArchitectsS.O.L.I.D. Principles for Software Architects
S.O.L.I.D. Principles for Software Architects
 
The Solid Principles
The Solid PrinciplesThe Solid Principles
The Solid Principles
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
 
Principios de diseño de código orientado a objetos SOLID
Principios de diseño de código orientado a objetos SOLIDPrincipios de diseño de código orientado a objetos SOLID
Principios de diseño de código orientado a objetos SOLID
 
Principios SOLID
Principios SOLIDPrincipios SOLID
Principios SOLID
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
Single Responsibility Principle
Single Responsibility PrincipleSingle Responsibility Principle
Single Responsibility Principle
 
Distributed Systems Design
Distributed Systems DesignDistributed Systems Design
Distributed Systems Design
 
The Style of C++ 11
The Style of C++ 11The Style of C++ 11
The Style of C++ 11
 
Idiomatic C++
Idiomatic C++Idiomatic C++
Idiomatic C++
 
STL ALGORITHMS
STL ALGORITHMSSTL ALGORITHMS
STL ALGORITHMS
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
C++ Advanced
C++ AdvancedC++ Advanced
C++ Advanced
 
Web Service Basics and NWS Setup
Web Service  Basics and NWS SetupWeb Service  Basics and NWS Setup
Web Service Basics and NWS Setup
 
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...
Bjarne Stroustrup - The Essence of C++: With Examples in C++84, C++98, C++11,...
 

Semelhante a Solid principles of oo design

SOLID design principles in Ruby
SOLID design principles in RubySOLID design principles in Ruby
SOLID design principles in RubyAnil Wadghule
 
Is your code SOLID enough?
 Is your code SOLID enough? Is your code SOLID enough?
Is your code SOLID enough?SARCCOM
 
bGenius kennissessie_20120510
bGenius kennissessie_20120510bGenius kennissessie_20120510
bGenius kennissessie_20120510bgenius
 
Refactoring to SOLID Code
Refactoring to SOLID CodeRefactoring to SOLID Code
Refactoring to SOLID CodeAdil Mughal
 
Object Oriented Design Principles
Object Oriented Design PrinciplesObject Oriented Design Principles
Object Oriented Design PrinciplesThang Tran Duc
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseKevin Mas Ruiz
 
It is a sunny day
It is a sunny dayIt is a sunny day
It is a sunny daybcoder
 
Friday final test
Friday final testFriday final test
Friday final testbcoder
 
Use Design Principle to Improve code quality
Use Design Principle to Improve code qualityUse Design Principle to Improve code quality
Use Design Principle to Improve code qualityHebin Wei
 
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation Slides
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation SlidesDevops On Cloud Powerpoint Template Slides Powerpoint Presentation Slides
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation SlidesSlideTeam
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionKnoldus Inc.
 
Solid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile developmentSolid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile developmentSimon Gould
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedAlexander Makarov
 
Software Engineering - Trends & Industry Practices
Software Engineering - Trends & Industry PracticesSoftware Engineering - Trends & Industry Practices
Software Engineering - Trends & Industry PracticesAlfred Jett Grandeza
 
RSpec & Rails, an introduction
RSpec & Rails, an introductionRSpec & Rails, an introduction
RSpec & Rails, an introductionUtku Kaynar
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesQamar Abbas
 
From Sandbox to Production by Vadym Fedorov
From Sandbox to Production by Vadym FedorovFrom Sandbox to Production by Vadym Fedorov
From Sandbox to Production by Vadym FedorovSoftServe
 
DevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDaysJKT
 

Semelhante a Solid principles of oo design (20)

SOLID design principles in Ruby
SOLID design principles in RubySOLID design principles in Ruby
SOLID design principles in Ruby
 
Is your code SOLID enough?
 Is your code SOLID enough? Is your code SOLID enough?
Is your code SOLID enough?
 
Design Principles
Design PrinciplesDesign Principles
Design Principles
 
bGenius kennissessie_20120510
bGenius kennissessie_20120510bGenius kennissessie_20120510
bGenius kennissessie_20120510
 
Refactoring to SOLID Code
Refactoring to SOLID CodeRefactoring to SOLID Code
Refactoring to SOLID Code
 
Object Oriented Design Principles
Object Oriented Design PrinciplesObject Oriented Design Principles
Object Oriented Design Principles
 
Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
 
It is a sunny day
It is a sunny dayIt is a sunny day
It is a sunny day
 
Friday final test
Friday final testFriday final test
Friday final test
 
Use Design Principle to Improve code quality
Use Design Principle to Improve code qualityUse Design Principle to Improve code quality
Use Design Principle to Improve code quality
 
android principle.pptx
android principle.pptxandroid principle.pptx
android principle.pptx
 
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation Slides
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation SlidesDevops On Cloud Powerpoint Template Slides Powerpoint Presentation Slides
Devops On Cloud Powerpoint Template Slides Powerpoint Presentation Slides
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
 
Solid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile developmentSolid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile development
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 
Software Engineering - Trends & Industry Practices
Software Engineering - Trends & Industry PracticesSoftware Engineering - Trends & Industry Practices
Software Engineering - Trends & Industry Practices
 
RSpec & Rails, an introduction
RSpec & Rails, an introductionRSpec & Rails, an introduction
RSpec & Rails, an introduction
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
From Sandbox to Production by Vadym Fedorov
From Sandbox to Production by Vadym FedorovFrom Sandbox to Production by Vadym Fedorov
From Sandbox to Production by Vadym Fedorov
 
DevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDays Jakarta Igites
DevOpsDays Jakarta Igites
 

Mais de Confiz

Agile training workshop
Agile training workshopAgile training workshop
Agile training workshopConfiz
 
Web services with laravel
Web services with laravelWeb services with laravel
Web services with laravelConfiz
 
DMAIC-Six sigma process Improvement Approach
DMAIC-Six sigma process Improvement ApproachDMAIC-Six sigma process Improvement Approach
DMAIC-Six sigma process Improvement ApproachConfiz
 
What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.Confiz
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and typesConfiz
 
Sqa, test scenarios and test cases
Sqa, test scenarios and test casesSqa, test scenarios and test cases
Sqa, test scenarios and test casesConfiz
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
Security testing presentation
Security testing presentationSecurity testing presentation
Security testing presentationConfiz
 
Ts seo t ech session
Ts   seo t ech sessionTs   seo t ech session
Ts seo t ech sessionConfiz
 
Learning as a creative professional
Learning as a creative professionalLearning as a creative professional
Learning as a creative professionalConfiz
 
Learning as a creative professional
Learning as a creative professionalLearning as a creative professional
Learning as a creative professionalConfiz
 
Ts archiving
Ts   archivingTs   archiving
Ts archivingConfiz
 
Advance text rendering in i os
Advance text rendering in i osAdvance text rendering in i os
Advance text rendering in i osConfiz
 
Ts threading
Ts   threadingTs   threading
Ts threadingConfiz
 
Ts android supporting multiple screen
Ts   android supporting multiple screenTs   android supporting multiple screen
Ts android supporting multiple screenConfiz
 
Ts drupal6 module development v0.2
Ts   drupal6 module development v0.2Ts   drupal6 module development v0.2
Ts drupal6 module development v0.2Confiz
 
Photoshop manners
Photoshop mannersPhotoshop manners
Photoshop mannersConfiz
 
Monkey talk
Monkey talkMonkey talk
Monkey talkConfiz
 
An insight to microsoft platform
An insight to microsoft platformAn insight to microsoft platform
An insight to microsoft platformConfiz
 
Ts branching over the top
Ts   branching over the topTs   branching over the top
Ts branching over the topConfiz
 

Mais de Confiz (20)

Agile training workshop
Agile training workshopAgile training workshop
Agile training workshop
 
Web services with laravel
Web services with laravelWeb services with laravel
Web services with laravel
 
DMAIC-Six sigma process Improvement Approach
DMAIC-Six sigma process Improvement ApproachDMAIC-Six sigma process Improvement Approach
DMAIC-Six sigma process Improvement Approach
 
What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
Sqa, test scenarios and test cases
Sqa, test scenarios and test casesSqa, test scenarios and test cases
Sqa, test scenarios and test cases
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Security testing presentation
Security testing presentationSecurity testing presentation
Security testing presentation
 
Ts seo t ech session
Ts   seo t ech sessionTs   seo t ech session
Ts seo t ech session
 
Learning as a creative professional
Learning as a creative professionalLearning as a creative professional
Learning as a creative professional
 
Learning as a creative professional
Learning as a creative professionalLearning as a creative professional
Learning as a creative professional
 
Ts archiving
Ts   archivingTs   archiving
Ts archiving
 
Advance text rendering in i os
Advance text rendering in i osAdvance text rendering in i os
Advance text rendering in i os
 
Ts threading
Ts   threadingTs   threading
Ts threading
 
Ts android supporting multiple screen
Ts   android supporting multiple screenTs   android supporting multiple screen
Ts android supporting multiple screen
 
Ts drupal6 module development v0.2
Ts   drupal6 module development v0.2Ts   drupal6 module development v0.2
Ts drupal6 module development v0.2
 
Photoshop manners
Photoshop mannersPhotoshop manners
Photoshop manners
 
Monkey talk
Monkey talkMonkey talk
Monkey talk
 
An insight to microsoft platform
An insight to microsoft platformAn insight to microsoft platform
An insight to microsoft platform
 
Ts branching over the top
Ts   branching over the topTs   branching over the top
Ts branching over the top
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Solid principles of oo design

  • 1. Boutique product development company It is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
  • 2. SOLID Principles of OO Design Waleed Bin Dawood | Software Engineer Boutique product development company It is amazing what you can accomplish when you have a client-centric team to deliver outstanding products.
  • 3. "Any fool can write code that a computer can understand. Good programmers write code that humans can understand" Martin Fowler SOLID Principles of Object Oriented Design ● ● ● ● Software design What makes a design good or bad ? Design/Code Smells SOLID Principles Waleed Bin Dawood | Software Engineer
  • 4. SOLID Principles What is software design ? • • • • The source code is the design UML diagram represents part of a design Software design process includes coding, testing, refactoring… The programmer is the actual software designer. Waleed Bin Dawood | Software Engineer
  • 5. SOLID Principles Why do we need a good design ? • • • To deliver fast To manage change easily To deal with complexity Waleed Bin Dawood | Software Engineer
  • 6. SOLID Principles How to identify a bad design ? “In my BillG review meeting, the whole reporting hierarchy was there...and a person...whose whole job during the meeting was to keep an accurate count of how many times Bill said the F word. The lower the f***-count, the better.” -- Joel Spolsky, My First BillG Review But may be we need some better criteria :) Waleed Bin Dawood | Software Engineer
  • 7. SOLID Principles How to identify a bad design ? Design/Code Smells ● Rigidity - The design is hard to change ● Fragility - The design is easy to break ● Immobility - The design is hard to reuse ● Viscosity - It is hard to do the right thing Waleed Bin Dawood | Software Engineer
  • 8. SOLID Principles Good design What are the characteristics of a good design ? ● High Cohesion ● Low Coupling How to achieve a good design ? Follow programming practices of your language/framework Follow OO design principles Use design patterns • • • Waleed Bin Dawood | Software Engineer
  • 9. SOLID Principles Let’s go SOLID Initial Stands for (acronym) Concept S SRP Single responsibility principle a class should have only a single responsibility. O OCP Open/closed principle “software entities … should be open for extension, but closed for modification”. L LSP Liskov substitution principle “objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program”. I ISP Interface segregation principle “many client-specific interfaces are better than one general-purpose interface.” D DIP Dependency inversion principle one should “Depend upon Abstractions. Do not depend upon concretions.” Waleed Bin Dawood | Software Engineer
  • 10. SOLID Principles Single Responsibility Principle • • • • “There should never be more than one reason for a class to change.” -- Robert Martin, SRP paper Easier : A class should concentrate on doing one thing and one thing only It give you high cohesion It’s often hard to identify different responsibilities Waleed Bin Dawood | Software Engineer
  • 11. SOLID Principles Single Responsibility Principle • • Is SRP violated here ? Two responsibilities: o Connection management o Data Communication Waleed Bin Dawood | Software Engineer
  • 12. SOLID Principles Single Responsibility Principle • • Solution : Two responsibilities: o Connection management o Data Communication Waleed Bin Dawood | Software Engineer
  • 13. SOLID Principles Open/Closed Principle • • • “Software entities should be open for extension, but closed for modification.” -- Robert Martin paraphrasing Bertrand Meyer, OCP Paper Easier : you should be able to extend the behaviour of a module without changing it Abstraction is the key Waleed Bin Dawood | Software Engineer
  • 14. SOLID Principles Open/Closed Principle • Is OCP violated here ? Waleed Bin Dawood | Software Engineer
  • 16. SOLID Principles Liskov Substitution Principle • • “Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.” -- Robert Martin, LSP Paper Easier : Subclasses should behave nicely when used in place of their parent class Waleed Bin Dawood | Software Engineer
  • 17. SOLID Principles Liskov Substitution Principle • • • • How would you model the relationship between a square and a rectangle ? Should the square class extends rectangle ? Many of you would say “yes” or “why not”. Square is a kind of Rectangle after all. An obvious IS-A relationship Issues in this Approach: o Square has unnecessary attribute ‘width’ o What happens when we want to calculate area ? o What happens if the client code is assuming height and width to be independent of each other Waleed Bin Dawood | Software Engineer
  • 18. SOLID Principles Dependency Inversion Principle • • “A. High level modules should not depend upon low level modules. Both should depend upon abstractions. B. Abstractions should not depend upon details. Details should depend upon abstractions.”-- Robert Martin, DIP paper Easier: o Use lot of interfaces (program to interface) o Use abstractions Waleed Bin Dawood | Software Engineer
  • 19. SOLID Principles Interface Segregation Principle • • “Clients should not be forced interfaces that they do not use.”-- Robert Martin, ISP paper Easier : avoid fat interfaces (cohesion) Waleed Bin Dawood | Software Engineer
  • 20. Human Computer Interaction Thank you for your time If you have any questions, please ask now or forever hold your peace Waleed Bin Dawood | Software Engineer