Skip to content

Adding additional subsections -- feel free to cherry-pick! Feedback welcome.#2

Closed
zacharyaanglin wants to merge 4 commits into
zedr:masterfrom
zacharyaanglin:master
Closed

Adding additional subsections -- feel free to cherry-pick! Feedback welcome.#2
zacharyaanglin wants to merge 4 commits into
zedr:masterfrom
zacharyaanglin:master

Conversation

@zacharyaanglin

@zacharyaanglin zacharyaanglin commented Mar 31, 2019

Copy link
Copy Markdown
Contributor

@zacharyaanglin zacharyaanglin changed the title Added Functions should only be one level of abstraction subsection. Adding additional subsections -- feel free to cherry-pick! Feedback welcome. Mar 31, 2019
@zedr

zedr commented Apr 1, 2019

Copy link
Copy Markdown
Owner

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`
@zacharyaanglin zacharyaanglin force-pushed the master branch 2 times, most recently from 2ec3d81 to 76a4494 Compare April 2, 2019 00:30
@zacharyaanglin

Copy link
Copy Markdown
Contributor Author

Wow! Thanks for your contribution! Would you mind squashing your history into four commits?

I think I managed this -- good learning experience, too! Please let me know if you spot any other issues.

@zacharyaanglin

Copy link
Copy Markdown
Contributor Author

@zedr -- how should we proceed here?

Comment thread README.md

### Functions should only be one level of abstraction

When you have more than one level of abstraction, your function is usually doing too

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this is too similar to section Functions should do one thing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md

**[⬆ back to top](#table-of-contents)**

### Don't use flags as function parameters

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread README.md

### Don't write to global functions

Polluting globals is a bad practice in many languages because you could clash

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@zedr

zedr commented Apr 19, 2019

Copy link
Copy Markdown
Owner

Cherry picked 23d88f6 and 26bc828. Sorry for the delay.

@zedr zedr closed this Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants