Code Monkey home page Code Monkey logo

solid-php-example's Introduction

SOLID Principles Examples in PHP

Single Responsibility Principle (Example)

This principle is about actors and high level architecture.

A class should have one, and only one, reason to change.

Open Closed Principle (Example)

This principle is about class design and feature extensions.

A class should be open for extension, but closed for modification.

Liskov Substitution Principle (Example)

This principle is about subtyping and inheritance

Derived classes must be substitutable for their base classes.

Interface Segregation Principle (Example)

This principle is about business logic to clients communication.

Many client-specific interfaces are better than one general-purpose interface.

Dependency Inversion Principle (Example)

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

solid-php-example's People

Contributors

abdouskamel avatar darmen avatar wataridori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solid-php-example's Issues

The example you show does not conform to Interface Segregation Principle

Although, you are segregating (breaking / granularizing) a larger Interface into smaller interfaces, however only granularizing a large interface into smaller interfaces does not serve the purpose of Interface Segregation Principle in S.O.L.I.D.

In object-oiented programming, the actual purpose of exposing the subsets of the functions of a (serving) implementation class to the client-code, through multiple (segregated) interfaces is to enable the client-side code to access only interface-specific (contextual / subset) functionality of the (serving) implementation class.

See P-15 and P-13 on the link below to understand the purpose of Interface Segregation Principle. That is a powerful feature for Extensibility: Interface Segregation Principle.

https://www.codeproject.com/Articles/18743/Interfaces-in-C-For-Beginners

Reusing/adapt your code

Hi!

Can you please add an MIT or CC license?
I would like to reuse your examples on my website.

Best regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.