Sunday, June 20, 2021

SOLID development principles in brief explanation

 solid development principles is a very popular development methodology. we might encounter an interview question about what is SOLID.

since we usually have less time to prepare for tons of interview question. I try to describes five principles in short.

S: Single Responsibility Principle

Object should only have single single responsibility. best example database persistence vs file persistence

we should not bundle them together.

O: Open and Close Principle

Object is open for extension, but not for modification. for any new enhancement or new feature, we should keep the current interface intact. and extend a new interface base on the current one.

L: Liskov Substitution Principle

the interface take the type of parent, should not break if it takes the type of its child.

I : Interface Segregation Principle

split the interface for each individual client, better than have one generous interface for all. it is better and easy for maintenance.

D: Dependency Inversion Principle

  • High level of object never depends on the low level of object.
  • Abstractions should not depend on details, but details should depend on abstraction.



No comments:

Post a Comment