L
o
a
d
i
n
g
.
.
.
https://michele.zonca.org

Code Cleaning

By Michele Zonca

9 January 2010

2 minutes to read

One of the most important assets of a IT startup is a good source code. This is exactly what i tried to explain in my last lecture at University of Milano Bicocca, showing how we are writing the Mashape’s source code.

I would like to write down some of the key ideas of that lecture into this blog, so here is the first step: the source code.

The code has to be clean.

It is sometimes underestimated but, in my opinion, is really important to use tools like “Source –> Format” present in Eclipse IDE.

We know there are several coding convention for every programming language, but, sometimes, these are not enough or a developer prefers simply not to follow them or maybe he is used to develop in a different programming language, so he adheres to the coding conventions of some other language..

This leads to a simple fact: everyone has its own coding style. This is not a problem unless a group of developer is trying to create a valuable code, that will be eventually put under the focus of a technical due diligence.

The first reason to use source formatting tools is to make the code looking more homogeneous. During a technical analysis, the neatness and the order of the source code will be the first impression given to the audience. Short lines, good indentation, white spaces in the right positions increase, in my opinion, the code readability. Moreover, this uniformity limits the concept of code ownership.

The second is a more technical advantage. I think that a svn diff is more productive when each developer commits source code formatted with the same rule set.. and when you have to do some commit review, this will make you save a lot of time..

The importance of having coding standards and the concept of collective code ownership are part of The Rules of Extreme Programming

The implementation of your project must be valuable at every level: the set of text files, that represents the source code, is the lowest level and where your project begins to exists. Other levels will be covered in next posts..