SOLID: Software Design Principles

SOLID: Software Design Principles

ยท

2 min read

S.O.L.I.D design principle comes from Object oriented programming guidelines. It is designed to develop software that can be easily maintained and extended; prevents code smells; easy to refractor; promotes agility and finally incorporates rapid + frequent changes quickly without bugs.

Generally, technical debt is the result of prioritizing speedy delivery over perfect code. To keep it under control - use SOLID principles, during development.

Robert Martin, is credited with writing the SOLID principles and stated 4 major software issues if S.O.L.I.D is not followed diligently. They are :

  • Rigidity:

    • Implementing even a small change is difficult since it's likely to translate into a cascade of changes.
  • Fragility:

    • Any change tends to break the software in many places, even in areas not conceptually related to the change.
  • Immobility:

    • We're unable to reuse modules from other projects or within the same project because those modules have lots of dependencies.
  • Viscosity:

    • Difficult to implement new features the right way.

SOLID is a guideline and not a rule. It is important to understand the crux of it and incorporate it with a crisp judgement. There can be a case when only few principles out of all is required.

S.O.L.I.D stands for:

  • Single Responsibility Principle (SRP);
  • Open Closed Principle (OCP);
  • Liskov Substitution Principle (LSP);
  • Interface Segregation Principle (ISP);
  • Dependency Inversion Principle (DIP);

Single Responsibility Principle (SRP)

Every function, class or module should have one, and only one reason to change, implies should have only one job and encapsulate within the class (stronger cohesion within the class).

It supports "Separation of concerns" โ€” do one thing, and do it well!"

To continue reading, head over to Box Piper source.

To read more such interesting topics, follow and read BoxPiper blog.

Support my work and buy me a Coffee. It'll mean the world to me. ๐Ÿ˜‡

Did you find this article valuable?

Support Box Piper by becoming a sponsor. Any amount is appreciated!

ย