After correctness, the second most important aspect of code, in my opinion, is maintainability. This is especially important because code is initially developed once, but has to be maintained several times. For ease of the discussion, I will ignore complete or partial refactoring. Of course you can deliver code quick, but you are not doing your business a favour, when several other consultants will have to spend twice the time needed to do their future changes on the same code.
When watching code, I often see that code is doing what it should, that the author clearly knows the language and that he probably was very proud when it finally was tested to be correct. However, you can also see he has struggled with the code because of obscure naming of procedures and variables and by not modularizing the code. The code is very clear for the author himself, but a colleague will have a hard time understanding it. This effect is then exaggerated by years of maintenance and adding all kinds of extra code. In extreme cases this results in procedures containing 25 cursor declarations, 2 pages full of variables, followed by 50 pages of if-then-else and while-loop constructions, occasionally calling a subprocedure. No kidding, I've seen they are out there.
Once in a while I am pleasantly surprised by code that looks childishly simple. The code contains all kinds of self-explaining small functions, it is commented but the comments are almost superfluous, and the main procedure does nothing but calling well named subprocedures. To me, this is a sign that the author truly masters his profession and the business subject itself.
The moral of this story was clearly stated in one sentence here on the Oracle SQL and PL/SQL discussion forum by Billy Verreynne: Simplicity is the ultimate form of elegance and sophistication. I decided to show this as a motto/subtitle of this blog.
4096 Columns
1 week ago
No comments:
Post a Comment