Think twice, code once

As developers, our most important job is to solve problems.

We usually accomplish this goal by writing code - like implementing new features and fixing bugs. Code is the go-to tool in our toolbelt for any problem that comes our way. Our brains are wired to immediately think "how can I solve this problem using code?"

That's not a bad thing. It's what we're paid to do.

The issue happens when we skip the problem solving part and dive straight into coding without a second thought. When we immediately crack open our editor and get to work, without really understanding what we're building yet.

That's why I recommend you to stop for a moment when you receive a new task, encounter a new problem or want to start on a new feature. Resist the urge to jump into coding right away.

Instead, work the problem. Understand the exact requirements of what you're trying to build. Double check your understanding with someone else, like your client, project manager or developer colleague to make sure you're on the same page.

Only when you fully understand the problem at hand can you begin to conjure up a solution. This is the second point where you might get tempted to start writing some code - but it's still too early.

Instead, sketch out your potential soluton on paper. Write a step-by-step guide to yourself of how you're going to implement this new feature or solve the given problem. You don't need to know everything yet, but try to be as specific as possible.

This list will uncover several potential issues before you've even started coding. And, as you can imagine, this is a much better time to discover those issues. Certainly better than when you've spent 7 hours coding down the wrong rabbit hole only to realize a fundamental flaw in your solution (speaking from experience here...)

The list will also serve as an excellent guide and TODO-list for when you finally start coding. And since you've already ironed out all the potential pitfalls, writing the actual code will be much simpler.

Think twice, code once.