Hi All:

I've started porting a project from 1.2.16 to 2.0.

I find the Logger.catching() API name to be rather poor. I can't recall
seeing APIs that say do-"ing" something. APIs usually just "do". IMO, the
fact that the API was can be called from a catch clause should not create
the need to call the API catching.

So, "log" would be better IMO, because the /Logger/ logs the exception. The
Javadoc is lacking here, what level is used?

One way I like to think about API names and Javadoc is to see how they both
read. I assume we are all using the active voice pattern for Javadoc of
course ;) I like it when I see, for example, an API called runFast() and
the Javadoc says "Runs fast.".

Which is why the catching() name is that much the lamer ;) IMO.

Tangent:

This is further (slightly) confusing because there are FATAL, ERROR, DEBUG
(and so on) Levels which match up with fatal(), error() and debug()
methods. There is no CATCHING level of course ;)

Which brings up the bigger issue of API names and what the proper name
should be. Usually, APIs /do/ something, using a verb, like log() or
warn(). An better active verb API would be inform() for INFO. Luckily we do
have already warn() for WARN, debug() for DEBUG, trace() for TRACE. Where
there is no great choice is for FATAL, where we have fatal() today. So we
are just lucky that all levels except INFO and FATAL match up with
verbs.The flip side is that it having API names match the level names
follows he KISS principle :) which, in the end, I like better in this case.

Gary

-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to