Comments (5)
Perhaps we should delete this section, because it's analogous of Single Responsibility Principle (SRP).
from clean-code-php.
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.
@TomasVotruba i create PR for this #170
from clean-code-php.
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.
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)
- Change from JS to PHP in "Functions should only be one level of abstraction" HOT 1
- Database Interface Layer concrete example HOT 1
- Need help to understand the Avoid Conditionals section. HOT 2
- Possibly incorrect: "Zero arguments is the ideal case" HOT 4
- Question on coupling of static classes HOT 4
- Comparison text HOT 1
- Discussion about "Don't add unneeded context" HOT 4
- reusable value-objects w/ better type safety HOT 4
- Persian translation
- "Use default arguments instead of short circuiting or conditionals" HOT 2
- Arabic translation HOT 2
- Indonesia translation
- How to handle un/happy paths HOT 6
- An array is a dumb container of unknown data
- Define constants in those methods where you use, not globally
- adding ndonesian translation section + Refactor code under collapsible markdown
- Problem in the fibonacci function
- Book PHp
- Premier jet du dictionnaire de données
- Cleen code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clean-code-php.