"richard.opalka(a)jboss.com" wrote : "jason.greene(a)jboss.com" wrote : I
disagree with the server factory example in Rule 4. IllegalArgumentException is the
appropriate exception to be thrown
| |
| Of course you're right Jason, the correct code should be:
|
Again, I can't agree with you. You're abiding by a set of subjective criteria as
though they were laws. :-) Rather than saying "this is incorrect" what you
really mean is, "this is not how I like it, but that's just my opinion".
The true test is, is the API nice to use? Does it make sense logically? If these two are
true, then the API is probably just fine. Everyone has their own opinion about how APIs
should look and feel, and I can tell you now that there will never be a time where
everyone converges on what your (or my) idea of "right" is.
So I think a better measurement is, rather than saying "X, Y and Z violate my rules
for APIs", look at what code which actually USES the API might look like and ask
yourself, "can this cause a surprise for users? Is it unintuitive? Is there a way
this could be made better with that in mind?" If the answer is something like
"Yes, the user will need 5 probably-identical catch clauses every time they call
method X, and they're all very unlikely!" then you can objectively say it's a
problem. If the answer is "I don't like ____" then that's just your
opinion and you should advertise it thus.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269046#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...