You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@citi-us.com> on 2002/12/12 19:26:20 UTC

[Avalon4:Fortress] Changes to RoleManager

Somebody made some *major* changes to the RoleManager interface,
and I do not recall any conversations/explanations regarding it.

The problem is that I *specifically* designed the RoleManager
to support both forwards and backwards interpretation of a
component's entry in the configuration.  My intent was that in
the future, the configuration file would be "self-healing".
If there was an entry in the configuration file that was with
the old "<component/>" format and there was an entry for it
in the RoleManager, then the Container would be able to write
the configuration file back with the human readable form of
the name.

The new implementations and interface does not allow for this
type of action, and in fact it prevents it from ever happening
in the future.  Also, the replacement did not meet the Java
API documentation standards as the original version did.

I am going to revert the changes *back* to the way they were.
If there are any serious objections (which I doubt), please
voice them now.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Avalon4:Fortress] Changes to RoleManager

Posted by Peter Donald <pe...@realityforge.org>.
In Fortress? I think it was me and I asked this list if there was any problems 
but no one spoke up.

On Fri, 13 Dec 2002 05:26, Berin Loritsch wrote:
> Somebody made some *major* changes to the RoleManager interface,
> and I do not recall any conversations/explanations regarding it.
>
> The problem is that I *specifically* designed the RoleManager
> to support both forwards and backwards interpretation of a
> component's entry in the configuration.  My intent was that in
> the future, the configuration file would be "self-healing".
> If there was an entry in the configuration file that was with
> the old "<component/>" format and there was an entry for it
> in the RoleManager, then the Container would be able to write
> the configuration file back with the human readable form of
> the name.
>
> The new implementations and interface does not allow for this
> type of action, and in fact it prevents it from ever happening
> in the future.  Also, the replacement did not meet the Java
> API documentation standards as the original version did.
>
> I am going to revert the changes *back* to the way they were.
> If there are any serious objections (which I doubt), please
> voice them now.

-- 
Cheers,

Peter Donald
 "Man's mind stretched to a new idea never goes back to its original 
dimensions." -Oliver Wendell Holmes 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Posted by Stephen McConnell <mc...@apache.org>.

Berin Loritsch wrote:

>I am not going to do this anymore, but I will make some
>fundamental changes:
>
>1) We should *never* explicitly throw a NullPointerException.
>   If an argument is required, throw an IllegalArgumentException
>   instead.  The meaning of the error is much more clear.
>

Disagree.

If I am expecting a non-null argument, and if the argument is null, I 
will throw a NPE with the name of the parameter.  If the argument is not 
null but is for some reason invalid, I will throw a 
IllegalArgumentException.

Steve.

-- 

Stephen J. McConnell

OSM SARL
digital products for a global economy
mailto:mcconnell@osm.net
http://www.osm.net




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Posted by Peter Donald <pe...@realityforge.org>.
On Fri, 13 Dec 2002 06:13, Peter Royal wrote:
> On Thursday, December 12, 2002, at 02:08  PM, Berin Loritsch wrote:
> > 1) We should *never* explicitly throw a NullPointerException.
> >    If an argument is required, throw an IllegalArgumentException
> >    instead.  The meaning of the error is much more clear.
>
> I'd actually prefer it the other way.. Why?
>
> Throw a NullPointerException when an argument that is expected is null.
>
> Use IllegalArgumentException when there is an argument supplied, but it
> is invalid for other reasons.

+1

And it is also the pattern used in JDK and other classes.

-- 
Cheers,

Peter Donald
*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------* 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Posted by Berin Loritsch <bl...@citi-us.com>.
> From: Peter Royal [mailto:proyal@apache.org]
> 
> On Thursday, December 12, 2002, at 02:08  PM, Berin Loritsch wrote:
> > 1) We should *never* explicitly throw a NullPointerException.
> >    If an argument is required, throw an IllegalArgumentException
> >    instead.  The meaning of the error is much more clear.
> 
> I'd actually prefer it the other way.. Why?
> 
> Throw a NullPointerException when an argument that is 
> expected is null.
> 
> Use IllegalArgumentException when there is an argument 
> supplied, but it 
> is invalid for other reasons.


When I see a NullPointerException coming from library code, I
instinctively think that there is a serious problem with the
*library* code and not my code.

Any time there is a contract for the incoming parameters, and
client code violates that contract, you should use the
IllegalArgumentException.  That lets the developer *using*
your software to know they are in violation of an expected
contract.

With the RoleEntry class, it is an explicit contract (i.e.
we are testing for the failure case) that no argument can
be null.  By using the IllegalArgumentException we don't
get any confusion over what the _source_ of the error is.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Posted by Peter Royal <pr...@apache.org>.
On Thursday, December 12, 2002, at 02:08  PM, Berin Loritsch wrote:
> 1) We should *never* explicitly throw a NullPointerException.
>    If an argument is required, throw an IllegalArgumentException
>    instead.  The meaning of the error is much more clear.

I'd actually prefer it the other way.. Why?

Throw a NullPointerException when an argument that is expected is null.

Use IllegalArgumentException when there is an argument supplied, but it 
is invalid for other reasons.

-pete


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Avalon4:Fortress] Eating Crow (was Changes to RoleManager)

Posted by Berin Loritsch <bl...@citi-us.com>.
> From: Berin Loritsch [mailto:bloritsch@citi-us.com]
> 
> 
> Somebody made some *major* changes to the RoleManager interface,
> and I do not recall any conversations/explanations regarding it.

I had a deeper look at the changes, and have changed my impressions.


> The problem is that I *specifically* designed the RoleManager
> to support both forwards and backwards interpretation of a
> component's entry in the configuration.  My intent was that in
> the future, the configuration file would be "self-healing".
> If there was an entry in the configuration file that was with
> the old "<component/>" format and there was an entry for it
> in the RoleManager, then the Container would be able to write
> the configuration file back with the human readable form of
> the name.

At a closer look, it still supports "self-healing" config files.

> The new implementations and interface does not allow for this
> type of action, and in fact it prevents it from ever happening
> in the future.  Also, the replacement did not meet the Java
> API documentation standards as the original version did.

Now that I jumped in the code, I found that my initial reaction
and analysis was flat out wrong.  However, I would liked to have
known what the changes were ahead of time so that we could have
made the journey together.

My comment regarding the API documentation standards still
apply.  The new interface rocks, there are a couple minor
tweaks for the implementation, but the JavaDocs could have
been better.

> I am going to revert the changes *back* to the way they were.
> If there are any serious objections (which I doubt), please
> voice them now.

I am not going to do this anymore, but I will make some
fundamental changes:

1) We should *never* explicitly throw a NullPointerException.
   If an argument is required, throw an IllegalArgumentException
   instead.  The meaning of the error is much more clear.

2) Javadocs should be well written, not non-existent

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>