Do you follow SOLID principles? If you don't, you may be doing yourself a disservice

From wikipedia: In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" named by Robert C. Martin in the early 2000s that stands for five basic principles of object-oriented programming and design. The principles, when applied together, intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time. The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is part of an overall strategy of agile and adaptive programming.

S (SRP) - Single responsibility principle states that a class should have only a single responsibility 

O (OCP) - Open/closed principle states that software entities should be open for extension, but closed for modification.

L (LSP) - Liskov substitution principle states that objects in a program should be replaceable with instances of their sub-types without altering the correctness of that program. (See also design by contract.)

I (ISP) - Interface segregation principle states that many client-specific interfaces are better than one general-purpose interface.

D (DIP) - Dependency inversion states that we depend upon abstractions not concretions.

You will find that many higher level jobs, specifically jobs for domain, data or enterprise level architecture will require you know what SOLID is and abide by its principles. As you will see, SOLID is fairly straight-forward, however if you find that you don't understand any of the principles stated here, SOLID principles hedges against anti-patterns as well as problems with application coupling, rigidity and fragility. I urge you to do further research so you understand these principles. They are basic and fundamental principles that any good program would know.

1 comment: