Settings

Theme

Ask HN: What is the ugliest code you've let slip?

6 points by mc42 9 years ago · 4 comments · 1 min read


I've seen some horrible code run perfectly, and some inexplicable snippet that shouldn't run work well enough.

What have you let make it to production that never should have been there, and likely was only intended as a temporary fix?

Did you ever get around to fixing it?

dublinclontarf 9 years ago

I have been told that the code I write is ugly, multiple times by different people.

The only time this has ever bothered me is when it's in the interview process and costs me the job.

I usually stop working on code when it's "good enough", which is to say, when it works.

Maybe I have low standards.

  • bbcbasic 9 years ago

    Sometimes good enough is best, and other times a refactoring is worth it. Key is to think of it from a business point of view. If you always refactor or never refactor, both extremes are suboptimal IMO. Deciding when a quick fix is good vs. something more considered is an art.

  • thisone 9 years ago

    depends on the actual code. I work with someone who likes to code by "works on my machine, in my limited tests, ship it, if it breaks then fix it" which is terrible since this person isn't on call and wouldn't have to deal with the fall out.

    It gets picked up in review, but the attitude is unfortunate.

    If your code is ugly by stylistic preferences but works and you are a responsible coworker, then, meh, I'd only code review in changes if they were pertinent to the issue being solved.

bbcbasic 9 years ago

I read the gang of four, got a hard on and banged out some code with lots of classes with really long names. Felt damn proud of it at the time. Wanted to be the next Martin Fowler, but probably just some confused poor sod now maintaining that pile.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection