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

> Adding a new exception to a throws clause in a new version breaks client code.

Altering the return-type of a new version also breaks client code. Both return-types and thrown-types are kinds of results from your code, and both should be treated with similar rigor.

The main difference is that programmers are forced to get one of them right early on (in order to get their demo working) while the other is often ignored until late in development when you start needing to handle errors.

Conversely, always using unchecked exceptions "because it's too much work" is the same tradeoff as writing like writing methods that promise to return Object. Sure, it frees you from needing to plan, but it also makes it much harder for you (or another developer) to plan the next thing, leading to a snowball effect.



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

Search: