Harold Serrano

View Original

How to improve your coding skills- Scribble first, code second

I want to share with you a nice little tip to improve your coding skills.

Scribble first, code second.

I am a visual person. If I can see the problem, then I can find a solution. So what I try to do is scribble down the algorithm I am about to implement. I try to draw pictures showing the flow, steps of the algorithm. I even try to scribble the problems that may arise at particular steps. Once I have a good idea how to implement it then and only then do I start coding.

Now if you are not a visual person, this trick may not work for you. Nonetheless you may want to try to do something similar. Go take a long walk, go for a hike, ride your bike, etc, and think how you may implement the algorithm. Once you are ready, fire up your laptop and code away.

It may seem as if you are wasting your time, but I have found out that when I do this, I end up with less bugs to fix.

Try out this trick, you may end up being more productive.

Below is a screenshot of some scribbles I was doing while implementing parts of the EPA algorithm for determining the penetration vector of a collision.

Implementing part of the EPA algorithm