The secrets to become a ninja programmer.

A note to myself, 10 years ago.

Sunny R Gupta
VentureFlash

--

I have been a coder for the past 9 years. I've literally been hitting at the keyboard trying to make things happen. On the way I've had my fair share of surprises, and if you are anything like me when I started out with programming you would need this advice.

The first thing any developer should know is the art of programming. No, its not about writing beautiful syntax in a fancy font. The art of programming is something that would make your code much more beautiful.

So lets start by defining beautiful code:

  1. Code that is easy for a third party to understand: Always believe that the person who is going to read your code is a violent psychopath who knows where you live.
  2. Code that explains itself: The next time you are tempted to write a comment, try and think how could you change the code so that the comment is no longer necessary.
  3. Think: This is often the most important step and sadly the least used.

How difficult would it be for you to follow the three steps above?

While we are talking about what to do and what not to, let me point out a few common mistakes I see my friends do more often than not.

  1. Lets take the most common situation of searching for a code snippet to do a small task. (anything like appending an array to another or something like finding the index of an element in an associative array).
    In most cases we simply do a Google search for the task, click on the first StackOverflow/Codeplex/Experts-Exchange link that we see, copy the accepted answer and continue.
    A common problem in these situations is that we tend to ignore the comments that the accepted answer may have.
    I've often encountered some gem solutions to problems by actually reading the comments and having a look at all the solutions a problem is given.
    Trust me, when it comes to writing sustainable code, you need to do your fair bit of research.
  2. Another situation I come across often is the way we start coding. Developers often tend to start coding as soon as a task is assigned to them. Occasionally the task may be trivial that it may not require any brainstorming, but often I recommend developers to take up a pen paper and write down the steps they think would solve the problem (remember pseudo-codes?). This step alone has saved me hundreds of hours of debugging time and it always helps to have a written plan of what you are coding.

Let me know if you actually tried any of the above and how did it help you if at all — sunny@madhues.com

Note: I am not a software development guru or an authority on programming, these are just a few tips/suggestions that I’ve accumulated over time.

--

--

Sunny R Gupta
VentureFlash

Sr. Director of Technology @ JioCinema / Viacom18, ex-Atlassian, Frontend Enthusiast