[jdom-interest] a question about node type

Tatu Saloranta cowtowncoder at yahoo.com
Thu Dec 7 19:51:35 PST 2006


--- Syloke Soong <ssoong at protedyne.com> wrote:

> [quote]
> Plus, instanceof is usually an indication of failure
> of the object 
> model. Polymorphism should normally replace
> instanceof and similar 
> checks, though you can't always do that when working
> with other people's
> 
> code.
> [/quote]
> 
> Just two weeks ago I was made aware of "the
> object-oriented designer's"
> gripe against using instanceof.
> 
> One person's orthogonality is another's
> convolutedness. In the limited

Oh please. That you can not figure out why instanceof
is against basic OO design principles and best
practices, does not mean it isn't so.
You make same flawed arguments (and long-winded
pointless rants) as with "but why can't I just do
non-wellformed xml if I'm too cheap to" thread.

Also, while there certainly are cases where instanceof
can or has to be used (there are always exceptions to
the rule), doesn't remove the general conceptual
problem.
Like Elliotte said, _usually_ polymorphism is the way
to implement things for which instanceof - based if
statements are used for. Not always, but usually.

Feel free to check out any literature by experience
software engineering practicioners, or good books
about refactoring techniques if you don't believe
comments people make here.

-+ Tatu +-



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


More information about the jdom-interest mailing list