But did you read the docs?

How I learned to breathe before I code.

Scene

You have a problem (because coding). You may not want to solve it yourself or maybe you have a gut feeling that there’s already a solution out there. NPM to the rescue!

Once you get there, you’re hoping to find a nice package that will help solve your problem (or do the work for you). You stumble upon a cool name, briefly skim over its description and you’re sold. This is exactly what you need.

Opens terminal and types npm i a-dope-package — S

Victory! Right?

So you’ve imported the package and attempt to use it how you think it should work, but unfortunately with every line of code you write/delete you’re basically reversing and accelerating into a brick wall. What the hell, bro?

It’s easy to fall into the trap of what I call “just coding through it”. In this process, you go straight to your editor and just code by way of brute force. Sometimes things will work, sometimes you feel like you’re the worst developer on the planet, the world is crumbling and there’s no milk left for your cereal. Avoid this feeling by taking a breath before you code. Before opening your editor, channel your inner Phil Jackson and get into your pre-code zone. Here’s my pre-code routine:

  • Understand the problem that I’m attempting to solve
  • Ask questions!
  • Write out what I want to accomplish
  • Identify resources
  • READ. THE. FREAKING. DOCS.

Apologies for yelling through text, I think that last point was just to remind myself not to take shortcuts. When taking shortcuts and attempting to plug and play, you open the door for all types of issues. I found that when I take the time to plan before I code and focus on small details…surprise, I write better code! Reading through documentation can be a pain, but I’ve learned that it’s a necessary evil. The time you spend upfront reading through the docs will save you time in the future when you’re building or even maintaining your project.

As always, learning to code is a process. You get better by developing healthy habits. Figuring things out as you go is natural, but the better equipped you are, the less time you’ll spend cursing the coding gods or driving into that brick wall.

You know what’s more important than immediately starting to write code? Reading documentation.

End Scene

Feel free to share your pre-code routines. I’m always open to suggestions!