dev-resources.site
for different kinds of informations.
🪨 SOLID Principles
Published at
9/11/2023
Categories
solidprinciples
architecture
softwareengineering
designpatterns
Author
Amburi Roy
Main Article
Categories
4 categories in total
solidprinciples
open
architecture
open
softwareengineering
open
designpatterns
open
SOLID Principles are a set of five design principles in object-oriented programming and software engineering that aim to create robust, maintainable, and scalable software. They provide guidelines for writing clean, flexible, and modular code.
It is a meta acronym where each letter corresponds to another acronym:
- SRP: Single Responsibility Principle
- OCP: Open-Closed Principle
- LSP: Liskov Substitution Principle
- ISP: Interface Segregation Principle
- DIP: Dependency Inversion Principle
SOLID Principles: Single Responsibility Principle (SRP)
Amburi Roy ・ Sep 11 '23
#solidprinciples
#designpatterns
#singleresponsibility
#architecture
- Definition: A class should have only one reason to change, meaning it should have a single responsibility or job.
- Goal: Encourage modular and focused classes, making code easier to understand and maintain.
- Advantages: Improved maintainability, readability, and reusability; easier testing.
- Disadvantages: Over-applying SRP might lead to excessive class proliferation and complexity.
SOLID Principles: Open-Closed Principle (OCP)
Amburi Roy ・ Sep 10 '23
#solidprinciples
#openclosedprinciple
#ocp
#architecture
- Definition: Software entities should be open for extension but closed for modification.
- Goal: Enable adding new features without changing existing code, fostering extensibility.
- Advantages: Reduced risk of introducing bugs, better code organization.
- Disadvantages: Overly adhering to OCP can lead to complex designs.
SOLID Principles: Liskov Substitution Principle (LSP)
Amburi Roy ・ Sep 11 '23
#solidprinciples
#lsp
#liskovsubstitution
#coding
- Definition: Objects of derived classes should be substitutable for objects of their base classes without affecting program correctness.
- Goal: Ensure behavioral consistency when using derived classes, supporting polymorphism.
- Advantages: Polymorphic behavior, easier maintenance.
- Disadvantages: Requires careful adherence, can be challenging to implement correctly.
SOLID Principles: Interface Segregation Principle (ISP)
Amburi Roy ・ Sep 11 '23
#solidprinciples
#designpatterns
#interfacesegregation
#architecture
- Definition: Clients should not be forced to depend on interfaces they do not use. Keep interfaces small and specific.
- Goal: Prevent classes from implementing unnecessary methods, reducing coupling.
- Advantages: Better code organization, improved reusability.
- Disadvantages: Can lead to more interfaces, requiring careful design.
SOLID Principles: Dependency Inversion Principle (DIP)
Amburi Roy ・ Sep 11 '23
#solidprinciples
#designpatterns
#architecture
#dependencyinversion
- Definition: High-level modules should not depend on low-level modules; both should depend on abstractions. Abstractions should not depend on details; details should depend on abstractions.
- Goal: Reduce coupling, promote modular design, and allow for flexible system changes.
- Advantages: Reduced coupling, easier testing, improved maintainability.
- Disadvantages: May introduce complexity when designing abstractions.
Wrap-Up!
SOLID principles offer guidelines to create well-structured and maintainable software. While they provide numerous advantages like better code organization, reusability, and extensibility, they may introduce complexity if applied excessively. Careful application of these principles can lead to more robust and adaptable software systems.
Articles
12 articles in total
Scalability: Vertical, Horizontal, and Hybrid Scaling
read article
Cool Tool: ASDF — A single solution for managing versions
read article
Monolith, Microservices, Mono-Repo
read article
Most commonly used Git command shortcuts
read article
Does Status Code `405` occur during a `GET` request?
read article
Does Status Code `405` occur during a `GET` request?
read article
Design Principles
read article
💋 KISS (Keep It Simple, Stupid)
read article
YAGNI (You Aren't Gonna Need It)
read article
🧺 DRY (Don’t Repeat Yourself)
read article
🪨 SOLID Principles
currently reading
SOLID Principles: Dependency Inversion Principle (DIP)
read article
Featured ones: