Merge pull request #2 from darmen/master

Update readme.md
This commit is contained in:
Tran Duc Thang 2018-10-01 16:46:30 +07:00 committed by GitHub
commit f5609182f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -1,18 +1,23 @@
## SOLID Principles Examples in PHP
### Single Responsibility Principle
A class should have one, and only one, reason to change. [Example](./1-single-responsibility-principle.php)
### Single Responsibility Principle ([Example](./1-single-responsibility-principle.php))
This principle is about **actors and high level architecture**.
> A class should have one, and only one, reason to change.
### Open Closed Principle
A class should be open for extension, but closed for modification. [Example](./2-open-closed-principle.php)
### Open Closed Principle ([Example](./2-open-closed-principle.php))
This principle is about **class design and feature extensions**.
> A class should be open for extension, but closed for modification.
### Liskov Substitution Principle
Derived classes must be substitutable for their base classes. [Example](./3-liskov-substitution-principle.php)
### Liskov Substitution Principle ([Example](./3-liskov-substitution-principle.php))
This principle is about **subtyping and inheritance**
> Derived classes must be substitutable for their base classes.
### Interface Segregation Principle
Many client-specific interfaces are better than one general-purpose interface. [Example](./4-interface-segregation-principle.php)
### Interface Segregation Principle ([Example](./4-interface-segregation-principle.php))
This principle is about **business logic to clients communication**.
> Many client-specific interfaces are better than one general-purpose interface.
### Dependency Inversion Principle
Depend upon abstractions. Do not depend upon concretions. [Example](./5-dependency-inversion-principle.php)
### Dependency Inversion Principle ([Example](./5-dependency-inversion-principle.php))
> This principle wires up all **other four principles in a single circle**.
Depend upon abstractions. Do not depend upon concretions.
#### For more information about *Object Oriented Design Principles*, you can refer [this slide](https://viblo.asia/thangtd90/posts/pVYRPJPmG4ng)