Code Generation and Maintainability - Developer Productivity at a Price?
by David Hayden ( Sarasota Florida Web Developer ), Filed: Code Generation Tools
I got off the phone today with a buddy who recently started moonlighting as a freelance developer looking to eventually get away from his employer. Several months ago you couldn't get him to shut up about a certain code generation tool that can pump put data-driven web applications in minutes given an existing database. Fast forward to today and how he wouldn't stop moaning about how difficult it is to make changes to the application after it has been generated. It felt like a deja-vu, because I had this very same conversation with another buddy of mine about 4 weeks ago who had the same problem with another code generator.
And there you have it. Generating code to do 'abc' is hardly a problem. You come out with a version 1.0 lickity split and pat yourself on the back that you were able to do it in only a couple of weeks. Then, you need to make change 'xyz' and find out you can't without either hacking at the code, coding around the framework, or re-generating the application from scratch. Some savings. You sacrificed maintainability over the long run by getting better productivity at the beginning. The cost of the application has now gone through the roof!
This isn't to say that all code generators create un-maintainable code, but you can't really evaluate a code generator until after you have had to maintain the code it generates. If you find yourself working around the generated code / framework or hacking at it quite often to do 'xyz', you may want to re-think the code generator.
Same goes for O/R Mappers :)
Author: David Hayden ( Sarasota Florida Web Developer )
Filed: Code Generation Tools