Key points on Object-Oriented "SOLID" Principles

Key points on Object-Oriented SOLID Principles

The Single Responsibility Principle

- One purpose to use.

- One reason to change (bug fix and new features with new version release).

- Only allowed to fix bugs.

- Only allowed for new features (in the new version release).

The Open/Closed Principle

- Base interface/class are only allowed for extensions.

- Base interface/class attributes are not allowed for modifications.

- It means sub/derived interface/class are not allowed to change base attributes.

The Liskov Substitution Principle

- The overridden method shouldn’t remain empty.

- The overridden method shouldn’t throw an error.

- Base interface/class behaviour should not go for modification (rework) as because of derived class behaviours.

Interface Segregation Principle

- Large interface/class should be split into small.

- Attach/Keep the attributes and behaviours in relevant and appropriate interfaces/classes.

- Skills 1 to 5. Emp1 has skills 1,3,5. Emp2 has skills 2,4. Emp3 has skill 5.

- Segregate all Skills individually and attach skills with Emp who has those skills set.

Dependency Inversion Principle

- The high-level module should not depend on the low-level module. Both should depend on abstraction.

- Modules/Objects should provide customizable behaviour at any point of extension and object creation.

To view or add a comment, sign in

More articles by Rahamathullah S

Explore content categories