Git Product home page Git Product logo

Comments (5)

peter-gribanov avatar peter-gribanov commented on May 18, 2024

Perhaps we should delete this section, because it's analogous of Single Responsibility Principle (SRP).

from clean-code-php.

TomasVotruba avatar TomasVotruba commented on May 18, 2024

Perhaps we should delete this section, because it's analogous of Single Responsibility Principle (SRP).

Agreed. The logic is basically identical + OOP promotes more robuts behavior

Could you send PR to delete https://github.com/jupeter/clean-code-php#functions-should-do-one-thing ?

from clean-code-php.

peter-gribanov avatar peter-gribanov commented on May 18, 2024

@TomasVotruba i create PR for this #170

from clean-code-php.

iainfogg avatar iainfogg commented on May 18, 2024

Bob Martin's "Clean Architecture" book says that "a function should do one, and only one, thing" is different to SRP, I don't know if that sways your thinking about keeping this section? I'm new here, but I'd personally think it's good to keep, maybe with a better example as Peter suggested.

Of all the SOLID principles, the Single Responsibility Principle (SRP) might be the least well understood. That’s likely because it has a particularly inappropriate name. It is too easy for programmers to hear the name and then assume that it means that every module should do just one thing. Make no mistake, there is a principle like that. A function should do one, and only one, thing. We use that principle when we are refactoring large functions into smaller functions; we use it at the lowest levels. But it is not one of the SOLID principles—it is not the SRP.

from clean-code-php.

TomasVotruba avatar TomasVotruba commented on May 18, 2024

The logic is same for class/method/property, so it only needs to be said once.

See Occams razor.

from clean-code-php.

Related Issues (20)

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.