Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] RE: So many if() statements in CDT source code

> Without seeing specific example of an area where you think there are an excessive number if if() statements, it's rather hard to formulate a meaningful answer to your question.  Refactoring code is an activity that always depends heavily upon the nature of the code being refactored.
> 
> Now, if you're seeing tons of:
> 
> If(myObject instanceof SomeType)
>
> Then your polymorphism idea is probably valid.

I count 5472 "instanceof" in CDT. Note that "instanceof" is just one
incarnation of "IF a is of type THEN". It can take other forms.

To those it might concern: I'm throwing down the gauntlet with a
reversed burden of proof. :-)

Show me a single instanceof that is approperiate.

What alternative strategies exist? Enumerating some:

- polymorphism
- upcast w/exception handling



-- 
Øyvind Harboe
http://www.zylin.com



Back to the top