I thought "instanceof" was expensive, but I just wrote a performance test that suggests it's not.Wonder if something is being optimised out?
@mjpt777 @trisha_gee Very true. Harder with 'design smells' though, always good to get a 2nd, 3rd opinion when unsure...
-
-
@darachennis@mjpt777 (a series of these classes replaces a God class with a series of "if"s and switches) -
@trisha_gee@darachennis Why not user polymorphism? - 3 more replies
New conversation -
-
-
@darachennis@mjpt777 The purpose of my class is to decide if it can encode an object, and do so. A single instanceof seems acceptable -
@trisha_gee@darachennis@mjpt777 instanceof ok in some circumstances but usually there are alternatives like delegate or encapsulate
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.