Adding additional subsections -- feel free to cherry-pick! Feedback welcome.#2
Adding additional subsections -- feel free to cherry-pick! Feedback welcome.#2zacharyaanglin wants to merge 4 commits into
Conversation
|
Wow! Thanks for your contribution! Would you mind squashing your history into four commits? |
Replaced auto-removed space Actually replaced trailing spaces Added back to top link. Fixed typo in text. Edited mid-sentence line break `Functions should only be one level of abstraction`
Edited wrapping lines Removed title case on Avoid Side Effects `Avoid side effects`
2ec3d81 to
76a4494
Compare
I think I managed this -- good learning experience, too! Please let me know if you spot any other issues. |
|
@zedr -- how should we proceed here? |
|
|
||
| ### Functions should only be one level of abstraction | ||
|
|
||
| When you have more than one level of abstraction, your function is usually doing too |
There was a problem hiding this comment.
I feel this is too similar to section Functions should do one thing
There was a problem hiding this comment.
I agree. Adapted from https://github.com/jupeter/clean-code-php#functions-should-only-be-one-level-of-abstraction -- it does appear to be a rephrasing of Functions should do only one thing.
|
|
||
| **[⬆ back to top](#table-of-contents)** | ||
|
|
||
| ### Don't use flags as function parameters |
|
|
||
| ### Don't write to global functions | ||
|
|
||
| Polluting globals is a bad practice in many languages because you could clash |
There was a problem hiding this comment.
I don't understand this one. The function config() is not global, but defined at the module level, which is fine to do.
However, you could do the following:
globals()['foo'] = 1
This would modify the global namespace, which is seldom necessary and would be considered bad practice (use modules instead).
Feel free to open a new pull request if I have misunderstood this section.
There was a problem hiding this comment.
I think you're right. Subsection adapted from https://github.com/jupeter/clean-code-php#dont-write-to-global-functions. I suppose PHP requires that you explicitly declare namespaces, so the same module-scoping policy doesn't apply?
Functions should only be one level of abstractionClean Code PHPhas some additional thoughts that I did not include (in fact, the section this PR andClean Code Javascripthave marked as Good is also labeled Bad too in that repo). Very interested in any potential feedback on which direction this project should take.Don't use flags as function parametersAvoid side effectsDon't write to global functions