Tuesday, 1 December 2009

The Value of Refactoring in Open Source Software.

Code refactoring is a practice of software engineering that address maintainability. The effect (or the goal - if it is only this one) to produce more readable code is not secondary to increased stability and consistency to a predetermined (or evolving) paradigm.

Change the internal structure of a well-identified portion of code may not affect the functionality of it. If the modification is not explicitly evolutionary, your gain is (as said before) maintainability / readability: this should not be underestimated because it means that this piece of code will be more inclined to change and extensibility.

All this can be done without the worry of worsening the code or allow the resurface of solved issues if there is a good unit tests coverage.

Refactoring is essential in any software, but in an open source project the high complexity of the code, the one regarding the neglect of the objective of legibility, will keep away potential contributors. Nevertheless, if your project is targeted primarily to developers: complex code (or code indecipherable unless interspersed with many lines of comments) will prevent the adoption by the latter.

For example you might notice how the refactoring has evolved a core part of a open source project of my creation (the one when I can spend more time at the moment): Command Line Parser Library.
Who loves to study things in detail (like me) can analyze the evolution of the following types from version alfa to version beta.
If you have time to examine these sources, I'm very interested in your opinion.

I'll return to this argument as soon as possible to investigate further. We could devote an entire blog... Don't forget that there are several books and a lot of material on the web about this topic.