Working on crazy code – you should know when to stop

Reading Oren Eini’s post & comments about How to tell that this is not production code made me nervous. I don’t know why but for 10 long-enough seconds my eyes twinkled and I managed to pull 5 buttons from my keyboard.

Due to the fact that I know Oren’s character from talking to him quite a bit after my lecture(delegates&anonymous mothods), I have the feeling that he codes-for-fun instead of coding-to-succeed, and he really pushes it sometimes. I can’t say that I’m no sinner, but I think that during working hours, you should use your team’s time in a wiser manner.

You should code with purpose. This purpose should be with one stand to your project deadlines, people quality, maintainability, efficiency, company’s goals etc. This is code-to-succeed in my book.

I wrote this comment down as I’m currently responsible for several applications with some code that actually made me think that this code which “should never be production” made its way into production. It’s even worse, the knowledge of how and why this code behaves the way it does is *lost*. The people who wrote it are no longer here and I’m stuck with code that shouldn’t exists. Oh yes, I almost forgot, this code has numerous bugs and yep, I will have to play along with this dark magic voodoo and get it to work.

One sentence (from Eini’s comments) really got me anemic for couple of seconds:
“We are going to try to explain it tomorrow to another developer, who is going to maintain it, and we will see if he likes it or not.”

This is *unacceptable*. You know that you’re doing some dark magic, you know that this is a disaster waiting to happen and yet you move forward. Let’s say that this poor fellow got the idea, what happens if he quit and a new programmer will have to take care of *your* code ? Who says that you’ll be there to hold his hand ? Who says that he will “like” it ? You must know when to stop…

Wait a minute, hold on, you got me all wrong here !

I’m all about creativity and enthusiasm(!!!!), especially during work time, but the above is just a bad practice and not an excuse. Does that mean you can’t code things you know you’ll have to change later on or even throw them to the garbage ??
Hell no ! this is exactly why you can prototype your solutions if required. Just don’t forget to throw the prototype to the garbage and start all over again with the good insights you have acquired during the process.


Oren Ellenbogen