Plan First Then Code

I’m between a Beg-Int¬†software developer. I’ve taken a lot of MOOC programming courses through Coursera, Udacity, and Stanford. These are some basic lessons I’ve learned through class projects.

Ask questions before you start coding

For most people, I think the first response to seeing a coding problem is to start coding up a solution immediately. There are a couple reasons why: you want to see results immediately. I’ve found that sometimes I do not understand what I’m being asked to deliver and that leads to bad results, including wasted code and re-work. It is important to minimize any miscommunication from the beginning.

Understand the requirements

This is closely tied to the first point but I think whether you are working on a homework assignment or reviewing new work software requirements (specifications), you need to read the document a couple of times. Allow enough time to analyze and understand what does not make sense about the document. Get clarifications before you start to do any coding or planning of your solution. The worst case is when I think I understand the requirements, code to spec, and then find out the results did not meet the requirements.

Plan before you start coding

Even when working on programming homework assignments, it is rarely the case where you will be writing code from scratch. It is more often the case that you will be given a starter template (say with a game or rendering engine) or you will be working with an existing code base (with multiple authors). It is really important to understand what the existing code is doing so you will be able to use existing functionality and avoid reinventing the wheel. Also you will need to use existing functionality as it was intended to be used (pray that your co-workers practice good documentation).

I’ve found that writing pseudo-code to conceptualize a solution is better than not. Even if you’re working on tight deadlines, I have usually experienced that when I start to code without any planning, it will take me longer to debug or come to a cleanly working solution.

Ask questions after you start coding

While working on a Front-end Web Developer certificate, I felt like the first few projects were pretty simple and was able to complete one project per week. I fell behind on the fourth project, in Web Performance Analysis. I got very frustrated researching tons of articles and doing a lot of coding and not coming close to the requirements. In retrospect, the issues were a combination of I did not understand the requirements well and the requirements were not clearly written. If I had asked more questions up front and during my period of frustration, I would have saved money (the tuition cost of the course). In my upbringing, I was somewhat discouraged from asking too many questions and being considered “dumb” but in reality, even if you ask simplistic questions (to help clarify what you don’t understand), it will end up saving time and money and could lead to asking more intelligent questions down the road.

Summary

I think all the points of this article are pain points that every developer learns through experience (maybe you have to experience it in order to learn from it) but hopefully it will be useful to others.

Advertisements