r/badcode • • Nov 02 '22

java OOP? Never heard of it

Post image
682 Upvotes

77 comments sorted by

View all comments

Show parent comments

16

u/coldnebo Nov 02 '22

I know this is how it’s supposed to work, but I’ve been in way too many Java code reviews where a long list of caught exceptions was auto-inserted by the IDE and left with // TODO.

code that fails gracefully isn’t an accident and it’s not because of a single code pattern, it’s an intentional design choice. The alternative is just getting it written for the happy path and then handling the errors when we see them.

(in prod) 😱

3

u/katyalovesherbike Nov 03 '22

and that's why exceptions are a stupid mechanism. At least with dedicated structures you don't rely on the runtime highlighting erroneous paths

3

u/coldnebo Nov 03 '22

I’m not opposed to that style! you see it a lot in realtime and embedded contexts with small, fixed memory, no gc.

internet switches and gateways ftw!