ENTRY TO SOLID PRINCIPLES





SOLID is a design principle that helps us to deal with most problems in the design of applications.
The term "SOLID" refers to five principles for designing and making comprehensible and flexible software designs.
Michael Feathers initially introduced it.

S.O.L.I.D

  • Single Responsibility Principle
  • Open-Close Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle


A single part of the software's functionality should be the duty of every module / class. And the class should also encapsulate this obligation completely. Every class and section will work on a mission concurrently. With the concept of Single Accountability, classes become smaller and simpler, and the code becomes less fragile too.

The Advantages

  • ·       It is easier to understand the class.
  • ·       The class is more easy to keep.
  • ·       The class can be reused further.
  • ·       The class can be parallel development.
  • ·       It is easier to loose coupling.


Entities of software like classes, modules, functions and etc. The extension should be open, but the alteration should be locked. Any new features should be introduced by adding new classes, attributes and methods rather than modifying previous or present ones.
Considered by Robert C. Martin as the most significant theory.

Guidelines for Implementations

Implementing the new feature on existing derived groups.
Allow customers to use abstract interfaces to access the original class.
This therefore means that it is always recommended that you build classes and keep the original implementation unchanged at any point when the user needs change rather than changing the current code.



This principle was introduced by Barbara Liskov.
The theory specifies that objects of the super class can be substituted without splitting the specification by objects of their sub classes.
Devolved forms should be completely substitute for their underlying styles. This concept is called a powerful behavioral sub typing, a certain sub typing relationship.

Guidelines for Implementations

The sub type can not cast any new exceptions.
Current derived classes only apply to existing classes without replacing them.
Customers should not know what sub type they name.



There are many smaller and related interfaces to divide up one fat interface so consumers can learn about its relevant interfaces.
This principle was introduced by Robert C. Martin.
Easier to breach the rule, especially when the program gradually increases as new requirements arise and more functionality must be introduced.
The Interface Segregation Principle aims, by separating the device into multiple independent sections, at reducing the side effects and speed of the required changes.


The interactions between high- and low-level modules should be seen as an abstract interaction.
This kind of programming typically lacks enough abstraction layers and results in a very closely linked framework, as each module refers directly to the lower modules.
While writing software, it is extremely common to incorporate it so that every function or system applies directly to its employees and does the same.



Comments

Popular Posts