Hi Thomas,

My 2 cents in this discussion.

On 13 July 2011 13:33, Thomas Strunz <beginn...@hotmail.de> wrote:

>  Hi Egon,
>
> the problem with checked exceptions is, that the mostly occur on a very low
> level, meaning in IO operations.
> In my usage of CDK when creating molecules from file or database. The thing
> is that it is not possible to do any meaningful exception handling at such a
> level. Not really a problem but now the method has to have a "throws
> clause". And if that method is part of an interface the method defined in
> the interface needs the throws clause.
> Not all implementations of that interface actually throw that exception. ->
> it clutters your interfaces.
>

The good practice is if you could not recover from an exception, re-throw
it.  Somebody else on the chain could benefit from it, even if this mean
just displaying a message to the end user.  It may seem as unnecessary
complication if one works only within IDE or command line tools.  But being
able to see the exact chain of (checked) exceptions,  especially in
environments where it is relatively hard to debug and reproduce it (e.g.
complex GUI, server side ) could save hours or even days of troubleshooting,
because quite often you could guess what the problem is just from the stack
trace.


> Going runtime-exceptions only of course requires that it is documented for
> each method which exceptions it can throw. Then the developer using it knows
> exactly what to expect just like with a checked exception but without
> cluttering interfaces (as example).
>
> The only real need for a checked exception is bad documentation. Because
> checked exceptions are "self-documenting".
>

Even if this is the only gain, it is quite a significant advantage.

>
> I'm not an expert but I my own limited experience convinced me of checked
> exceptions being at best useless (IMHO they actually make you work around
> them, time consuming and other downsides).
>

Well, being aware of different opinions on the this and similar subjects in
general; mine is quite the opposite, but let's say I am in the camp who
prefer static typed to dynamic typed languages (and plain JDBC to ORM).
Having compile time restriction is meant to enforce more reliable code, and
saves time when troubleshooting a complex running system.   That said,
advantages are really visible, if your system is relatively complex.


Best regards,
Nina



>
> Thomas
>
>
> > From: egon.willigha...@gmail.com
> > Date: Tue, 12 Jul 2011 08:56:08 +0200
> > Subject: Re: [Cdk-user] Exceptions again: three designs. What will we use
> in the next CDK series (1.6 or 2.0)?
> > To: beginn...@hotmail.de
> > CC: cdk-de...@lists.sf.net; cdk-u...@lists.sf.net
>
> >
> > On Thu, Jul 7, 2011 at 3:17 PM, Thomas Strunz <beginn...@hotmail.de>
> wrote:
> > > IMHO it must get more granular and also I really don't like the fact
> that
> > > CDKException is a checked exception. In most of the cases it is just
> > > annoying and useless.
> >
> > I think I disagree. You can get any Runtime exception and never know
> > what to expect.
> >
> > Invalid input is very common here, and your software needs to recover
> > from that, and differently from other situations. I think a Runtime
> > exception should only happen when something *unexpected* happened,
> > like OutOfMemory or so...
> >
> > > I know, endless debate and maybe you have had it several times but for
> me as
> > > user as it is now: annoying like hell. Just like pure JDBC.
> > >
> > > other frameworks that use Runtime exceptions are IMHO a lot more
> friendlier
> > > to work with.
> >
> > Why do you find it annoying? And useless? Why do you find Runtime
> > exceptions from user friendly?
> >
> > Egon
> >
> > --
> > Dr E.L. Willighagen
> > Postdoctoral Researcher
> > Institutet för miljömedicin
> > Karolinska Institutet (http://ki.se/imm)
> > Homepage: http://egonw.github.com/
> > LinkedIn: http://se.linkedin.com/in/egonw
> > Blog: http://chem-bla-ics.blogspot.com/
> > PubList: http://www.citeulike.org/user/egonw/tag/papers
>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to