SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
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!

Contenu connexe

Similaire à 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 patternsPrabhakar Sharma
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignRiccardo 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.pptxfake195786
 
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 Principlesdeonpmeyer
 
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 PrinciplesMuhammad Raza
 
An Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAn Introduction to the SOLID Principles
An Introduction to the SOLID PrinciplesAttila Bertók
 
Writing Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID PrinciplesWriting Maintainable Software Using SOLID Principles
Writing Maintainable Software Using SOLID PrinciplesDoug Jones
 
Geecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesGeecon09: SOLID Design Principles
Geecon09: SOLID Design PrinciplesBruno Bossola
 
Solid principles
Solid principlesSolid principles
Solid principlesToan Nguyen
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design PrinciplesAndreas Enbohm
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakSigma Software
 
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 Polytechyannick 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 DeyCefalo
 

Similaire à 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
 

Plus de 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, futureLogeekNightUkraine
 
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
 

Plus de 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"
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Dernier (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

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