SlideShare a Scribd company logo
Faculty of Engineeeing and Technology
Master in Software Engineering Program
SOLID principle and how it helps in satisfying design goals
low coupling and high cohesiveness
Prepared by
Mohammad Shawahneh
1155294
Instructor
Dr. Yousef Hassouneh
Contents
Introduction ................................................................................................................................................ 2
Coupling...................................................................................................................................................... 3
Cohesion..................................................................................................................................................... 3
Single Responsibility Principle..................................................................................................................... 3
.................................................................................................................................................................... 4
Open Close Principle................................................................................................................................... 4
Liskov Substitution Principle....................................................................................................................... 5
Interface Segregation principle................................................................................................................... 7
Dependency Inversion Principle ................................................................................................................. 9
Conclusion ................................................................................................................................................ 10
References ................................................................................................................................................ 10
Introduction
Software products evolve, it usually live longtime, even it may start with small defined list of
requirements which may appear simple that managers, designer and developers may think it can be
delivered without exerting much effort and consuming valuable times in considering future aspects
which are not even requested or known at the moment. But in reality software products usually start as
a short term products and ends up in years of development and maintenance, moreover, the nature of
software products which is unlike classical manufactured products, and can be easily maintained,
changed, updated, or extended by adding more features and functionalities at any point of time in its
life cycle, motivated software product owners and customers to continuously ask for functional and
quality evolutions.
To address such a nature of software products a need for keeping an eye on where the software product
will be next, rather than where it is now appeared, and on complexities which will be added later on
software structure, design and implantation. That’s attracted the attention to introduce early solutions
which are if software designers followed at early stages will help providing high quality and easily
evolved software product, different design principles was introduced to help organizing and arranging
structural components in a managed way that help providing high quality and easily extensible software
products[1].
Among these principles, S.O.L.I.D principles which stand for Single responsibility principle (SRP), Open-
closed principle (OCP), Liskov substitution principle (LSP), Interface segregation principle (ISP) and
Dependency inversion principle (DIP), is a robust well-known solution which will provide a well-
structured, easily change and maintain software when applied in a software design. Given that a good
software product is modular, SOLID help discarding code smells, like, rigidity, fragility, high coupling and
low cohesion.
In this discussion we will elaborate in SOLID principles and how they help in solving high coupling and
low cohesion problems.
Coupling
Coupling refers to the extent to which modules, classes or constructs are dependent upon each other,
and can be affected by changing of each other, such that developer might be affect other coupled
modules when changing on a tightly coupled module[2], among characteristics of good design are
loosely coupled modules or classes, as zero coupling means no system at all, and tightly coupled system
leads to a complex system and to difficulties in maintenance and extensibility, low coupling can be
achieved by controlling connections among modules in a systematic way to the a least reliable extent.
Coupling is classified into numerous taxonomies and dimensions according to literature[3,4] , from
which we will concentrate on interaction and inheritance coupling and how it was handled by SOLID
principles, as there is no room to elaborate more in this limited discussion.
Cohesion
Cohesion refers to the extent to which a desirable connection among the elements of a single module or
class and how that module parts are connected together so as to do its correlated work in a desirable
interaction and dependencies, high cohesion helps find system and code parts easily, that is once we
find one parts all will be there, also it helps define scope of interacted related code. A good design is
intended to have high level of cohesion[3].
We will elaborate in class and inheritance cohesion types and how they were solved by SOLID principles.
Single Responsibility Principle
This principles states that a class or a software entity should have only one reason to be changed, that
does not mean one reason for exist, because that will lead to a situation where a class may have only
one method and still exists, but change is better describing requirements that if done will be referred
later in a well-known reason.
If a class breaks this responsibility and thus it has more reasons to be changed, that means it will be
tightly coupled with more classes and modules as other classes will use it directly for accessing that
functionalities, and any change on one responsibility of the class may affect other coupled classes that
do not mind about the changed functionality causing a fragility in the software all.
A class that satisfies a one responsibility will have all its parts highly cohesive together to achieve that
goal, and there will be no logic in adding elements that class does not need to have, but for example
given a class with three responsibilities, it will have three punch of elements that are not cohesive at all,
or if having some kind of cohesion, that type will be a bad cohesion and hence it is a coupling that makes
the class fragile and rigid.
A one reason to change responsibility will empower the high cohesion, and provide a tightly coupled
class in its module, and decrease the effect of any change and keeping it under control[5].
See figures 1,2 that shows before SRP and after.
Figure1
Figure 2
Open Close Principle
This principle states that a class or a software entity should be open for extension but closed for
modification. That means the class should be open for behavioral extension on requirement change or
newly requested while it is keeping its original behavior and responsibility and characteristics, that can
be achieved by building a design that enables extending the existing code, using a level of abstraction
that can be untouched along software lifecycle, and still providing possibility to extend using design
patterns like strategy, observer, decorator and template design patterns[5].
This principle contributes much to cohesion by gathering correlated functionalities in the abstraction
level and in the extended behavior, it also provides a level of desirable inheritance coupling[2], as the
class will have a limited connections to it during its life cycle, and will be referred to by inheritance of it
directly or of a class it is using. See fig 3, 4
Figure 3
Figure 4
Liskov Substitution Principle
This principle states that a subclass must be semantically possible to substitute it parent class without
breaking the functionality of that parent class. This can be achieved by defining a well-structured level of
abstraction and use inheritance in a manageable manner where the relation is totally applied rather
than for code reuse or even is-a relationship which can violate principle in some cases[5].
Such a structure provides a strongly cohesive inheritance where parts are working together in a
systematic manner that doesn’t contradict each other, and also inside a class the cohesion will be high
due to similarities in the functionalities class are doing for not going beyond the original defined
responsibility in the base class.
The principle also empowers the low coupling in a considerable contribution, as it is logically possible for
modules to refer to the base class in a loosely coupled connection, and get benefit of polymorphism
injecting the desired implementations as needed and still use the base class for communicating with
module. See figures 5,6
Figure 5
Figure 6
Interface Segregation principle
This principles state that a client or module should not be forced to depend on interfaces or interface
parts that it does not need. So the key is that as a class to use only what the interfaces that you need.
This principles can be broken by fat interfaces and forces the client to throw exceptions or provide
empty implementations on unneeded methods, one solution is to provide related thin interfaces which
do one related thing and use them where needed, another is by delegation of functionalities[5].
Having only related parts inside a class will empower the cohesion among its elements, as there will be
no unrelated methods or implementation that astonish the user and decrease the cohesion.
Also fat interfaces will be referenced by many modules each of which needs a specific functionality but
obliged to implement all, this makes those interfaces tightly coupled in the modules, but when applying
this principle the coupling will be to its lowest extent as connections go only where needed, and the
change will not cause any cascade fragility. See figures 7,8
Figure 7
Figure 8
Dependency Inversion Principle
This principle states that high level modules should not depend on low level modules, but both should
depend on abstractions, and also abstractions should not depend on details, details should depend on
abstractions.
This principle empowers the cohesion by means of strengthening the abstractions, so that parts inside
the abstraction layer are cohesive together to provide desirable functionalities, same in the detailed
layers below.
It also decouple the system by providing a flow of responsibilities using abstractions, empowering the
system layering in a controlled loosely coupled manner, it also removes the coupling of the system with
its details, so that no error can cascade to the above abstractions or layers. See figures 9. 10
Fig 9
Fig 10
Conclusion
SOLID principles provide a reliable solution for design smells and for software extensibility and change, it
solved the problem of high coupling and low cohesion in a systematic robust manner if applied together
in the right way.
References
[1] Haoyu, Wang, and Zhou Haili. "Basic Design Principles in Software Engineering." Computational and
Information Sciences (ICCIS), 2012 Fourth International Conference on. IEEE, 2012.
[2] http://www.codemag.com/article/1001061
[3] Eder, Johann, Gerti Kappel, and Michael Schrefl. "Coupling and cohesion in object-oriented
systems." Technical Reprot, University of Klagenfurt, Austria(1994).
[4] https://en.wikipedia.org/wiki/Coupling
[5] Martin, Robert C., and Micah Martin. Agile principles, patterns, and practices in C#. Pearson
Education, 2006.
Solid Principles, for better cohesion and lower coupling

More Related Content

What's hot

Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
Herman Peeren
 
Clean architecture
Clean architectureClean architecture
Clean architecture
Travis Frisinger
 
Proceso de ejecucion de un programa en C++
Proceso de ejecucion de un programa en C++Proceso de ejecucion de un programa en C++
Proceso de ejecucion de un programa en C++tipolis1
 
Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)
Jamie (Taka) Wang
 
PATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design PatternsPATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design Patterns
Michael Heron
 
Node JS (Francisco Cerdas)
Node JS (Francisco Cerdas)Node JS (Francisco Cerdas)
Node JS (Francisco Cerdas)
PiXeL16
 
Lecture 5 process synchronization
Lecture 5 process synchronizationLecture 5 process synchronization
Lecture 5 process synchronization
KlintonChhun
 
Grasp principles
Grasp principlesGrasp principles
Grasp principles
Yuriy Shapovalov
 
Algoritmo de dekker
Algoritmo de dekker Algoritmo de dekker
Algoritmo de dekker
Universidad Peruana del Oriente
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
Shakil Ahmed
 
Unified Process
Unified Process Unified Process
Unified Process
ramyaranjith
 
4. ch 3-agile process
4. ch 3-agile process4. ch 3-agile process
4. ch 3-agile process
Delowar hossain
 
Prototype_pattern
Prototype_patternPrototype_pattern
Prototype_pattern
Iryney Baran
 
Creational pattern
Creational patternCreational pattern
Creational pattern
Himanshu
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & Overview
Eelco Visser
 
Memory Management
Memory ManagementMemory Management
Memory Management
jayalakshmi268
 
What is the difference between manual testing and automation testing
What is the difference between manual testing and automation testingWhat is the difference between manual testing and automation testing
What is the difference between manual testing and automation testing
Er Mahednra Chauhan
 
Solid principles – interface segregation principle
Solid principles – interface segregation principle Solid principles – interface segregation principle
Solid principles – interface segregation principle
Nitisak Mooltreesri
 
Xp exterme-programming-model
Xp exterme-programming-modelXp exterme-programming-model
Xp exterme-programming-modelAli MasudianPour
 

What's hot (20)

Code quality
Code quality Code quality
Code quality
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
Clean architecture
Clean architectureClean architecture
Clean architecture
 
Proceso de ejecucion de un programa en C++
Proceso de ejecucion de un programa en C++Proceso de ejecucion de un programa en C++
Proceso de ejecucion de un programa en C++
 
Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)Applying UML and Patterns (CH1, 6, 9, 10)
Applying UML and Patterns (CH1, 6, 9, 10)
 
PATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design PatternsPATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design Patterns
 
Node JS (Francisco Cerdas)
Node JS (Francisco Cerdas)Node JS (Francisco Cerdas)
Node JS (Francisco Cerdas)
 
Lecture 5 process synchronization
Lecture 5 process synchronizationLecture 5 process synchronization
Lecture 5 process synchronization
 
Grasp principles
Grasp principlesGrasp principles
Grasp principles
 
Algoritmo de dekker
Algoritmo de dekker Algoritmo de dekker
Algoritmo de dekker
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
 
Unified Process
Unified Process Unified Process
Unified Process
 
4. ch 3-agile process
4. ch 3-agile process4. ch 3-agile process
4. ch 3-agile process
 
Prototype_pattern
Prototype_patternPrototype_pattern
Prototype_pattern
 
Creational pattern
Creational patternCreational pattern
Creational pattern
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & Overview
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
What is the difference between manual testing and automation testing
What is the difference between manual testing and automation testingWhat is the difference between manual testing and automation testing
What is the difference between manual testing and automation testing
 
Solid principles – interface segregation principle
Solid principles – interface segregation principle Solid principles – interface segregation principle
Solid principles – interface segregation principle
 
Xp exterme-programming-model
Xp exterme-programming-modelXp exterme-programming-model
Xp exterme-programming-model
 

Viewers also liked

Software Architectural mismatches
Software Architectural mismatchesSoftware Architectural mismatches
Software Architectural mismatches
Mohammad Shawahneh
 
Linux and skype Architectural Styles
Linux and skype Architectural StylesLinux and skype Architectural Styles
Linux and skype Architectural Styles
Mohammad Shawahneh
 
Cohesion and coupling metrics for workflow process design
Cohesion and coupling metrics for workflow process designCohesion and coupling metrics for workflow process design
Cohesion and coupling metrics for workflow process design
Giorgio Sironi
 
Software Architecture connectors - ActiveMQ analysis
Software Architecture connectors - ActiveMQ analysisSoftware Architecture connectors - ActiveMQ analysis
Software Architecture connectors - ActiveMQ analysis
Mohammad Shawahneh
 
CakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesionCakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesion
Carl Sutton
 
Couplingand cohesion student
Couplingand cohesion studentCouplingand cohesion student
Couplingand cohesion student
saurabh kumar
 
Software Design 1: Coupling & cohesion
Software Design 1: Coupling & cohesionSoftware Design 1: Coupling & cohesion
Software Design 1: Coupling & cohesion
Attila Magyar
 
Online shopping system
Online shopping systemOnline shopping system
Online shopping system
Nik_Panchal
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
Pankaj Kumar
 
Online Shopping System PPT
Online Shopping System PPTOnline Shopping System PPT
Online Shopping System PPTsomarka
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
Sander Mak (@Sander_Mak)
 
Online Shopping Presentation
Online Shopping PresentationOnline Shopping Presentation
Online Shopping Presentationamanda-schmid
 
Online Shopping Full Project Presentation (20 slides)
Online Shopping Full Project Presentation (20 slides)Online Shopping Full Project Presentation (20 slides)
Online Shopping Full Project Presentation (20 slides)
Krishna Mohan Shakya
 
Quantitative Data Analysis
Quantitative Data AnalysisQuantitative Data Analysis
Quantitative Data Analysis
Asma Muhamad
 
Online shopping presentation
Online shopping presentationOnline shopping presentation
Online shopping presentationpobr0702
 
Design concepts and principles
Design concepts and principlesDesign concepts and principles
Design concepts and principlessaurabhshertukde
 

Viewers also liked (17)

Software Architectural mismatches
Software Architectural mismatchesSoftware Architectural mismatches
Software Architectural mismatches
 
Linux and skype Architectural Styles
Linux and skype Architectural StylesLinux and skype Architectural Styles
Linux and skype Architectural Styles
 
Cohesion and coupling metrics for workflow process design
Cohesion and coupling metrics for workflow process designCohesion and coupling metrics for workflow process design
Cohesion and coupling metrics for workflow process design
 
Software Architecture connectors - ActiveMQ analysis
Software Architecture connectors - ActiveMQ analysisSoftware Architecture connectors - ActiveMQ analysis
Software Architecture connectors - ActiveMQ analysis
 
Cohesion & Coupling
Cohesion & Coupling Cohesion & Coupling
Cohesion & Coupling
 
CakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesionCakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesion
 
Couplingand cohesion student
Couplingand cohesion studentCouplingand cohesion student
Couplingand cohesion student
 
Software Design 1: Coupling & cohesion
Software Design 1: Coupling & cohesionSoftware Design 1: Coupling & cohesion
Software Design 1: Coupling & cohesion
 
Online shopping system
Online shopping systemOnline shopping system
Online shopping system
 
Library Management System
Library Management SystemLibrary Management System
Library Management System
 
Online Shopping System PPT
Online Shopping System PPTOnline Shopping System PPT
Online Shopping System PPT
 
Java 9 Modularity in Action
Java 9 Modularity in ActionJava 9 Modularity in Action
Java 9 Modularity in Action
 
Online Shopping Presentation
Online Shopping PresentationOnline Shopping Presentation
Online Shopping Presentation
 
Online Shopping Full Project Presentation (20 slides)
Online Shopping Full Project Presentation (20 slides)Online Shopping Full Project Presentation (20 slides)
Online Shopping Full Project Presentation (20 slides)
 
Quantitative Data Analysis
Quantitative Data AnalysisQuantitative Data Analysis
Quantitative Data Analysis
 
Online shopping presentation
Online shopping presentationOnline shopping presentation
Online shopping presentation
 
Design concepts and principles
Design concepts and principlesDesign concepts and principles
Design concepts and principles
 

Similar to Solid Principles, for better cohesion and lower coupling

Software design principles - jinal desai
Software design principles - jinal desaiSoftware design principles - jinal desai
Software design principles - jinal desai
jinaldesailive
 
114 425-433
114 425-433114 425-433
114 425-433
idescitation
 
Soild principles
Soild principlesSoild principles
Soild principles
Avidnyat Chiddarwar
 
Inversion of Control
Inversion of ControlInversion of Control
Inversion of Control
Shuhab Tariq
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
Basavaraj Patil
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptx
Dr.Shweta
 
PMSE pdf
PMSE pdfPMSE pdf
PMSE pdf
ADARSHN40
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile projectHarald Soevik
 
An ultimate guide to SOLID Principles, developers must know.
An ultimate guide to SOLID Principles, developers must know.An ultimate guide to SOLID Principles, developers must know.
An ultimate guide to SOLID Principles, developers must know.
ONE BCG
 
Design Principles to design Patterns
Design Principles to design PatternsDesign Principles to design Patterns
Design Principles to design Patterns
Faizan Haider
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
Anju Kanjirathingal
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
iasaglobal
 
Software engineering Questions and Answers
Software engineering Questions and AnswersSoftware engineering Questions and Answers
Software engineering Questions and AnswersBala Ganesh
 
Antifragile Software Design
Antifragile Software DesignAntifragile Software Design
Antifragile Software Design
Hayim Makabee
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
Ritu Mangla
 
System software design1
System software design1System software design1
System software design1
PrityRawat2
 
Software Design abtic.pptx
Software Design abtic.pptxSoftware Design abtic.pptx
Software Design abtic.pptx
ssuser8c0d24
 
Clean Code .Net Cheetsheets
Clean Code .Net CheetsheetsClean Code .Net Cheetsheets
Clean Code .Net Cheetsheets
NikitaGoncharuk1
 

Similar to Solid Principles, for better cohesion and lower coupling (20)

Software design principles - jinal desai
Software design principles - jinal desaiSoftware design principles - jinal desai
Software design principles - jinal desai
 
114 425-433
114 425-433114 425-433
114 425-433
 
Soild principles
Soild principlesSoild principles
Soild principles
 
Inversion of Control
Inversion of ControlInversion of Control
Inversion of Control
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptx
 
PMSE pdf
PMSE pdfPMSE pdf
PMSE pdf
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile project
 
An ultimate guide to SOLID Principles, developers must know.
An ultimate guide to SOLID Principles, developers must know.An ultimate guide to SOLID Principles, developers must know.
An ultimate guide to SOLID Principles, developers must know.
 
Design Principles to design Patterns
Design Principles to design PatternsDesign Principles to design Patterns
Design Principles to design Patterns
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
Solid
SolidSolid
Solid
 
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design PatternsNina Grantcharova - Approach to Separation of Concerns via Design Patterns
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
 
Software engineering Questions and Answers
Software engineering Questions and AnswersSoftware engineering Questions and Answers
Software engineering Questions and Answers
 
Antifragile Software Design
Antifragile Software DesignAntifragile Software Design
Antifragile Software Design
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
System software design1
System software design1System software design1
System software design1
 
6-Design.ppt
6-Design.ppt6-Design.ppt
6-Design.ppt
 
Software Design abtic.pptx
Software Design abtic.pptxSoftware Design abtic.pptx
Software Design abtic.pptx
 
Clean Code .Net Cheetsheets
Clean Code .Net CheetsheetsClean Code .Net Cheetsheets
Clean Code .Net Cheetsheets
 

Recently uploaded

Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 

Recently uploaded (20)

Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 

Solid Principles, for better cohesion and lower coupling

  • 1. Faculty of Engineeeing and Technology Master in Software Engineering Program SOLID principle and how it helps in satisfying design goals low coupling and high cohesiveness Prepared by Mohammad Shawahneh 1155294 Instructor Dr. Yousef Hassouneh
  • 2. Contents Introduction ................................................................................................................................................ 2 Coupling...................................................................................................................................................... 3 Cohesion..................................................................................................................................................... 3 Single Responsibility Principle..................................................................................................................... 3 .................................................................................................................................................................... 4 Open Close Principle................................................................................................................................... 4 Liskov Substitution Principle....................................................................................................................... 5 Interface Segregation principle................................................................................................................... 7 Dependency Inversion Principle ................................................................................................................. 9 Conclusion ................................................................................................................................................ 10 References ................................................................................................................................................ 10 Introduction Software products evolve, it usually live longtime, even it may start with small defined list of requirements which may appear simple that managers, designer and developers may think it can be delivered without exerting much effort and consuming valuable times in considering future aspects which are not even requested or known at the moment. But in reality software products usually start as a short term products and ends up in years of development and maintenance, moreover, the nature of software products which is unlike classical manufactured products, and can be easily maintained, changed, updated, or extended by adding more features and functionalities at any point of time in its life cycle, motivated software product owners and customers to continuously ask for functional and quality evolutions. To address such a nature of software products a need for keeping an eye on where the software product will be next, rather than where it is now appeared, and on complexities which will be added later on software structure, design and implantation. That’s attracted the attention to introduce early solutions which are if software designers followed at early stages will help providing high quality and easily evolved software product, different design principles was introduced to help organizing and arranging structural components in a managed way that help providing high quality and easily extensible software products[1]. Among these principles, S.O.L.I.D principles which stand for Single responsibility principle (SRP), Open- closed principle (OCP), Liskov substitution principle (LSP), Interface segregation principle (ISP) and
  • 3. Dependency inversion principle (DIP), is a robust well-known solution which will provide a well- structured, easily change and maintain software when applied in a software design. Given that a good software product is modular, SOLID help discarding code smells, like, rigidity, fragility, high coupling and low cohesion. In this discussion we will elaborate in SOLID principles and how they help in solving high coupling and low cohesion problems. Coupling Coupling refers to the extent to which modules, classes or constructs are dependent upon each other, and can be affected by changing of each other, such that developer might be affect other coupled modules when changing on a tightly coupled module[2], among characteristics of good design are loosely coupled modules or classes, as zero coupling means no system at all, and tightly coupled system leads to a complex system and to difficulties in maintenance and extensibility, low coupling can be achieved by controlling connections among modules in a systematic way to the a least reliable extent. Coupling is classified into numerous taxonomies and dimensions according to literature[3,4] , from which we will concentrate on interaction and inheritance coupling and how it was handled by SOLID principles, as there is no room to elaborate more in this limited discussion. Cohesion Cohesion refers to the extent to which a desirable connection among the elements of a single module or class and how that module parts are connected together so as to do its correlated work in a desirable interaction and dependencies, high cohesion helps find system and code parts easily, that is once we find one parts all will be there, also it helps define scope of interacted related code. A good design is intended to have high level of cohesion[3]. We will elaborate in class and inheritance cohesion types and how they were solved by SOLID principles. Single Responsibility Principle This principles states that a class or a software entity should have only one reason to be changed, that does not mean one reason for exist, because that will lead to a situation where a class may have only one method and still exists, but change is better describing requirements that if done will be referred later in a well-known reason. If a class breaks this responsibility and thus it has more reasons to be changed, that means it will be tightly coupled with more classes and modules as other classes will use it directly for accessing that functionalities, and any change on one responsibility of the class may affect other coupled classes that do not mind about the changed functionality causing a fragility in the software all.
  • 4. A class that satisfies a one responsibility will have all its parts highly cohesive together to achieve that goal, and there will be no logic in adding elements that class does not need to have, but for example given a class with three responsibilities, it will have three punch of elements that are not cohesive at all, or if having some kind of cohesion, that type will be a bad cohesion and hence it is a coupling that makes the class fragile and rigid. A one reason to change responsibility will empower the high cohesion, and provide a tightly coupled class in its module, and decrease the effect of any change and keeping it under control[5]. See figures 1,2 that shows before SRP and after. Figure1 Figure 2 Open Close Principle This principle states that a class or a software entity should be open for extension but closed for modification. That means the class should be open for behavioral extension on requirement change or newly requested while it is keeping its original behavior and responsibility and characteristics, that can be achieved by building a design that enables extending the existing code, using a level of abstraction that can be untouched along software lifecycle, and still providing possibility to extend using design patterns like strategy, observer, decorator and template design patterns[5]. This principle contributes much to cohesion by gathering correlated functionalities in the abstraction level and in the extended behavior, it also provides a level of desirable inheritance coupling[2], as the class will have a limited connections to it during its life cycle, and will be referred to by inheritance of it directly or of a class it is using. See fig 3, 4
  • 5. Figure 3 Figure 4 Liskov Substitution Principle This principle states that a subclass must be semantically possible to substitute it parent class without breaking the functionality of that parent class. This can be achieved by defining a well-structured level of abstraction and use inheritance in a manageable manner where the relation is totally applied rather than for code reuse or even is-a relationship which can violate principle in some cases[5].
  • 6. Such a structure provides a strongly cohesive inheritance where parts are working together in a systematic manner that doesn’t contradict each other, and also inside a class the cohesion will be high due to similarities in the functionalities class are doing for not going beyond the original defined responsibility in the base class. The principle also empowers the low coupling in a considerable contribution, as it is logically possible for modules to refer to the base class in a loosely coupled connection, and get benefit of polymorphism injecting the desired implementations as needed and still use the base class for communicating with module. See figures 5,6 Figure 5
  • 7. Figure 6 Interface Segregation principle This principles state that a client or module should not be forced to depend on interfaces or interface parts that it does not need. So the key is that as a class to use only what the interfaces that you need. This principles can be broken by fat interfaces and forces the client to throw exceptions or provide empty implementations on unneeded methods, one solution is to provide related thin interfaces which do one related thing and use them where needed, another is by delegation of functionalities[5]. Having only related parts inside a class will empower the cohesion among its elements, as there will be no unrelated methods or implementation that astonish the user and decrease the cohesion. Also fat interfaces will be referenced by many modules each of which needs a specific functionality but obliged to implement all, this makes those interfaces tightly coupled in the modules, but when applying this principle the coupling will be to its lowest extent as connections go only where needed, and the change will not cause any cascade fragility. See figures 7,8
  • 9. Dependency Inversion Principle This principle states that high level modules should not depend on low level modules, but both should depend on abstractions, and also abstractions should not depend on details, details should depend on abstractions. This principle empowers the cohesion by means of strengthening the abstractions, so that parts inside the abstraction layer are cohesive together to provide desirable functionalities, same in the detailed layers below. It also decouple the system by providing a flow of responsibilities using abstractions, empowering the system layering in a controlled loosely coupled manner, it also removes the coupling of the system with its details, so that no error can cascade to the above abstractions or layers. See figures 9. 10 Fig 9
  • 10. Fig 10 Conclusion SOLID principles provide a reliable solution for design smells and for software extensibility and change, it solved the problem of high coupling and low cohesion in a systematic robust manner if applied together in the right way. References [1] Haoyu, Wang, and Zhou Haili. "Basic Design Principles in Software Engineering." Computational and Information Sciences (ICCIS), 2012 Fourth International Conference on. IEEE, 2012. [2] http://www.codemag.com/article/1001061 [3] Eder, Johann, Gerti Kappel, and Michael Schrefl. "Coupling and cohesion in object-oriented systems." Technical Reprot, University of Klagenfurt, Austria(1994). [4] https://en.wikipedia.org/wiki/Coupling [5] Martin, Robert C., and Micah Martin. Agile principles, patterns, and practices in C#. Pearson Education, 2006.