Know Your Tools

March 7, 2018

programming

3 min read

Spike Your Productivity

Get to know your tools! Your tools are part of what sets you apart as a developer. Using your libraries effectively means less code. Less code means less surface area for bugs and less time for your peers to understand and get productive with your code.

Many times I've seen people write some complex piece from scratch only to have me review their code, point them to a library we've already got included in our project, and showing them that what they've done is already implemented there. Guess who had to redo their work using the library?

Take the Time

Spending that extra bit of time to thoroughly understand everything that your chosen tool does is well worth the investment. Take however long it takes to feel confident that you know it inside and out. It can be anywhere from a few hours for a smaller library to days or even weeks for larger projects or frameworks. The more your app relies on the tool, the more sure you should be that you know it intimately.

If you choose to use Firebase for example, you're going to be relying on it for your entire backend, which means the majority of your code will be interacting with it. You better make sure you know everything that Firebase can and can't do for you before you start writing production code.

Small Proofs of Concept Can Speed You Up

Making small throwaway tech demos can really help in this. When I was working on a bitcoin project, I was learning bitcoinjs-lib. I created a simple app with Create React App that generated a Bitcoin mnemonic phrase and then generated a number of Hierarchical Deterministic (HD) addresses. It only took me a couple hours! This simple test helped me understand the bitcoinjs-lib tools much quicker than if I had endlessly pored through the documentation, and saved my codebase from exploratory code.

I usually stick these small projects in a subdirectory in my project called poc (proofs of concept).

An Exception: Lodash

There's an exception to this rule: Lodash. There's so much in Lodash that I don't recommend knowing the whole API front to back. Instead, I suggest picking through their docs whenever you encounter an issue that you think is probably a common problem.

For example, if you think "I need to sort these items in a pretty standard way, and I don't want to labour over Array.prototype.sort. Lodash must have a way to do this." You're right! Head over to their docs and you'll happily discover orderBy. Keep doing this as I have and you'll eventually learn a lot of the lodash API.