[
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
|
A lot of these are required due to the way event notifications are patterned in the platform. Event notifications give an Object as the source of the event, and you have to check the type of the source to see if it's an event you care about.
As I said before, show us something specific you feel should be refactored and we can have a more meaningful discussion. I can't say much more than many of these are entirely valid for the above reason. It's entirely possible that there are some which aren't, but I'm sorry to say that with 3.0 deadlines looming close, the committers likely do not have the time to spend looking for a needle in a haystack.
Better yet would be if you send in a patch :-)
___________________________________________
Chris Recoskie
Software Designer
IDE Frameworks Group
Texas Instruments, Toronto
> -----Original Message-----
> From: Øyvind Harboe [mailto:oyvind.harboe@xxxxxxxxx]
> Sent: Tuesday, June 07, 2005 3:22 AM
> To: cdt-debug-dev@xxxxxxxxxxx
> Cc: Recoskie, Chris
> Subject: 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