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.

Remember - Photo by Nick Fewings on Unsplash

Here's my interpretation, with my own comments, on the ten items listed on that article:

  1. Divide and conquer: the most fundamental principle, not only in programming, but to solving almost any problem.
  2. Make things embarrassingly obvious: I've tried to look clever a lot of times. And I can tell you, it's not clever.
  3. Resolve magic numbers and strings: use constants.
  4. Fight nesting: no if inside if inside if (and callback hell, of course).
  5. Configure hard: use an external config file.
  6. Frameworks are there to help: don't reinvent (unless for learning).
  7. Unless it is a prototype — write tests: no comment - speaks for itself.
  8. Use version control: why this is not point #0?
  9. 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?)
  10. Question trends: also javascripty. New is not better.
Daniel Gómez

Daniel Gómez

Dani tuvo un Oric 1 como primer ordenador, al menos hace 100 años. Ahora combina la programación con sus dos bandas y sus tres hijos. La leyenda dice que tiene un hermano gemelo idéntico y que trabajan como equipo.

comments powered by Disqus

Estás a un paso de conocer a tu mejor socio.