Sundarrajk's Weblog

Archive for the ‘Refactoring’ Category

A very good analogy between refactoring bad code with cleaning up split juice. One would clean up juice split in our homes as we know that if left somebody can step on it and walk all over the place or it can dry up and attract ants and other insects to it, in short the consequences are not good.
Similarly consequences of leaving bad code as is are not good, but then why do software programmers not clean up bad code? Why do they leave it as is?
A wonderful technique for people who wish to write beautiful code. It is not always possible to write good code, forget beautiful code, the first time. Every programmer writes code in a hurry and try as hard as they may it is difficult to write good and beautiful code.
Writing under constrained circumstances means that one needs to go back and correct the code that has been written and here is where refactoring comes into picture.

Many a programmers may have been doing it without realizing that they are refactoring (as the term has started existing only after Martin Fowler has made it a formal declaration).

The book “Refactoring – Improving the design of existing code” gives a set of wonderful techniques that can be applied to make code more readable, more efficient, more maintainable and more beautiful.
For every technique that it suggests it also suggests the reverse as another refactoring method and also illustrates as to when it should be used.

Extremely important book for every programmer. Although the examples in the book are based in Java they can be applied to programs in any Object Oriented Language.

Along the same lines there is a book on Refactoring Databases. Again a wonderful book.

And another book called Refactoring to patterns. Although the name of the book reads refactoring to patterns, it clearly warns against overuse of patterns and gives examples as to why force fitting patterns will cause the programs to become ugly and unmaintainable.

All three wonderful books and should be in the repository in anybody who wishes to write BEAUTIFUL CODE and BEAUTIFUL APPLICATIONS.