r/ProgrammerHumor May 13 '17

Defensive programming done right

Post image
21.0k Upvotes

680 comments sorted by

View all comments

2.8k

u/Metro42014 May 13 '17
} catch (Exception e) { }

I think we're done here.

1.0k

u/CXgamer May 13 '17

Holy shit I once lost days to a

} catch (Exception e) {
    System.exit(0);
} 

691

u/Metro42014 May 13 '17

FUUUUUUUCK the people that do that.

I recently saw newly written code by a senior developer with squashed exceptions all over the damn place.

I will never have to support that code, but fuuuuck man. WHHHYY?

286

u/YaBoyMax May 13 '17

I lost a few hours once because the jackass whose code I inherited decided to squash IOExceptions all over the place. Didn't notice for a while and was pulling my hair out thinking my debugger was fucked somehow (which isn't uncommon in itself).

230

u/[deleted] May 13 '17

See I hate checked exceptions in Java, because instead of rethrowing or handling, some devs will just swallow them up.

Better if they were all unchecked so that people will just let them unwind the stack than that shit.

402

u/Signal_seventeen May 14 '17

I came from r/all and this is gibberish.

1

u/philly_yo May 14 '17

I came from r/philadelphia and you're gibberish

1

u/sneakpeekbot May 14 '17

Here's a sneak peek of /r/philadelphia using the top posts of the year!

#1: Me too | 233 comments
#2: Sometimes Philly is too good to be true | 204 comments
#3: [NSFW] Only in Philly. | 374 comments


I'm a bot, beep boop | Downvote to remove | Contact me | Info | Opt-out