January 05, 2003

Agile Database Refactoring

Scott Ambler has written several very good articles on database refactoring from an agile development perspective: The Process of Database Refactoring, Catalog of Database Refactorings and A UML Profile for Data Modeling. There are several more; see the section titled 'Agile Database Techniques' on the main page of agiledata.org.

Evolutionary Database Design by Martin Fowler and Pramod Sadalage covers things from a slightly different perspective, while keeping to the agile methodology.

Scott also wrote this Java coding standards document, which I found somewhat amazing, as I agree with it nearly completely. I believe that this is the first article outside of Stroustrup's "The Design and Evolution of C++" where I've seen someone recommend putting constants on the left side of evaluation (comparison) operations. Perhaps I haven't been paying very close attention.

For example:

if ( someVar == 0 ) {}
if ( someOtherVar = 0 ) {}

versus

if ( 0 == someVar ) {}
if ( 0 = someOtherVar ) {}

The second comparison (with someOtherVar) is obviously a bug, but won't be caught by normal means. The easy way to catch it is to have the constant on the left side where it can not be modified. I catch about six bugs per year with this and have been doing it since about 1995. You do the math.

Posted by Dave at January 5, 2003 09:33 AM
Comments