

Big rewrite: C++ to django - gtani
http://blog.awarelabs.com/?p=67

======
ced
That's 500 lines of code per hour. 8 per minute. 10 seconds per line.

I'm not sure what to think of it. Can someone really be that productive in
producing (mostly) debugged quality code? Or maybe he did a mostly literal
translation so that the logic wasn't refactored much.

edit: yeah, he cut-and-pasted, that's what I was hinting at when I said
"quality code". He could have taken two days to do it instead and properly
abstract out the relevant parts. Otherwise, it's not a rewrite, it's just a
translation from one language to another.

~~~
stcredzero
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.

------
thomasmallen
Why did this have to be done in twelve hours?

~~~
shadytrees
Those Django kidnapping gangs are upping their ransoms these days what with
inflation and so forth.

