JSBits #3: 10 things to remember
Diario del capitán, fecha estelar d68.y38/AB
Here's another JavaScript bits we wanted to share with you. This time around, I want to share my ten things to remember when writing code, which is something I borrowed from this article from Medium: Ten things you will eventually learn from JavaScript projects.
Here's my interpretation, with my own comments, on the ten items listed on that article:
- Divide and conquer: the most fundamental principle, not only in programming, but to solving almost any problem.
- Make things embarrassingly obvious: I've tried to look clever a lot of times. And I can tell you, it's not clever.
- Resolve magic numbers and strings: use constants.
- Fight nesting: no if inside if inside if (and callback hell, of course).
- Configure hard: use an external config file.
- Frameworks are there to help: don't reinvent (unless for learning).
- Unless it is a prototype — write tests: no comment - speaks for itself.
- Use version control: why this is not point #0?
- Manage state responsibly: probably the most javascripty item of the list. We're obsessed with it. In part because it's not solved in the language (lots of ways to manage state). In part, because it's not solved in any language (maybe in Clojure?)
- Question trends: also javascripty. New is not better.
comments powered by Disqus