SOLID

"SOLID" is an acronym that represents a set of five design principles in object-oriented programming and software development. These principles were introduced by Robert C. Martin and are intended to guide developers in creating more maintainable, flexible, and scalable software. The SOLID principles are:


[S] Single Responsibility Principle (SRP)

"A class should have only one reason to change."

Meaning that a class should have only one responsibility or job. This principle encourages a separation of concerns and helps maintainability.

[O] Open/Closed Principle (OCP)

"Software entities (classes, modules, functions) should be open for extension but closed for modification."

This means that you should be able to add new functionality without altering existing code. This principle supports the idea of using abstractions and interfaces.

[L] Liskov Substitution Principle (LSP)

"If class A is a subtype of class B, we should be able to replace with without disrupting the behavior of our program."

Subtypes must be substitutable for their base types without altering the correctness of the program. In other words, objects of a superclass should be able to be replaced with objects of a subclass without affecting the functionality of the program.

[I] Interface Segregation Principle (ISP)

"A class should not be forced to implement interfaces it does not use."
This principle promotes the idea of having small, specific interfaces rather than large, general-purpose ones. Clients should not be forced to depend on interfaces they do not use.

[D] Dependency Inversion Principle (DIP)

"Depend on abstractions, not on concretions."
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. This principle encourages the use of dependency injection and inversion of control to achieve a flexible and decoupled architecture.

Nenhum comentário:

Postar um comentário

Internet of Things (IoT) and Embedded Systems

The  Internet of Things (IoT)  and  Embedded Systems  are interconnected technologies that play a pivotal role in modern digital innovation....