SlideShare una empresa de Scribd logo
1 de 28
SOLID
                          and Better Design
                          and Better Design


                                                                            Toni Tassani
                                                                            March 2013

Photo by Roy Higson. http://www.fotopedia.com/items/roytheboy-Q13G6ugLM0I
Writing Software is not hard

You spend more time
    Reading and Modifying it
Design Smells
1. Rigidity
2. Fragility
3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity

Photo by Elaine Adolfo http://www.fotopedia.com/items/flickr-469125880
Design Smells
1. Rigidity     The system is hard to change because
                every change forces many other
2. Fragility    changes to other parts of the system.

3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     Changes cause the system to break in
                places that have no conceptual
2. Fragility    relationship to the part that was changed.

3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     It is hard to disentangle the system into
                components that ca be reused in other
2. Fragility    systems.

3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     Doing things right is harder than doind
                things wrong.
2. Fragility
3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     The design contains infrastructure that
                adds no direct benefit.
2. Fragility
3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     The design contains repeating structures
                that could be unified under a single
2. Fragility    abstraction.

3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
Design Smells
1. Rigidity     It is hard to read and understand. It does
                not express its intent well.
2. Fragility
3. Immobility
4. Viscosity
5. Needless Complexity
6. Needless repetition
7. Opacity
• Cohesion
  – All responsibilites of a module should be
    related and focused.


• Coupling
  – How much a module depends upon others
S.O.L.I.D.

• Single Responsibility
• Open Closed
• Liskov Substitution
• Interface Segregation
• Dependency Inversion

Photo by Jean Christophe Prunet http://www.fotopedia.com/items/_avPIZmqM3w-vdSxZGLACsg
Single Responsibility Principle
• One class should have only one reason
  to change.
• One responsability, one reason to
  change
Open Closed Principle
• Open for extension
• Closed for modification

• Design modules to never change.
• A change should impact only one
  module.
• Abstraction
Liskov Substitution Principle
• If you use a class, you should be able
  to use its base class.
Interface Segregation Principle
• Clients should not be obliged to
  depend upon interfaces they not use
Dependency Injection Principle
• Higher level modules should not
  depend upon low level modules
4 rules of simple design
1. Runs all the tests
2. Contains no duplication
3. Expresses the intent of the
  programmer
4. Minimizes the number of classes and
  methods


 Kent Beck
Summary
Read More
References
• http://www.slideshare.net/JuanjoFuchs/solid-cmo-
  lo-aplico-a-mi-cdigo
• SOLID Development by Chris Deweese
  http://www.slideshare.net/cdeweese/solid-
  development
• SOLID Design Principles by Bruno Bossola
  http://www.slideshare.net/bbossola/geecon09-
  solid
• Solid Development Practices in Motivational
  Pictures
  http://lostechies.com/derickbailey/2009/02/11/soli
  d-development-principles-in-motivational-
  pictures/
Moltes Gràcies
(Thank you very much)




    Toni Tassani
    Toni Tassani
    @atassani
    http://alapamui.blogspot.com
    Barcelona -

Más contenido relacionado

Similar a SOLID and Better Design

User Interface Design- Module 2 Uid Process
User Interface Design- Module 2 Uid ProcessUser Interface Design- Module 2 Uid Process
User Interface Design- Module 2 Uid ProcessbrindaN
 
Agile design pattern
Agile design patternAgile design pattern
Agile design patternPoppy Martono
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design Darshan Ashpal
 
UNIT III Lecture-I.pptx
UNIT III Lecture-I.pptxUNIT III Lecture-I.pptx
UNIT III Lecture-I.pptxAmirEyni1
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programmingTim Mahy
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptxDr.Shweta
 
Design Thinking - Types of prototypes
Design Thinking - Types of prototypes Design Thinking - Types of prototypes
Design Thinking - Types of prototypes SwethaVijay10
 
Distributed Agile - Ten Guiding Principles
Distributed Agile - Ten Guiding PrinciplesDistributed Agile - Ten Guiding Principles
Distributed Agile - Ten Guiding PrinciplesRaja Bavani
 
Dealing with complexity and uncertainty in natural resource management and ot...
Dealing with complexity and uncertainty in natural resource management and ot...Dealing with complexity and uncertainty in natural resource management and ot...
Dealing with complexity and uncertainty in natural resource management and ot...ILRI
 

Similar a SOLID and Better Design (12)

User Interface Design- Module 2 Uid Process
User Interface Design- Module 2 Uid ProcessUser Interface Design- Module 2 Uid Process
User Interface Design- Module 2 Uid Process
 
Agile design pattern
Agile design patternAgile design pattern
Agile design pattern
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design
 
Design Principles.pdf
Design Principles.pdfDesign Principles.pdf
Design Principles.pdf
 
UNIT III Lecture-I.pptx
UNIT III Lecture-I.pptxUNIT III Lecture-I.pptx
UNIT III Lecture-I.pptx
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
 
Responsible innovation
Responsible innovationResponsible innovation
Responsible innovation
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptx
 
Design Thinking - Types of prototypes
Design Thinking - Types of prototypes Design Thinking - Types of prototypes
Design Thinking - Types of prototypes
 
Simple is hard
Simple is hardSimple is hard
Simple is hard
 
Distributed Agile - Ten Guiding Principles
Distributed Agile - Ten Guiding PrinciplesDistributed Agile - Ten Guiding Principles
Distributed Agile - Ten Guiding Principles
 
Dealing with complexity and uncertainty in natural resource management and ot...
Dealing with complexity and uncertainty in natural resource management and ot...Dealing with complexity and uncertainty in natural resource management and ot...
Dealing with complexity and uncertainty in natural resource management and ot...
 

Más de Toni Tassani

Dibujar para facilitar. dibujar para pensar
Dibujar para facilitar. dibujar para pensarDibujar para facilitar. dibujar para pensar
Dibujar para facilitar. dibujar para pensarToni Tassani
 
Putting order to your API ecosystem
Putting order to your API ecosystemPutting order to your API ecosystem
Putting order to your API ecosystemToni Tassani
 
How to implement agile
How to implement agileHow to implement agile
How to implement agileToni Tassani
 
Arquitectura para artesanos
Arquitectura para artesanosArquitectura para artesanos
Arquitectura para artesanosToni Tassani
 
Working with Distributed Teams
Working with Distributed TeamsWorking with Distributed Teams
Working with Distributed TeamsToni Tassani
 
Software Architecture for Developers
Software Architecture for DevelopersSoftware Architecture for Developers
Software Architecture for DevelopersToni Tassani
 
Hacking your Body Language
Hacking your Body LanguageHacking your Body Language
Hacking your Body LanguageToni Tassani
 
The Cognitive Power of Comics
The Cognitive Power of ComicsThe Cognitive Power of Comics
The Cognitive Power of ComicsToni Tassani
 
A few concepts for better software
A few concepts for better softwareA few concepts for better software
A few concepts for better softwareToni Tassani
 
Agile retrospectives
Agile retrospectivesAgile retrospectives
Agile retrospectivesToni Tassani
 
xALEc. Agile-Barcelona Community events on 2012
xALEc. Agile-Barcelona Community events on 2012xALEc. Agile-Barcelona Community events on 2012
xALEc. Agile-Barcelona Community events on 2012Toni Tassani
 
Knowledge sharing and cargo cult
Knowledge sharing and cargo cultKnowledge sharing and cargo cult
Knowledge sharing and cargo cultToni Tassani
 

Más de Toni Tassani (12)

Dibujar para facilitar. dibujar para pensar
Dibujar para facilitar. dibujar para pensarDibujar para facilitar. dibujar para pensar
Dibujar para facilitar. dibujar para pensar
 
Putting order to your API ecosystem
Putting order to your API ecosystemPutting order to your API ecosystem
Putting order to your API ecosystem
 
How to implement agile
How to implement agileHow to implement agile
How to implement agile
 
Arquitectura para artesanos
Arquitectura para artesanosArquitectura para artesanos
Arquitectura para artesanos
 
Working with Distributed Teams
Working with Distributed TeamsWorking with Distributed Teams
Working with Distributed Teams
 
Software Architecture for Developers
Software Architecture for DevelopersSoftware Architecture for Developers
Software Architecture for Developers
 
Hacking your Body Language
Hacking your Body LanguageHacking your Body Language
Hacking your Body Language
 
The Cognitive Power of Comics
The Cognitive Power of ComicsThe Cognitive Power of Comics
The Cognitive Power of Comics
 
A few concepts for better software
A few concepts for better softwareA few concepts for better software
A few concepts for better software
 
Agile retrospectives
Agile retrospectivesAgile retrospectives
Agile retrospectives
 
xALEc. Agile-Barcelona Community events on 2012
xALEc. Agile-Barcelona Community events on 2012xALEc. Agile-Barcelona Community events on 2012
xALEc. Agile-Barcelona Community events on 2012
 
Knowledge sharing and cargo cult
Knowledge sharing and cargo cultKnowledge sharing and cargo cult
Knowledge sharing and cargo cult
 

Último

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Último (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

SOLID and Better Design

  • 1. SOLID and Better Design and Better Design Toni Tassani March 2013 Photo by Roy Higson. http://www.fotopedia.com/items/roytheboy-Q13G6ugLM0I
  • 2. Writing Software is not hard You spend more time Reading and Modifying it
  • 3. Design Smells 1. Rigidity 2. Fragility 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity Photo by Elaine Adolfo http://www.fotopedia.com/items/flickr-469125880
  • 4. Design Smells 1. Rigidity The system is hard to change because every change forces many other 2. Fragility changes to other parts of the system. 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 5. Design Smells 1. Rigidity Changes cause the system to break in places that have no conceptual 2. Fragility relationship to the part that was changed. 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 6. Design Smells 1. Rigidity It is hard to disentangle the system into components that ca be reused in other 2. Fragility systems. 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 7. Design Smells 1. Rigidity Doing things right is harder than doind things wrong. 2. Fragility 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 8. Design Smells 1. Rigidity The design contains infrastructure that adds no direct benefit. 2. Fragility 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 9. Design Smells 1. Rigidity The design contains repeating structures that could be unified under a single 2. Fragility abstraction. 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 10. Design Smells 1. Rigidity It is hard to read and understand. It does not express its intent well. 2. Fragility 3. Immobility 4. Viscosity 5. Needless Complexity 6. Needless repetition 7. Opacity
  • 11. • Cohesion – All responsibilites of a module should be related and focused. • Coupling – How much a module depends upon others
  • 12. S.O.L.I.D. • Single Responsibility • Open Closed • Liskov Substitution • Interface Segregation • Dependency Inversion Photo by Jean Christophe Prunet http://www.fotopedia.com/items/_avPIZmqM3w-vdSxZGLACsg
  • 13.
  • 14.
  • 15. Single Responsibility Principle • One class should have only one reason to change. • One responsability, one reason to change
  • 16.
  • 17. Open Closed Principle • Open for extension • Closed for modification • Design modules to never change. • A change should impact only one module. • Abstraction
  • 18.
  • 19. Liskov Substitution Principle • If you use a class, you should be able to use its base class.
  • 20.
  • 21. Interface Segregation Principle • Clients should not be obliged to depend upon interfaces they not use
  • 22.
  • 23. Dependency Injection Principle • Higher level modules should not depend upon low level modules
  • 24. 4 rules of simple design 1. Runs all the tests 2. Contains no duplication 3. Expresses the intent of the programmer 4. Minimizes the number of classes and methods Kent Beck
  • 27. References • http://www.slideshare.net/JuanjoFuchs/solid-cmo- lo-aplico-a-mi-cdigo • SOLID Development by Chris Deweese http://www.slideshare.net/cdeweese/solid- development • SOLID Design Principles by Bruno Bossola http://www.slideshare.net/bbossola/geecon09- solid • Solid Development Practices in Motivational Pictures http://lostechies.com/derickbailey/2009/02/11/soli d-development-principles-in-motivational- pictures/
  • 28. Moltes Gràcies (Thank you very much) Toni Tassani Toni Tassani @atassani http://alapamui.blogspot.com Barcelona -