SlideShare a Scribd company logo
SOLID and Base principles
of software design
What is «Simple system»?
▪ There are all tests passed.
▪ The system code is clear and reveals ideas.
▪ There are no code doubling. There are no hierarchy doubling.
▪ There are used minimum possible amount of classes and methods.
Base principles of software design
● DRY : Don’t Repeat Yourself
● SCP : Speaking Code
● OCP : Open Closed
● LSP : Liskov Substitution
● DIP : Dependency Inversion
● ISP : Interface Segregation
● CRP : Common Reuse
● CCP : Common Closure
● ADP : Acyclic Dependencies
● SDP : Stable Dependencies
● SAP : Stable Abstractions
● TDA : Tell, Don’t Ask
● SRP : Single Responsibility Principle
SRP : Single Responsibility Principle (SOLID)
A class should have one, and only one, reason to change.
SRP : Single Responsibility Principle (SOLID)
SRP : Single Responsibility Principle (SOLID)
OCP : Open Closed (SOLID)
The code should be open to extension.
The code should be closed to changes.
OCP : Open Closed (SOLID)
LSP : Liskov Substitution (SOLID)
If S is a subtype of T, then objects of type T may be replaced with objects of
type S without altering any of the desirable properties of the program
LSP : Liskov Substitution (SOLID)
class Rectangle {
double height;
double width;;
int CalculateRectangleArea()
{...}
};;
class Square : Rectangle {
void set_height(int) {}
void set_width(int) {}
};
LSP : Liskov Substitution (SOLID)
class Rectangle {
double height;
double width;;
int CalculateRectangleArea()
{...}
};;
class Square : Rectangle {
void set_height(int) {}
void set_width(int) {}
};
Rectangle CreateRecatgle() {
return new Square();
}
void Main()
{
Rectangle r = CreateRecatgle();
r.Width = 3;
r.Height = 2;
assert(6, r.CalculateRectangleArea());
}
ISP : Interface Segregation (SOLID)
The big interfaces should be divided to particular small interfaces.
ISP : Interface Segregation (SOLID)
class Car
{
virtual void StartEngine() = 0;
virtual void StopEngine() = 0;
virtual int GetSpeed() = 0;
virtual void Turbo() = 0;
};
ISP : Interface Segregation (SOLID)
class SportsCar
{
virtual void Turbo() = 0;
};
class Car
{
virtual void StartEngine() = 0;
virtual void StopEngine() = 0;
virtual int GetSpeed() = 0;
};
DIP : Dependency Inversion (SOLID)
1. High level modules should not depend on low level modules. Both
should depend on abstractions
1. Abstraction shouldn't depend on details. Details should depend upon
abstractions.
DIP : Dependency Inversion (SOLID)
class Ractangle {
void draw();
};
class Circle {
void draw();
};
class UI {
void display() {
rect.draw();
circ.draw();
}
};
DIP : Dependency Inversion (SOLID)
class Ractangle {
void draw();
};
class Circle {
void draw();
};
class UI {
Rectangle rect;
Circle circ;
void display() {
rect.draw();
circ.draw();
}
};
DIP : Dependency Inversion (SOLID)
class Ractangle {
void draw();
};
class Circle {
void draw();
};
class UI {
Rectangle rect;
Circle circ;
void display() {
rect.draw();
circ.draw();
}
};
class Geometry {
virtual void draw() = 0;
};
class Circle: public Geometry{
void draw() override;
};
class Rectangle: public Geometry{
void draw() override;
};
class UI {
vector<Geometry*> geometries;
void display() {
for(auto g : geometries)
g->draw();
}
};
DRY : Don’t Repeat Yourself
You shouldn’t repeat code you written.
SCP : Speaking Code
The code should be well-documented.
CRP : Common Reuse
All classes inside the component should be used together. If you can reuse one class you
will use the rest.
CCP : Common Closure
▪ The classes in a package should be closed together against the same
kind of changes. A change that affects a package affects all classes in
that package.
▪ So “common closure” actually means SRP for packages. The SRP says
that one class shouldn’t have more than one reason to be changed.
The CCP says the same is applicable to packages.
ADP : Acyclic Dependencies
▪ There are shouldn’t be cyclic dependencies between the components
at the dependencies graph.
You worked hard. You fixed a lot of issues at the specific part of a program, but
you observed it didn't work anymore. Why did it happen, because somebody
left a work after you. On the next day it turned out that something broke but it
shouldn't have.
SDP : Stable Dependencies
Dependencies should be directed towards sustainability.
SAP : Stable Abstractions
▪ A component should be as abstract as it is persistent.
SAP : Stable Abstractions
SAP : Stable Abstractions
SAP : Stable Abstractions
The abstract things, like interfaces, will remain the same over a longer period of time
If we depend on an abstract thing, it is likely that we will not be negatively influenced by
it—it’s supposed to be very stable.
TDA : Tell, Don’t Ask
Instead of asking the object for data and working with it, we should
tell the object what to do.
Martin Fowler
Thank You!

More Related Content

Similar to Pavlo Zhdanov "Mastering solid and base principles for software design"

Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
Prabhakar Sharma
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented Design
Riccardo Cardin
 
Software Design Principles
Software Design PrinciplesSoftware Design Principles
Software Design PrinciplesOcean Dong
 
Common Design Patterns.pptx
Common Design Patterns.pptxCommon Design Patterns.pptx
Common Design Patterns.pptx
fake195786
 
Development principles in test automation!
Development principles in test automation!Development principles in test automation!
Development principles in test automation!
David Baak
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
deonpmeyer
 
The maze of Design Patterns & SOLID Principles
The maze of Design Patterns & SOLID PrinciplesThe maze of Design Patterns & SOLID Principles
The maze of Design Patterns & SOLID Principles
Muhammad Raza
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID Principles
Attila Bertók
 
Writing Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID PrinciplesWriting Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID Principles
Doug Jones
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
Bruno Bossola
 
Solid principles
Solid principlesSolid principles
Solid principles
Toan Nguyen
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
Andreas Enbohm
 
L22 Design Principles
L22 Design PrinciplesL22 Design Principles
L22 Design Principles
Ólafur Andri Ragnarsson
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
Anju Kanjirathingal
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr Sugak
Sigma Software
 
Functional solid
Functional solidFunctional solid
Functional solid
Alexandr Sugak
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...
Alain Lompo
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
yannick grenzinger
 
Software Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit DeySoftware Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit Dey
Cefalo
 

Similar to Pavlo Zhdanov "Mastering solid and base principles for software design" (20)

Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented Design
 
Software Design Principles
Software Design PrinciplesSoftware Design Principles
Software Design Principles
 
Common Design Patterns.pptx
Common Design Patterns.pptxCommon Design Patterns.pptx
Common Design Patterns.pptx
 
Development principles in test automation!
Development principles in test automation!Development principles in test automation!
Development principles in test automation!
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
The maze of Design Patterns & SOLID Principles
The maze of Design Patterns & SOLID PrinciplesThe maze of Design Patterns & SOLID Principles
The maze of Design Patterns & SOLID Principles
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID Principles
 
SOLID Design principles
SOLID Design principlesSOLID Design principles
SOLID Design principles
 
Writing Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID PrinciplesWriting Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID Principles
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design Principles
 
Solid principles
Solid principlesSolid principles
Solid principles
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
L22 Design Principles
L22 Design PrinciplesL22 Design Principles
L22 Design Principles
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr Sugak
 
Functional solid
Functional solidFunctional solid
Functional solid
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
 
Software Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit DeySoftware Design Principles and Best Practices - Satyajit Dey
Software Design Principles and Best Practices - Satyajit Dey
 

More from LogeekNightUkraine

Face recognition with c++
Face recognition with c++ Face recognition with c++
Face recognition with c++
LogeekNightUkraine
 
C++20 features
C++20 features C++20 features
C++20 features
LogeekNightUkraine
 
Autonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, futureAutonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, future
LogeekNightUkraine
 
Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design" Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design"
LogeekNightUkraine
 
Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data" Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data"
LogeekNightUkraine
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
LogeekNightUkraine
 
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
LogeekNightUkraine
 
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
LogeekNightUkraine
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
LogeekNightUkraine
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
LogeekNightUkraine
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
LogeekNightUkraine
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
LogeekNightUkraine
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
LogeekNightUkraine
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
LogeekNightUkraine
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
LogeekNightUkraine
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
LogeekNightUkraine
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
LogeekNightUkraine
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
LogeekNightUkraine
 
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
LogeekNightUkraine
 

More from LogeekNightUkraine (20)

Face recognition with c++
Face recognition with c++ Face recognition with c++
Face recognition with c++
 
C++20 features
C++20 features C++20 features
C++20 features
 
Autonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, futureAutonomous driving on your developer pc. technologies, approaches, future
Autonomous driving on your developer pc. technologies, approaches, future
 
Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design" Orkhan Gasimov "High Performance System Design"
Orkhan Gasimov "High Performance System Design"
 
Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data" Vitalii Korzh "Managed Workflows or How to Master Data"
Vitalii Korzh "Managed Workflows or How to Master Data"
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
 
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"Oleksii Kuchuk "Reading gauge values with open cv imgproc"
Oleksii Kuchuk "Reading gauge values with open cv imgproc"
 
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
 
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 

Pavlo Zhdanov "Mastering solid and base principles for software design"

  • 1. SOLID and Base principles of software design
  • 2.
  • 3.
  • 4. What is «Simple system»? ▪ There are all tests passed. ▪ The system code is clear and reveals ideas. ▪ There are no code doubling. There are no hierarchy doubling. ▪ There are used minimum possible amount of classes and methods.
  • 5. Base principles of software design ● DRY : Don’t Repeat Yourself ● SCP : Speaking Code ● OCP : Open Closed ● LSP : Liskov Substitution ● DIP : Dependency Inversion ● ISP : Interface Segregation ● CRP : Common Reuse ● CCP : Common Closure ● ADP : Acyclic Dependencies ● SDP : Stable Dependencies ● SAP : Stable Abstractions ● TDA : Tell, Don’t Ask ● SRP : Single Responsibility Principle
  • 6. SRP : Single Responsibility Principle (SOLID) A class should have one, and only one, reason to change.
  • 7. SRP : Single Responsibility Principle (SOLID)
  • 8. SRP : Single Responsibility Principle (SOLID)
  • 9. OCP : Open Closed (SOLID) The code should be open to extension. The code should be closed to changes.
  • 10. OCP : Open Closed (SOLID)
  • 11. LSP : Liskov Substitution (SOLID) If S is a subtype of T, then objects of type T may be replaced with objects of type S without altering any of the desirable properties of the program
  • 12. LSP : Liskov Substitution (SOLID) class Rectangle { double height; double width;; int CalculateRectangleArea() {...} };; class Square : Rectangle { void set_height(int) {} void set_width(int) {} };
  • 13. LSP : Liskov Substitution (SOLID) class Rectangle { double height; double width;; int CalculateRectangleArea() {...} };; class Square : Rectangle { void set_height(int) {} void set_width(int) {} }; Rectangle CreateRecatgle() { return new Square(); } void Main() { Rectangle r = CreateRecatgle(); r.Width = 3; r.Height = 2; assert(6, r.CalculateRectangleArea()); }
  • 14. ISP : Interface Segregation (SOLID) The big interfaces should be divided to particular small interfaces.
  • 15. ISP : Interface Segregation (SOLID) class Car { virtual void StartEngine() = 0; virtual void StopEngine() = 0; virtual int GetSpeed() = 0; virtual void Turbo() = 0; };
  • 16. ISP : Interface Segregation (SOLID) class SportsCar { virtual void Turbo() = 0; }; class Car { virtual void StartEngine() = 0; virtual void StopEngine() = 0; virtual int GetSpeed() = 0; };
  • 17. DIP : Dependency Inversion (SOLID) 1. High level modules should not depend on low level modules. Both should depend on abstractions 1. Abstraction shouldn't depend on details. Details should depend upon abstractions.
  • 18. DIP : Dependency Inversion (SOLID) class Ractangle { void draw(); }; class Circle { void draw(); }; class UI { void display() { rect.draw(); circ.draw(); } };
  • 19. DIP : Dependency Inversion (SOLID) class Ractangle { void draw(); }; class Circle { void draw(); }; class UI { Rectangle rect; Circle circ; void display() { rect.draw(); circ.draw(); } };
  • 20. DIP : Dependency Inversion (SOLID) class Ractangle { void draw(); }; class Circle { void draw(); }; class UI { Rectangle rect; Circle circ; void display() { rect.draw(); circ.draw(); } }; class Geometry { virtual void draw() = 0; }; class Circle: public Geometry{ void draw() override; }; class Rectangle: public Geometry{ void draw() override; }; class UI { vector<Geometry*> geometries; void display() { for(auto g : geometries) g->draw(); } };
  • 21. DRY : Don’t Repeat Yourself You shouldn’t repeat code you written.
  • 22. SCP : Speaking Code The code should be well-documented.
  • 23. CRP : Common Reuse All classes inside the component should be used together. If you can reuse one class you will use the rest.
  • 24. CCP : Common Closure ▪ The classes in a package should be closed together against the same kind of changes. A change that affects a package affects all classes in that package. ▪ So “common closure” actually means SRP for packages. The SRP says that one class shouldn’t have more than one reason to be changed. The CCP says the same is applicable to packages.
  • 25. ADP : Acyclic Dependencies ▪ There are shouldn’t be cyclic dependencies between the components at the dependencies graph. You worked hard. You fixed a lot of issues at the specific part of a program, but you observed it didn't work anymore. Why did it happen, because somebody left a work after you. On the next day it turned out that something broke but it shouldn't have.
  • 26. SDP : Stable Dependencies Dependencies should be directed towards sustainability.
  • 27.
  • 28.
  • 29.
  • 30. SAP : Stable Abstractions ▪ A component should be as abstract as it is persistent.
  • 31. SAP : Stable Abstractions
  • 32. SAP : Stable Abstractions
  • 33. SAP : Stable Abstractions The abstract things, like interfaces, will remain the same over a longer period of time If we depend on an abstract thing, it is likely that we will not be negatively influenced by it—it’s supposed to be very stable.
  • 34. TDA : Tell, Don’t Ask Instead of asking the object for data and working with it, we should tell the object what to do. Martin Fowler