Live data from Hacker News

This should never happen

github.com

1–10 of 214 posts

Re: This should never happen

#6

Apparently things-that-shouldn't-happen happen 10x more in C code than the next nearest language.

I didn't even notice that. Good observation. I wonder if that's simply because C is a lot older and may just have a lot more dead code or this type of code or something else entirely.

Re: This should never happen

#8
In my experience, "this should never happen" cases often are a sign of very brittle design that branches into many separate but nearly-identical paths, and could be simplified to remove them. The other thing it points to is bad error handling paths (assuming that an error could "never happen".)

Also funny to see Java being the most verbose as usual, with its ThisShouldNeverHappenException.java

Re: This should never happen

#10

In my experience, "this should never happen" cases often are a sign of very brittle design that branches into many separate but nearly-identical paths, and could be simplified to remove them. The other thing it points to is bad error handling paths (assuming that an error could "never happen".) Also funny to see Java being the most verbose as usual, with its ThisShouldNeverHappenException.java

Mostly there is no need for "ThisShouldNeverHappenException" since java has a IllegalStateException
Post reply on HN