How to consider this depends on how to consider the different
subsystems of ArgoUML and how their APIs are defined.
Defining that IllegalArgumentException is to be thrown when the API is
not correctly used means that we are considering the subsystems as
separate units with the API defined also for this case. I.e. the Model
subsystem has the responsibility to check the arguments and behave
consistently also when the arguments are incorrect.
If we remove this code this responsibility is not clearly shown and
the risk increases that someone eventually will write code that does
not behave correctly in this case and that problem will then be
difficult to find.
I'd prefer to keep the subsystems clearly separated and well-defined
also in this case but this is a judgement call. It is the work effert
to maintain the extra code against the increased risk and work
involved to eventually track down and fix some strange bug introduced
by the not so clear API.
/Linus
2007/8/12, Tom Morris <[EMAIL PROTECTED]>:
> We have lots of code in the implementations of Model subystems which does
> things along the lines of:
>
> if (element instanceof ModelElement) {
> return ((ModelElement) element).getName();
> } else {
> throw new IllegalArgumentException("bad argument type");
> }
>
> this can be abbreviated as:
>
> return ((ModelElement) element).getName();
>
> except for the requirement introduced by some of our Junit tests that bad
> parameters must cause an IllegalArgumentException.
>
> Do we really care whether this throws an IllegalArgumentException vs a
> ClassCastException or NullPointerException? This seems to me to be a lot of
> boilerplate code which isn't adding any value and I'd like to relax the
> tests to accept other exception types.
>
> Are there any objections to this?
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]