I would also roughly go to the Nina's solution, with a strong  
agreement with Rajarshi. Just a few additional word to enrich this  
interesting discussion:

Too much exceptions handling / types usually gives verbose code (JAVA  
is verbose enough hu... ;)), endless try/catch at every level of the  
code, and bad performances.

Sometimes, the message comming from an exception is just good enough,  
because you can't actually do anything more that just showing the  
message to the end user / developper. A specific class will be usefull  
only if you can do something specific to overcome the problem within  
the program itself.

More generally, I think the low-level functionalities of a program  
should assume that the input data are correct, and if not... well, the  
mistake goes to the user / developper :). In other words, the main  
exception handling should be performed at the highest level possible  
(e.g. GUI, or when reading data).

Let's take a concrete example in the CDK: when computing 3D  
descripors, most of the classes in charge of computing such  
descriptors will check that the input molecule actually has 3D  
coordinates, and throw an exception otherwise.

In my opinion, this way of catching errors at such a low level is,  
among others, a waste of CPU time. Let's suppose I read a molecule,  
and I want to compute all 3D descriptors available in the CDK. How  
many times  the
3D coordinates verification will be performed ? Probably it would have  
been a good idea to check this before (up to the user then) it makes  
much more sense imho :)

Anyway, I think one have to be carefull about these things. Too much  
code, too much check... render the final program harder to read /  
understand, and computationally inefficient.

I know, that's easy to say... but still :)

Vincent


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to