Wednesday, May 21, 2003

Software
OK, so I'm working on adding an enhancement to some low-level code that creates objects in the database. Bad enough that the DB schema is defined using UML (a subject I'll write about some time in the future) and implemented using XML. Worse is the actual code itself. The primary class I have to modify is 7000+ lines of code. The primary method in this class is 3000+ lines long. The critical code is contained in a for loop that's 1200+ lines long. The code revolves around picking out fragments from an XML schema definition and processing them. Calling this code opaque would be a wholly undeserved compliment.

No one who writes code like this should call themselves a professional programmer. I've seen lots of bad code in my 15+ years as a (real) professional programmer, but this is the absolute nadir. I understand the person who wrote this is now at Oracle. Perhaps this explains the laughable XML bullshit that has been emerging from Larry's boys the past couple of years.

I'm in the middle of refactoring it into something understandable, otherwise I'll never be able to modify it. Apparently, everyone else is too scared of this code to have done it before. Not that I blame them.

Roedy Green has a much funnier take on How to Write Unmaintainable Code. It's less amusing when you actually have to work on it.

No comments: