Thanks Jon for the great idea.

I rebuilt Scarab from scratch with the modified Torque and the problems
showed up.

Here is why...

We assumed that throwing TorqueException instead of Exception was fully
backward compatible with existing "client" code.  However, we forgot to
consider "extending" code.  Indeed, if anybody extended a base class and
overrode a method that was throwing Exception, this method is no longer
valid now that its base method throws TorqueException.

So all extending classes would have to be patched to also throw
TorqueException.  This is only required for overriding methods, not for new
methods.  But even then, it might represent an important rework for big
projects such as Scarab, which have tens of extending classes with tons of
overrides.

What's even worse is that, due to the lenient exception model used in
Torque, all extending methods are free to throw whatever exception they
want.  But those exceptions cannot simply be wrapped into TorqueException,
because chances are that the client code using the extending classes might
be catching the specific exceptions.

That means the client code is bound to the implementation details of the OM,
and especially to the extending classes' implementation.  That is really
BAD.  And that was my whole point when arguing that TorqueException was so
important.  Now it seems to be too late.  Unless we force people into the
change, which is not a good option either.

I'm sad about that, not because of the time I put into it, but rather
because of my idealistic mind! ;-) Hehe...

Any comments, opinions, suggestions would be appreciated...

-- Mathieu.

-----Original Message-----
From: Jon Scott Stevens [mailto:[EMAIL PROTECTED]]
Sent: February 21, 2002 4:33 PM
To: turbine-dev
Subject: Re: [PATCH] Standardizing OM for throwing TorqueException


on 2/21/02 10:11 AM, "Mathieu Frenette" <[EMAIL PROTECTED]>
wrote:

> However, my application doesn't have a great code coverage ratio, so I
> cannot tell if it broke something that my application is not using.  I
> noticed that there isn't a lot of test cases, and they do not cover the
> aspects that I modified.  Maybe someone who has an application with a very
> good code coverage ratio should try out the patched version, in order to
> improve our confidence.
>
> Please let me know what is your usual strategy for testing such changes.
>
> -- Mathieu
>

Scarab uses Torque heavily. A good test is to build (and run Scarab) with a
new Torque.zip.

cvs co jakarta-turbine-torque
cvs co scarab
cd jakarta-turbine-torque
ant dist-lite
cp bin/torque-3.0-dev.zip ../../scarab/lib
cd ../../scarab/build
ant
cd ../src/sql
./create-mysql-database.sh
cd ../../target
./scarab.sh

-jon


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to