Falando sobre SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion)

Just another java blog

Object oriented has some principles that when you follow them the non-functional attributes of your codes will be enhanced. SOLID is an acronym for 5 principles what introduced by Robert C Martin and acronym was create by Michael Feathers.

  • Single Responsibility Principle : Every class should have just One responsibility and encapsulate its responsibility entirely. The Most important reason of this principle is that there must be just one reason for changing a class. For example when you want to read a config file for database connection information and connect to database you must have two separate class, First for config file reading and the other for connection to database.
  • Open Close Principle: Every class should be open for extending and closed modification. When you write a class and you are sure then new features and enhancements must be added with extending class not with modification source code. So your…

View original post mais 226 palavras