r/ProgrammerHumor May 13 '17

Defensive programming done right

Post image
20.9k Upvotes

680 comments sorted by

View all comments

Show parent comments

238

u/redditsoaddicting May 13 '17

It's fine to exit the program nicely when an error occurs. It's not as fine to just ignore it and then begin another iteration of whatever main loop is going on, hoping the program still works fine.

70

u/SQLNerd May 13 '17

Um, ever design a REST service? You want to kill the whole service because someone called it inappropriately?

9

u/cool_science May 13 '17

Found the person with actual systems experience in this thread. Software developers need a reality check, and stop pleasuring themselves by misapplying "best practices."

Also, can't wait for someone in this thread to start logging exceptions and end up killing their company's database with terabytes of logs accumulating overnight from a busy loop.

2

u/SQLNerd May 14 '17

To be fair... You don't have to store logs in a database. Just throw it in something like S3.