I got a chance to introduce some convention/design/best practices regarding exception handling in our Java EE/ATG project.
During some research to prove a concept I found some interested articles for me, hope might be useful for someone else.
- quite long article http://today.java.net/article/2006/04/04/exception-handling-antipatterns
- some thoughts here http://stackoverflow.com/questions/3765462/java-exceptions-hierarchy-what-is-the-point
- and some best practices are here http://www.wikijava.org/wiki/10_best_practices_with_Exceptions
- and finally some are here http://onjava.com/onjava/2003/11/19/exceptions.html
Some conclusion that I made:
- do not over-create too many custom exceptions;
- do not over-use unchecked exceptions, even some too respectful persons are talking that checked exceptions are dead they still might be quite useful
- pay attention regarding handling/re-throwing
- do not bubble-up low-level API (wrap API you’re using to not to tie your clients)
- pay attention to bounded contexts (DDD)
- and the most hardest one – keep it simple