Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If it's very cut & paste code, then large amounts of code can be rewritten with appropriate tools. The Rewrite Tool from the Smalltalk Refactoring Browser can be used this way. I once rewrote 2500 "Database Transformers" for a single "change request" this way in just a few days. Each one of those took up 2/3rds of a page printed out. I decided to do this, because these "transformers" were defined with code blocks, and clueless programmers were shoving business logic into them. I discovered that about half of the blocks fit about a dozen repeated patterns. The Rewrite Tool lets you do syntax directed translations with wildcards that can be used in the generated code. I wrote a small hierarchy of Database Relation objects that also understood what to do with simple attribute values, and created syntax directed rewrites.

We put the thing into production next release. Something crashed every client on the production floor -- we discovered that clueless programmers had put a fix to the business logic (1) into the guts of the "Database Transformer" framework. We moved that code over, and after that everything just worked!

(1) - On top of that, this case wasn't covered in the tests! I was glad to have left that shop.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: