An open API service indexing awesome lists of open source software.

https://github.com/anayarojo/solid-examples

Repository for see examples of SOLID principles
https://github.com/anayarojo/solid-examples

csharp javascript php solid typescript

Last synced: 3 months ago
JSON representation

Repository for see examples of SOLID principles

Awesome Lists containing this project

README

          

# SOLID examples

Repository for see examples of SOLID principles

### S – Single Responsibility Principle (SRP)
This principle is about **actors and high level architecture**.
> A class should have one, and only one, reason to change.

[PHP](./php/01-single-responsibility-principle.php) /
[C#](./c%23/01-SingleResponsibilityPrinciple.cs) /
[TS](./ts/01-singleResponsibilityPrinciple.ts)

### O – Open/Closed Principle (OCP)
This principle is about **class design and feature extensions**.
> A class should be open for extension, but closed for modification.

[PHP](./php/02-open-closed-principle.php) /
[C#](./c%23/02-OpenClosedPrinciple.cs) /
[TS](./ts/02-openClosedPrinciple.ts)

### L – Liskov Substitution Principle (LSP)
This principle is about **subtyping and inheritance**
> Derived classes must be substitutable for their base classes.

[PHP](./php/03-liskov-substitution-principle.php) /
[C#](./c%23/03-LiskovSubstitutionPrinciple.cs) /
[TS](./ts/03-liskovSubstitutionPrinciple.ts)

### I – Interface Segregation Principle (ISP)
This principle is about **business logic to clients communication**.
> Many client-specific interfaces are better than one general-purpose interface.

[PHP](./php/04-interface-segregation-principle.php) /
[C#](./c%23/04-InterfaceSegregationPrinciple.cs) /
[TS](./ts/04-interfaceSegregationPrinciple.ts)

### D – Dependency Inversion Principle (DIP)
This principle wires up all **other four principles in a single circle**.
> Depend upon abstractions. Do not depend upon concretions.

[PHP](./php/05-dependency-inversion-principle.php) /
[C#](./c%23/05-DependencyInversionPrinciple.cs) /
[TS](./ts/05-dependencyInversionPrinciple.ts)

## Targets of SOLID

- Cleaner code
- Maintanable code
- Easy to change
- Easy to extend

#### References

(English)

https://www.digitalocean.com/community/conceptual_articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

https://hackernoon.com/solid-principles-made-easy-67b1246bcdf

https://itnext.io/solid-principles-explanation-and-examples-715b975dcad4

https://www.baeldung.com/solid-principles

(Spanish)

https://openwebinars.net/blog/que-es-solid/

https://profile.es/blog/principios-solid-desarrollo-software-calidad/

#### Forked from
https://github.com/wataridori/solid-php-example