The SOLID era
There are three things that early programmer knows in the object-oriented programming (OOP) concept.
- OOP Pillars: Abstraction, Polymorphism, Inheritance, Encapsulation. It is a basic pillar that programmer should know how to develop software with OO in mind.
- SOLID Principle: developer principles when want to build solution with OOP Pillars.
- Design Patterns: a ready to use recipe that can be used by the programmer. The recipe includes SOLID principle in adoption.
- OOAD (Object Oriented Analysis and Design): a structured method to develop solution based on OO.
What is SOLID?
SOLID is an abbreviation of:
- Single Responsibility: Class should only changes because its main responsibility. Therefore, the class should be independent for changes do not depend on the other classes. We can do this principle by applying abstraction pillar.
- Open Closed Principles: Class should avoid modification, but it should extend when needed. We can do this principle by applying Inheritance and interface (Encapsulation) pillar.
- Liskov Substitution: Children class can replace the parent class when necessary. Therefore, the dependency with specific classes can be avoided and substituted with other classes. This principle can be applied by using Inheritance and Polymorphism.
- Interface Segregation: Breakdown the interface into smaller interfaces, never force a class to implement a method. This principle can be applied by using interface (Encapsulation) and abstraction pillar.
- Dependency Inversion: (Parent/Abstract) High level classes never depends on (Children/Concrete) low level classes. Program in interface not in implementation. This principle can be applied by using encapsulation and abstraction pillar.
The Analysis in SOLID Principle
If you read my statement about what pillar that related with SOLID, we will find some 'secret' behind of the concept. The SOLID principle fulfils low in coupling and high in cohesion. In simple definition 'class should strong enough to break, and relation between classes should be weak enough to be independent'. Please see the illustration below
Want to see and example of SOLID Principle? Just visit the VSID YouTube Channel How do you think? is the SOLID principle still relevant? put your comment