NotImplementedException?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

NotImplementedException?

frank.schoenheit
Hi,

what do people think about introducing a
css.lang.NotImplementedException, derived from RuntimeException, to be
thrown in methods which, well, are not implemented, yet?

Would be similar to Java's UnsupportedOperationException (also being a
RuntimeException), but this name somewhat clashes with UNOs
css.lang.NoSupportException (which is *no* RuntimeException).

Opinions?

Ciao
Frank

--
- Frank Schönheit, Software Engineer         [hidden email] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

stephan.bergmann
On 03/13/09 13:17, Frank Schönheit - Sun Microsystems Germany wrote:
> what do people think about introducing a
> css.lang.NotImplementedException, derived from RuntimeException, to be
> thrown in methods which, well, are not implemented, yet?

Why not just do implement the method instead?

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

frank.schoenheit
Hi Stephan,

>> what do people think about introducing a
>> css.lang.NotImplementedException, derived from RuntimeException, to be
>> thrown in methods which, well, are not implemented, yet?
>
> Why not just do implement the method instead?

(I had very little hope only it would not be *this* question you were
going to ask first, but I wanted to try ... ;)

Because in a finite amount of time, I can only implement a finite amount
of methods ...

In the process of creating a non-trivial implementation, there will be a
point in time where you have a only certain percentage (<100) of your
methods implemented. Nonetheless, you might want to start using this
class, in particular, you might want to start writing test cases for it
(which in extreme might happen when the mentioned percentage is 0).

At this point in time, you will want to deal with the unimplemented
method in a way that the caller (your test, for instance) notices that
the method, well, is not implemented yet.

In NetBeans, this is mimiced (when you ask NetBeans to create a body for
all missing abstract methods) by throwing a
UnsupportedOperationException with the message "Not yet implemented".
So, as your implementation evolves, you can replace those with real
implementations.

I just like this, and want to have something similar for my C++
components :)

Of course, in a release product, ideally there would be no code throwing
NotImplementedException anymore ... and because of the potential
difference between theory and practice, this is a RuntimeException.

Ciao
Frank

--
- Frank Schönheit, Software Engineer         [hidden email] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

stephan.bergmann
On 03/13/09 14:56, Frank Schönheit - Sun Microsystems Germany wrote:

> At this point in time, you will want to deal with the unimplemented
> method in a way that the caller (your test, for instance) notices that
> the method, well, is not implemented yet.
>
> In NetBeans, this is mimiced (when you ask NetBeans to create a body for
> all missing abstract methods) by throwing a
> UnsupportedOperationException with the message "Not yet implemented".
> So, as your implementation evolves, you can replace those with real
> implementations.
>
> I just like this, and want to have something similar for my C++
> components :)

Then why not simply use com.sun.star.uno.RuntimeException with Message
"Not yet implemented"?

Of course, this is somewhat fragile, in that your test code needs to
parse Message to find out the caught RuntimeException has the specific
meaning (hoping that there is no other code somewhere that throws
RuntimeExceptions with matching Message but different meaning).

However, that is not different from your NetBeans example:  There, you
have the same fragility checking whether a caught
java.lang.UnsupportedExceptionOperation has your "Not yet implemented"
meaning or is for example thrown by calling add on an immutable
java.util.Collection instance.

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

frank.schoenheit
Hi Stephan,

> Of course, this is somewhat fragile, in that your test code needs to
> parse Message to find out the caught RuntimeException has the specific
> meaning (hoping that there is no other code somewhere that throws
> RuntimeExceptions with matching Message but different meaning).
>
> However, that is not different from your NetBeans example:  There, you
> have the same fragility checking whether a caught
> java.lang.UnsupportedExceptionOperation has your "Not yet implemented"
> meaning or is for example thrown by calling add on an immutable
> java.util.Collection instance.

But couldn't we do better in UNO, by clearly (!) separating between
"unsupported" and "not implemented"?

Ciao
Frank


--
- Frank Schönheit, Software Engineer         [hidden email] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

stephan.bergmann
On 03/13/09 15:45, Frank Schönheit - Sun Microsystems Germany wrote:
> But couldn't we do better in UNO, by clearly (!) separating between
> "unsupported" and "not implemented"?

I personally do not think it is worth it, considering the cost of adding
anything to the URE or OOo UNO API (be it published or not).

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: NotImplementedException?

frank.schoenheit
Hi Stephan,

>> But couldn't we do better in UNO, by clearly (!) separating between
>> "unsupported" and "not implemented"?
>
> I personally do not think it is worth it, considering the cost of adding
> anything to the URE or OOo UNO API (be it published or not).

Since I consider you the URE gatekeeper, I will refrain from doing it ...

I personally do not think it is worth it, considering the effort it
would take to convince you, if possible at all :)

Ciao
Frank

--
- Frank Schönheit, Software Engineer         [hidden email] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]