S.O.L.I.D The First 5 Principle Of Object Oriented Design
Introduction SOLID is an acronym for the first five object-oriented design (OOD) principles by Robert C. Martin (also known as Uncle Bob ). Note: While these principles can apply to various programming languages, the sample code contained in this article will use PHP. These principles establish practices for developing software with considerations for maintaining and extending it as the project grows. Adopting these practices can also help avoid code smells, refactor code, and develop Agile or Adaptive software. SOLID stands for: S - Single-responsibility Principle O - Open-closed Principle L - Liskov Substitution Principle I - Interface Segregation Principle D - Dependency Inversion Principle In this article, you will be introduced to each principle individually to understand how SOLID can help make you a better developer. Single-Responsibility Principle Single-responsibility Principle (SRP) states: A class should have one and only one reason to change, meaning that a class