Keep your code testable
Always consider whether the code you are writing is easily testable, as the same qualities which lead code to be easily testable overlap with those of good code in general. An easy way to do this is to keep three key considerations in mind when deciding on how to structure the functionality of your app.
What you want:
Isolated code: Code that relies only on its arguments
Pure functions: Code that produces output rather than side effects
Modularity: Code that only does one thing. If code needs to do multiple things, it is good practice to compose it of smaller, more focused units.comments powered by Disqus