Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Please never do this. I beg you.

This is why we can't have nice things, because someone somewhere always wants to cut a corner in a way that isn't as robust as they think it is.

I once had an argument with a junior developer that he can't just use a hash code directly instead of an equality check. It can be used as a first step to quickly reject unequal values, but equality must be verified. He disagreed right up until a finance report had "unexpected" dollar figures in it.

There is nothing I value more in the code I write than 100.0% pedantic correctness.

The opposite of this is inserting Thread.sleep(1000) into multi-threaded code to "fix" it.

It's a tiny, slippery step from skipping a correct parsing step to that eldritch madness.



Correctness and robustness are not always the requirement. Sometimes it's simplicity. Sometimes it's time-to-market. Sometimes you get fed a broken XML and regex actually does a better job.

I've also been a junior developer and thought that my code has to be correct, look correct and perform correctly. Then I got a boss. Boy I was wrong.


> Sometimes you get fed a broken XML

How do you think that XML was generated?

By people who took similar shortcuts, that's how.

Layering badness on top of badness results in a tyre fire.


Performance is another one; there was one benchmark post I read a while ago that compared a stdlib implementation with a custom implementation, and the gist of it was that the stdlib had a few extra safety checks to prevent crashes and the like.

It's setting your sliders. If you have robust and predictable input, you can forego some of the safety checks in favor of performance.


> ... forego some of the safety checks in favor of performance.

Are you a manager at Boeing, by any chance?


> There is nothing I value more in the code I write than 100.0% pedantic correctness

When dealing with messy input data, this goal can be akin to perfect being the enemy of the good.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: