The Law of Leaky Abstractions

All non trivial abstractions are leaky to some extent.

Abstractions save you time to work, not time to learn.

Becoming a proficient programmer is harder.

http://www.joelonsoftware.com/articles/LeakyAbstractions.html

Advertisements

Root Cause, Caused By Rule, declare runtime exceptions in throws clause?

Cause By Rule: look for the first exception and keep following till you get the last caused by and that is root cause.

Typically, developers try to get over the chcked exceptions by creating and throwing Runtime Exception(CheckedException e). After a few layers [DAO -> Service -> Controller], it gets very tough to  find the root cause. Use the “Caused By Rule” to determine Root Cause.

logback has %rEx that directly prints the root cause.

It is typically a good idea to declare know Runtime Exceptions of your method. So, callers can proactively deal with them.

Exception Caused By: If you see this in stack trace => an Exception was rethrown.

Exception Wrapped By:  If you see this in stack trace => an Exception is printed Root Cause first.

Strack Traces omitted: => This strace is already printed

reference: http://nurkiewicz.blogspot.com/2011/09/logging-exceptions-root-cause-first.html