Skip to content

Instantly share code, notes, and snippets.

@morganick
Last active February 14, 2018 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganick/af96c1b4c9264eebf0385c8db6c1ce40 to your computer and use it in GitHub Desktop.
Save morganick/af96c1b4c9264eebf0385c8db6c1ce40 to your computer and use it in GitHub Desktop.
@searls needed some convincing
Reasons side effects are not bad but evil.
- Having a side effect means you are always working, testing, and thinking about more than one unit
- They often break one or more of the following principles SRP, Law of Demeter, Encapsulation, etc
- Creates known & unknown implicit dependencies
- Side effects can also have side effects (ahem... ActiveRecord callbacks)
- Causes more code churn. Changes in one area cascade to other areas.
- Makes test setup harder. Your test setup contains objects that are seemingly unrelated to the code under test.
Alternate titles:
- Learning to Shave a Yaks while Programming
- Side Effects are like CSS for the rest of your code; all changes cascade.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment