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

I get so irritated whenever this is brought up as an "additional security measure". Like, guys, we just found the source of the bug and put in some code to fix it. If it fails again it shows we haven't understood it completely and should take another look. Not just throw in a random try-catch where the outcome is that if it fails again it's just that some string won't be rendered in the application anymore or whatever. Could take months before anyone notices and we learn that something basic has been broken all along.

Thank you for standing up for confident programming! (We could make this a new term if we wanted to :D)

EDIT: Wait, maybe there's a better term than confident programming already... I would appreciate some input if someone sees this.



Wikipedia seems to call it "offensive programming": https://en.m.wikipedia.org/wiki/Defensive_programming


There is a third route. You can add a try catch and then throw a more detailed exception (or otherwise automatically surface the issue while not degrading the user experience) showing the context of what failed, then fo attempt to fix a poorly understood bug for which you may have an incomplete set of reproduction circumstances for.

The best solution is, as always, context and resource dependant.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: