SlideShare a Scribd company logo
1 of 31
SOLID Principles
Presented by Mónica Rodrigues
January 24rd, 2017
Contents ➢ What is SOLID
➢ Single responsibility Principle
➢ Open/Closed Principle
➢ Liskov Substitution Principle
➢ Interface Segregation Principle
➢ Dependency Inversion Principle
Who am I?
Mónica Rodrigues
Degree in Computer Science Engineer at ISEL
Software engineer since 2009
Keywords: Web Applications, ASP.NET MVC, ASP.NET Web API, REST,
Javascript, Angular, Best practices, Design patterns, SQL Server and
much more..
What is SOLID?
S
SRP
Single
Responsibility
Principle
O
OCP
Open/Closed
Principle
L
LSP
Liskovs
Substitution
Principle
I
ISP
Interface
Segregation
Principle
D
DIP
Dependency
Inversion
Principle
“A class should have one and
only one reason to change”
Single Responsibility Principle
Single Responsibility Principle
Business logic
Persistence
There are two
responsibilities
Single Responsibility Principle
How to solve this?
Single Responsibility Principle
Just create two different
classes
Open/Closed Principle
“Software entities should be
open for extension, but
closed for modification.”
Open/Closed Principle
Humm...and if I need to
add a new payment type?
You need to modificate
this class.
Open/Closed Principle
open for
extension
close for
modification
Liskov Substitution Principle
“Let q(x) be a property provable about
objects x of type T. Then q(y) should
be provable for objects y of type S
where S is a subtype of T”
What do you say?
Liskov Substitution Principle
“A subclass should behave in such a
way that it will not cause problems
when used instead of the
superclass.”
Liskov Substitution Principle
Liskov Substitution Principle
Much better
Interface Segregation Principle
“Clients should not be forced
to depend upon interfaces
that they don't use”
Interface Segregation Principle
Interface Segregation Principle
WHY?????
I don’t need you!!
Interface Segregation Principle
How to solve this?
Interface Segregation Principle
You need to create
two interfaces
Interface Segregation Principle
Dependency Inversion Principle
“High-level modules should not
depend on low-level modules. Both
should depend on abstractions.”
“Abstractions should not depend upon
details. Details should depend upon
abstractions.”
Dependency Inversion Principle
And if I need to send a
notification by SMS?
You need to change this.
Dependency Inversion Principle
So, I create an
interface and now?
Dependency Inversion Principle
Dependency Inversion Principle
Constructor injection:
Dependency Inversion Principle
Property injection:
Dependency Inversion Principle
Method injection:
Keep in mind
DRY - Don’t repeat yourself
+
SLAP - Single layer abstraction principle
+
SOLID
BEST DEVELOPER
Enjoy code and
Keep it simple!
Thank you

More Related Content

What's hot

Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID PrinciplesGanesh Samarthyam
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design PrinciplesSamuel Breed
 
Design principles - SOLID
Design principles - SOLIDDesign principles - SOLID
Design principles - SOLIDPranalee Rokde
 
Single Responsibility Principle
Single Responsibility PrincipleSingle Responsibility Principle
Single Responsibility PrincipleEyal Golan
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
SOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principlesSOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principlesSergey Karpushin
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net coreSam Nasr, MCSA, MVP
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentationAhasanul Kalam Akib
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesBruno Bossola
 
Design Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codeDesign Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codePaulo Gandra de Sousa
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean ArchitectureRoc Boronat
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and SpringVMware Tanzu
 

What's hot (20)

Introduction to SOLID Principles
Introduction to SOLID PrinciplesIntroduction to SOLID Principles
Introduction to SOLID Principles
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
Design principles - SOLID
Design principles - SOLIDDesign principles - SOLID
Design principles - SOLID
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
SOLID
SOLIDSOLID
SOLID
 
Single Responsibility Principle
Single Responsibility PrincipleSingle Responsibility Principle
Single Responsibility Principle
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
SOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principlesSOLID, DRY, SLAP design principles
SOLID, DRY, SLAP design principles
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Dependency injection presentation
Dependency injection presentationDependency injection presentation
Dependency injection presentation
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
 
Design Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID codeDesign Patterns: From STUPID to SOLID code
Design Patterns: From STUPID to SOLID code
 
Introducing Clean Architecture
Introducing Clean ArchitectureIntroducing Clean Architecture
Introducing Clean Architecture
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Testing with JUnit 5 and Spring
Testing with JUnit 5 and SpringTesting with JUnit 5 and Spring
Testing with JUnit 5 and Spring
 

Similar to Solid principles

SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-PresentQuang Nguyen
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPChihyang Li
 
Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...Anuradha Bandara
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principlesrainynovember12
 
Software Design Principles (SOLID)
Software Design Principles (SOLID)Software Design Principles (SOLID)
Software Design Principles (SOLID)ASIMYILDIZ
 
CodeCamp Iasi 10 march 2012 - Scratching-SOLID
CodeCamp Iasi 10 march 2012 - Scratching-SOLIDCodeCamp Iasi 10 march 2012 - Scratching-SOLID
CodeCamp Iasi 10 march 2012 - Scratching-SOLIDCodecamp Romania
 
Solid design principles
Solid design principlesSolid design principles
Solid design principlesMahmoud Asadi
 
S.O.L.I.D. principles of software development
S.O.L.I.D. principles of software developmentS.O.L.I.D. principles of software development
S.O.L.I.D. principles of software developmentAmanSoni129
 
Solid principles
Solid principlesSolid principles
Solid principlesViet Vu
 
Birth of a developer
Birth of a developerBirth of a developer
Birth of a developerPiyush Rahate
 
Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patternsPrabhakar Sharma
 
Is your code solid
Is your code solidIs your code solid
Is your code solidNathan Gloyn
 
Solid-Principles
Solid-PrinciplesSolid-Principles
Solid-PrinciplesAniket G
 

Similar to Solid principles (20)

SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISP
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
 
Software Design Principles (SOLID)
Software Design Principles (SOLID)Software Design Principles (SOLID)
Software Design Principles (SOLID)
 
CodeCamp Iasi 10 march 2012 - Scratching-SOLID
CodeCamp Iasi 10 march 2012 - Scratching-SOLIDCodeCamp Iasi 10 march 2012 - Scratching-SOLID
CodeCamp Iasi 10 march 2012 - Scratching-SOLID
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Solid design principles
Solid design principlesSolid design principles
Solid design principles
 
Solid principle
Solid principleSolid principle
Solid principle
 
S.O.L.I.D. principles of software development
S.O.L.I.D. principles of software developmentS.O.L.I.D. principles of software development
S.O.L.I.D. principles of software development
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Birth of a developer
Birth of a developerBirth of a developer
Birth of a developer
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Solid
SolidSolid
Solid
 
Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
 
Solid
SolidSolid
Solid
 
Is your code solid
Is your code solidIs your code solid
Is your code solid
 
Solid-Principles
Solid-PrinciplesSolid-Principles
Solid-Principles
 

More from Monica Rodrigues

More from Monica Rodrigues (6)

Iseltech17 - Single Page Applications
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page Applications
 
Relax, it's spa time
Relax, it's spa timeRelax, it's spa time
Relax, it's spa time
 
Como tudo começou
Como tudo começouComo tudo começou
Como tudo começou
 
The Power Of SPA - ISCTE
The Power Of SPA - ISCTEThe Power Of SPA - ISCTE
The Power Of SPA - ISCTE
 
The power of spa
The power of spaThe power of spa
The power of spa
 
Modelos Mentais em 10 minutos
Modelos Mentais em 10 minutosModelos Mentais em 10 minutos
Modelos Mentais em 10 minutos
 

Recently uploaded

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 

Recently uploaded (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 

Solid principles