Monday, 26 February 2007

Source code quality

When you need to evaluate software products: applications, libraries, frameworks... Open source software has a powerful tool to perform the evaluation: the source code. It is like when buying a car, you see the tyres, wheels, doors, interior equipment and so on, but it is worth to open the bonnet and have a look at the engine.

Inspecting the source code you can learn a lot of things about the software and the team who developed it, if there is a disciplined and intelligent group of people behind that software. The things I usually inspect while browsing the source code developed by third parties are:

  • Is the code is well organized? Does if it follows coding guide lines like this one for java or this one for c#?. Can you can understand what the classes and methods do reading the name? Is the code well commented?
  • Is the code complex? Is it spaghetti code or not. The code is complex when there are classes very big, methods have many parameters, and contains a lot of lines, classes have a lot of dependencies with other classes. An the opossite, the code is simple if classes are small, methods does not contain a lot of lines, you can recognize well known design patterns, there are not duplicated blocks of code.
  • Is the code managed with a version control system and the changes are reflected properly? Does the software have a bug database? Does it provide tests? Does it have a good logging system?

If you are an skilled developer or can ask to one, you can also check more things regarding the source code, but with these three aspects you can have a general idea about the source code quality of a software product. It is impressive how your opinion about the general quality of a product can change before and after inspecting the source code. Is it better before to be tied to a software product, to check also the source code. There will be less surprises in the future.

No comments: