Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Dear god, I think this would be what would drive coders mad if some Lovecraftian old one were a coder. I have a colleague that writes code like that last one. I know he won't change, but I wish he'd at least use a damned switch statement.


sort by: page size:

Sounds like a good coding horror article.

This kind of thinking is what creates so much madness in the programming world. I don't know where you work but it sounds like hell.

Just thinking of writing such code myself is enough to get nightmares.

Yes, I'm thinking of some mad-scientist types I've met who spin out WTF-worthy code on a daily basis. They love computers and programming, and can get workable output eventually, but it's terrible code.

I have encountered code written by people just psycho enough to think that's a clever way to handle just that scenario. They were not wrong it was indeed clever. It was also terrible.

Whaaaaat? Jesus! Some people are just too creative; i am almost afraid to test out the code.

A function that consisted of a giant switch statement, with each case consisting of another switch statement. Half of the sub-cases contained GOTO statements back to the top of the function.

Even worse... I wrote the code. It was 2am, I had been working for 18 hours straight to get everything ready for a demo the next morning.

Even worse than that... the code worked so management wouldn't let me change it. I tried my best to find an edge case it wouldn't handle but never could. So the code shipped.


I feel like there is/should be some kind of programming language design equivalent of this. If you wanted to make programmers basically incapable of writing correct programs, how would you do it?

Here's where I'd share examples and it wouldn't be funny and instead start a flamewar.


Talk about a Coding Horror!

What are these people thinking?


Ouch, that is seriously yucky code.

Really? I think that sounds like a dreadful way to code anything useful.

Sounds like a really terrible programmer! Too bad it at least seems to be sometimes pretty much the only way to go certain things when nobody else wants to.

Did you ever ask this person why he wrote this code in this manner? Did he trot out the "job security" crap or was there a legit reason?

This is a typical programmer, you'll regret code as soon as you turn your back on it. :)

Oh god, I used to work with the guy like this. Incredibly clever graduate, blew some of my knowledge out of the water.

But every day was a game of code golf to him. His code was absolutely illegible


I like the way this was prefixed. "Coding Horror:" ...works for me.

I printed out sheets with the following quote in big block letters and passed them out to my fellow programmers:

"Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live"


May the gods have mercy on the soul of who'll maintain code using these... "techniques".

(I know because back in the days I've written things like this myself :) ..probably the curses whispered by those who've had to endure their progenitors are finally getting at me)


"If you're ever writing code like this, please reevaluate your career in software development."

That's a pretty nasty comment to make about anyone in this industry over a simple for loop.

next

Legal | privacy