Code stink

Jun 18, 2007 16:23

This morning I had to dive into some code I didn't write to try to figure out why it was [boring technical details of the actual error omitted but it was broken, ok?].

You might have heard the term "code smell" - this code doesn't smell, it stinks. It stinks of many things, chiefly convoluted OO design with about thirteen too many layers of ( Read more... )

programming

Leave a comment

Comments 2

ataxi June 18 2007, 06:56:54 UTC
A better analogy than the "chair with spikes coming out of the seat" would be the "chair that uses several strata of dried and wet shit for cushioning and intermittently collapses, in some cases causing other furniture to collapse for no apparent reason, even in entirely different rooms (and in extreme cases, buildings)."

Reply

prawnwarp June 18 2007, 11:59:57 UTC
Haha, yeah, there's badness of that order in the system I was working on as well, but that wasn't the immediate problem. (I wonder if the term 'Big Ball of Mud' wasn't originally a euphemism for 'Huge Pile of Shit'.)

The immediate problem - when I actually found it; there were two almost identical sets of nested methods doing very nearly the same thing, in two different and almost orthogonal classes - had logic which was so poorly thought out that it really did seem as perverse as a chair with spikes coming out of it. The kind of code that you can't believe someone wrote in innocence - surely it must have been deliberate. (I've had that experience with my own code, which is worse.)

And of course the reason this stuff persists is that refactoring it would be horrifyingly slow and brain-destroying; on the other hand, "let's rewrite it again from scratch" is never a popular option. I'm trying to come up with a strategy to rewrite it one chunk at a time.

Reply


Leave a comment

Up