SlideShare a Scribd company logo
1 of 12
SOLID PRINCIPLES OF
DESIGN
Principles and practices that power the patterns
(Design Series 01)
Presenter: Heartin Jacob Kanikathottu
TOPICS
• Review of important prerequisites: OOPs concepts and UML
• The SOLID principles of design
• Additional principles and practices
• What to avoid in your design
• Problem solving time
• Intro to Design Patterns
• Resources and references
OOPS CONCEPTS
• Encapsulation
• Wrapping up of data (properties) and behavior (methods) of an object into a single unit.
• Data hiding - hiding irrelevant information from the users of a class.
• Inheritance
• Describes the parent child relationship between two classes.
• Polymorphism
• Ability to change form.
• Abstraction
• Capture only those details that are relevant to the current level.
UNIFIED MODELLING LANGUAGE (UML)
• A picture can speak thousand words.
• UML diagrams are those pictures which can speak all those words about your design.
• May be classified as static and dynamic
• Static diagrams include class, object, and use case diagram. Implementation model
diagrams, which are a subset of static diagrams include component, deployment, and
package diagram.
• Dynamic diagrams include sequence diagram, communication, state and activity
diagram.
• Drawing diagrams is the best way to learn about patterns and principles.
• Keep drawing as much as possible
THE SOLID PRINCIPLES OF DESIGN
• Single responsibility principle (SRP)
• Every class should have a single responsibility.
• Open Close Principle (OCP)
• Open for extension, closed for modification.
• Liskov substitution principle
• Objects should be replaceable with instances of subtypes without altering correctness.
• Interface segregation principle
• Many client-specific interfaces are better than one general-purpose interface
• Dependency inversion principle (DIP)
ADDITIONAL PRINCIPLES AND PRACTICES
• Program to interfaces
• Don’t repeat yourself (DRY)
• Low coupling
• Encapsulate what varies (EWV)
• Prefer composition over inheritance
• Keep it simple, stupid (KISS)
• Unit Testable code
Note: For more explanations and the latest updated list of additional principles and practices,
please refer to http://codingarchitect.com/additional-design-principles-and-best-practices
WHAT TO AVOID IN YOUR DESIGN?
• Run-Time Type Identification (RTTI)
• Cyclomatic complexity (CC)
• Swiss knife syndrome
• Lookup
• Bidirectional coupling and cyclic coupling
• God class
• Downcast
Note: For more explanations and the latest updated list of what to avoid in design, please refer
to http://codingarchitect.com/things-to-avoid-in-your-object-oriented-design
PROBLEM SOLVING
• Duck Simulation App
• Design a Duck Simulation App initially with two specific ducks that has two common
operations quack() and swim(), and a specific operation of display().
• Add a rubber duck, that will quack differently (squeak), but assume it can still swim and
of course display will be different.
• Add a fly method for the Ducks. Note that rubber ducks won’t fly.
• Add a Robo duck to the design, which whose quack, fly and display will be different,
assuming it will also swim like a duck.
• Finally refactor the code by encapsulating what varies.
Note: Please refer to and refactor the provided code samples during the session, however this is
not a requirement. You can also design using pen and paper, which is sometimes more
preferred.
ADDITIONAL PROBLEM SOLVING
• STOP WATCH DESIGN
• Design a stop watch API that will allow you to change states only to the allowed ones.
• Start by designing the states and implement it in a procedural way.
• Refactor code to avoid cyclomatic complexity (if, else or switch) as much as possible and
try to keep the logic of state transition within each state.
• THREAD SYNCHRONIZATION
• Applying patterns in real problems.
• Design three threads that will be executed one after other in same order, and in a cycle.
• Make use of the Design Pattern you used in the Stop Watch Design example.
Note: Please refer to and refactor the provided code samples during the session, however this is
not a requirement. You can also design using pen and paper, which is sometimes more
preferred.
QUICK INTRO TO DESIGN PATTERNS
• General reusable solution to a commonly occurring software design problem.
• Benefits of Design Patterns
• More productive, solving design problems faster.
• Shared vocabulary.
• Documented with its name, type, intent, use, examples, structure, related patterns,
consequences, and even implementation details.
• Patterns are based on principles
• Better understanding of principles will help understand the design patterns better.
QUICK INTRO TO DESIGN PATTERNS
(COND..)
• Gained popularity after book published by the Gang Of Four: Erich Gamma,
Richard Helm, Ralph Johnson, and John Vlissides.
• GOF design patterns can be classified into three categories:
• Creational
• Structural
• Behavioral
• Many other patterns
• Java EE Patterns, EAI Patterns, Concurrency Patterns etc.
RESOURCES & REFERENCES
• Head First Design Patterns By Eric Freeman, Elisabeth Freeman, Bert Bates,
Kathy Sierra
• www.JavaJee.com and www.CodingArchitect.com
• http://javajee.com/summary-of-object-oriented-programming-oop-concepts-in-java
• http://codingarchitect.com/important-uml-diagrams-required-to-work-with-object-
oriented-design-patterns
• http://codingarchitect.com/book/object-oriented-design-patterns-and-principles
Note: www.JavaJee.com and www.CodingArchitect.com are my personal blogs. Please refer to the above
links, for further references and resource links. Please feel free to contact me for any queries or doubts.

More Related Content

What's hot

Agile Software Development and DevOps 21092019
Agile Software Development and DevOps 21092019Agile Software Development and DevOps 21092019
Agile Software Development and DevOps 21092019Ahmed Misbah
 
Getting Started with DevOps
Getting Started with DevOpsGetting Started with DevOps
Getting Started with DevOpsAhmed Misbah
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkGanesh Samarthyam
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeRainer Stropek
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesSteven Smith
 
Codemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterCodemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterBert Jan Schrijver
 
Devops certification training course
Devops certification training courseDevops certification training course
Devops certification training courseRadsS1
 
Software Quality for Programmers
Software Quality for ProgrammersSoftware Quality for Programmers
Software Quality for ProgrammersPawel Klimczyk
 
Solid as OOP abstraction
Solid as OOP abstractionSolid as OOP abstraction
Solid as OOP abstractionPawel Klimczyk
 
DevOps topologies
DevOps topologiesDevOps topologies
DevOps topologiesSushma
 
Dev ops training in chennai
Dev ops training in chennaiDev ops training in chennai
Dev ops training in chennairaj esaki
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsYazid Hamdi
 
About Dewey Hong
About Dewey HongAbout Dewey Hong
About Dewey HongDewey Hong
 
Introduction to Agile Software Development & Python
Introduction to Agile Software Development & PythonIntroduction to Agile Software Development & Python
Introduction to Agile Software Development & PythonTharindu Weerasinghe
 
Agile Languages for Rapid Prototyping
Agile Languages for Rapid PrototypingAgile Languages for Rapid Prototyping
Agile Languages for Rapid PrototypingTharindu Weerasinghe
 

What's hot (20)

Agile Software Development and DevOps 21092019
Agile Software Development and DevOps 21092019Agile Software Development and DevOps 21092019
Agile Software Development and DevOps 21092019
 
Getting Started with DevOps
Getting Started with DevOpsGetting Started with DevOps
Getting Started with DevOps
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in Practice
 
Polyglot
PolyglotPolyglot
Polyglot
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
Codemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterCodemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps Disaster
 
Devops certification training course
Devops certification training courseDevops certification training course
Devops certification training course
 
Software Quality for Programmers
Software Quality for ProgrammersSoftware Quality for Programmers
Software Quality for Programmers
 
Solid as OOP abstraction
Solid as OOP abstractionSolid as OOP abstraction
Solid as OOP abstraction
 
SOLID for Adults
SOLID for AdultsSOLID for Adults
SOLID for Adults
 
DevOps topologies
DevOps topologiesDevOps topologies
DevOps topologies
 
Dev ops training in chennai
Dev ops training in chennaiDev ops training in chennai
Dev ops training in chennai
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
About Dewey Hong
About Dewey HongAbout Dewey Hong
About Dewey Hong
 
Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)
 
Introduction to Agile Software Development & Python
Introduction to Agile Software Development & PythonIntroduction to Agile Software Development & Python
Introduction to Agile Software Development & Python
 
Agile Languages for Rapid Prototyping
Agile Languages for Rapid PrototypingAgile Languages for Rapid Prototyping
Agile Languages for Rapid Prototyping
 

Viewers also liked

Choosing Between Cross Platform of Native Development
Choosing	Between Cross Platform of Native DevelopmentChoosing	Between Cross Platform of Native Development
Choosing Between Cross Platform of Native DevelopmentCodeOps Technologies LLP
 
DevOps Fundamentals: A perspective on DevOps Culture
DevOps Fundamentals: A perspective on DevOps Culture DevOps Fundamentals: A perspective on DevOps Culture
DevOps Fundamentals: A perspective on DevOps Culture CodeOps Technologies LLP
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkCodeOps Technologies LLP
 
Zero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryZero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryMurughan Palaniachari
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Ganesh Samarthyam
 
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...CodeOps Technologies LLP
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIGanesh Samarthyam
 

Viewers also liked (20)

Choosing Between Cross Platform of Native Development
Choosing	Between Cross Platform of Native DevelopmentChoosing	Between Cross Platform of Native Development
Choosing Between Cross Platform of Native Development
 
DevOps Toolchain v1.0
DevOps Toolchain v1.0DevOps Toolchain v1.0
DevOps Toolchain v1.0
 
DevOps game marshmallow challenge
DevOps game marshmallow challengeDevOps game marshmallow challenge
DevOps game marshmallow challenge
 
7 best quotes on dev ops
7 best quotes on dev ops7 best quotes on dev ops
7 best quotes on dev ops
 
DevOps Fundamentals: A perspective on DevOps Culture
DevOps Fundamentals: A perspective on DevOps Culture DevOps Fundamentals: A perspective on DevOps Culture
DevOps Fundamentals: A perspective on DevOps Culture
 
Better java with design
Better java with designBetter java with design
Better java with design
 
DevOps - A Gentle Introduction
DevOps - A Gentle IntroductionDevOps - A Gentle Introduction
DevOps - A Gentle Introduction
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Zero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous DeliveryZero downtime release through DevOps Continuous Delivery
Zero downtime release through DevOps Continuous Delivery
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Java 8 concurrency abstractions
Java 8 concurrency abstractionsJava 8 concurrency abstractions
Java 8 concurrency abstractions
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams
 
Sailing with Java 8 Streams
Sailing with Java 8 StreamsSailing with Java 8 Streams
Sailing with Java 8 Streams
 
Java concurrency questions and answers
Java concurrency questions and answers Java concurrency questions and answers
Java concurrency questions and answers
 
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
Software Architecture - Principles Patterns and Practices - OSI Days Workshop...
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
 

Similar to Solid Principles Of Design (Design Series 01)

Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2Julie Iskander
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General IntroductionAsma CHERIF
 
Design pattern
Design patternDesign pattern
Design patternOmar Isaid
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentationBhavin Gandhi
 
Design patterns and MV
Design patterns and MVDesign patterns and MV
Design patterns and MVSway Wang
 
Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"GlobalLogic Ukraine
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptRushikeshChikane2
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2Ankit Dubey
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesUlrich Krause
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCUlrich Krause
 
Introduction To Design Patterns Class 4 Composition vs Inheritance
 Introduction To Design Patterns Class 4 Composition vs Inheritance Introduction To Design Patterns Class 4 Composition vs Inheritance
Introduction To Design Patterns Class 4 Composition vs InheritanceBlue Elephant Consulting
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patternsRahul Singh
 
Good Slides on Architecture.ppt
Good Slides on Architecture.pptGood Slides on Architecture.ppt
Good Slides on Architecture.pptpoleshan
 

Similar to Solid Principles Of Design (Design Series 01) (20)

Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Design pattern
Design patternDesign pattern
Design pattern
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Decorator Pattern
Decorator PatternDecorator Pattern
Decorator Pattern
 
CBD.pptx
CBD.pptxCBD.pptx
CBD.pptx
 
Design patterns and MV
Design patterns and MVDesign patterns and MV
Design patterns and MV
 
Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
5-CEN6016-Chapter1.ppt
5-CEN6016-Chapter1.ppt5-CEN6016-Chapter1.ppt
5-CEN6016-Chapter1.ppt
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Software Design
Software DesignSoftware Design
Software Design
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
Introduction To Design Patterns Class 4 Composition vs Inheritance
 Introduction To Design Patterns Class 4 Composition vs Inheritance Introduction To Design Patterns Class 4 Composition vs Inheritance
Introduction To Design Patterns Class 4 Composition vs Inheritance
 
Segue to design patterns
Segue to design patternsSegue to design patterns
Segue to design patterns
 
Good Slides on Architecture.ppt
Good Slides on Architecture.pptGood Slides on Architecture.ppt
Good Slides on Architecture.ppt
 
Design Patterns.ppt
Design Patterns.pptDesign Patterns.ppt
Design Patterns.ppt
 
CEN6016-Chapter1.ppt
CEN6016-Chapter1.pptCEN6016-Chapter1.ppt
CEN6016-Chapter1.ppt
 

Recently uploaded

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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Solid Principles Of Design (Design Series 01)

  • 1. SOLID PRINCIPLES OF DESIGN Principles and practices that power the patterns (Design Series 01) Presenter: Heartin Jacob Kanikathottu
  • 2. TOPICS • Review of important prerequisites: OOPs concepts and UML • The SOLID principles of design • Additional principles and practices • What to avoid in your design • Problem solving time • Intro to Design Patterns • Resources and references
  • 3. OOPS CONCEPTS • Encapsulation • Wrapping up of data (properties) and behavior (methods) of an object into a single unit. • Data hiding - hiding irrelevant information from the users of a class. • Inheritance • Describes the parent child relationship between two classes. • Polymorphism • Ability to change form. • Abstraction • Capture only those details that are relevant to the current level.
  • 4. UNIFIED MODELLING LANGUAGE (UML) • A picture can speak thousand words. • UML diagrams are those pictures which can speak all those words about your design. • May be classified as static and dynamic • Static diagrams include class, object, and use case diagram. Implementation model diagrams, which are a subset of static diagrams include component, deployment, and package diagram. • Dynamic diagrams include sequence diagram, communication, state and activity diagram. • Drawing diagrams is the best way to learn about patterns and principles. • Keep drawing as much as possible
  • 5. THE SOLID PRINCIPLES OF DESIGN • Single responsibility principle (SRP) • Every class should have a single responsibility. • Open Close Principle (OCP) • Open for extension, closed for modification. • Liskov substitution principle • Objects should be replaceable with instances of subtypes without altering correctness. • Interface segregation principle • Many client-specific interfaces are better than one general-purpose interface • Dependency inversion principle (DIP)
  • 6. ADDITIONAL PRINCIPLES AND PRACTICES • Program to interfaces • Don’t repeat yourself (DRY) • Low coupling • Encapsulate what varies (EWV) • Prefer composition over inheritance • Keep it simple, stupid (KISS) • Unit Testable code Note: For more explanations and the latest updated list of additional principles and practices, please refer to http://codingarchitect.com/additional-design-principles-and-best-practices
  • 7. WHAT TO AVOID IN YOUR DESIGN? • Run-Time Type Identification (RTTI) • Cyclomatic complexity (CC) • Swiss knife syndrome • Lookup • Bidirectional coupling and cyclic coupling • God class • Downcast Note: For more explanations and the latest updated list of what to avoid in design, please refer to http://codingarchitect.com/things-to-avoid-in-your-object-oriented-design
  • 8. PROBLEM SOLVING • Duck Simulation App • Design a Duck Simulation App initially with two specific ducks that has two common operations quack() and swim(), and a specific operation of display(). • Add a rubber duck, that will quack differently (squeak), but assume it can still swim and of course display will be different. • Add a fly method for the Ducks. Note that rubber ducks won’t fly. • Add a Robo duck to the design, which whose quack, fly and display will be different, assuming it will also swim like a duck. • Finally refactor the code by encapsulating what varies. Note: Please refer to and refactor the provided code samples during the session, however this is not a requirement. You can also design using pen and paper, which is sometimes more preferred.
  • 9. ADDITIONAL PROBLEM SOLVING • STOP WATCH DESIGN • Design a stop watch API that will allow you to change states only to the allowed ones. • Start by designing the states and implement it in a procedural way. • Refactor code to avoid cyclomatic complexity (if, else or switch) as much as possible and try to keep the logic of state transition within each state. • THREAD SYNCHRONIZATION • Applying patterns in real problems. • Design three threads that will be executed one after other in same order, and in a cycle. • Make use of the Design Pattern you used in the Stop Watch Design example. Note: Please refer to and refactor the provided code samples during the session, however this is not a requirement. You can also design using pen and paper, which is sometimes more preferred.
  • 10. QUICK INTRO TO DESIGN PATTERNS • General reusable solution to a commonly occurring software design problem. • Benefits of Design Patterns • More productive, solving design problems faster. • Shared vocabulary. • Documented with its name, type, intent, use, examples, structure, related patterns, consequences, and even implementation details. • Patterns are based on principles • Better understanding of principles will help understand the design patterns better.
  • 11. QUICK INTRO TO DESIGN PATTERNS (COND..) • Gained popularity after book published by the Gang Of Four: Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. • GOF design patterns can be classified into three categories: • Creational • Structural • Behavioral • Many other patterns • Java EE Patterns, EAI Patterns, Concurrency Patterns etc.
  • 12. RESOURCES & REFERENCES • Head First Design Patterns By Eric Freeman, Elisabeth Freeman, Bert Bates, Kathy Sierra • www.JavaJee.com and www.CodingArchitect.com • http://javajee.com/summary-of-object-oriented-programming-oop-concepts-in-java • http://codingarchitect.com/important-uml-diagrams-required-to-work-with-object- oriented-design-patterns • http://codingarchitect.com/book/object-oriented-design-patterns-and-principles Note: www.JavaJee.com and www.CodingArchitect.com are my personal blogs. Please refer to the above links, for further references and resource links. Please feel free to contact me for any queries or doubts.

Editor's Notes

  1. Aim of this presentation is not to make you masters in SOLID Principles or patterns, but to help you guide towards that goal. Sometimes it helps just to know that there is something available to start looking into. Make use of the pointers given to search more and learn more on those topics. Refer to books, Blogs etc. to learn more. Examples for all cases discussed will be added to my blog www.javajee.com. Contact me for any queries or clarifications.
  2. The result should result in the same solution as in the Strategy Pattern.
  3. Hint: Both these are based on the State Pattern.
  4. Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides; and together they are called the "Gang of Four" or "GoF".