Was going through some forum posts, where i came across this interesting topic, which made me think about it. The discussion point was about whether to use ‘instanceof’ operator or not in Java.
Lets come to the point why its not advisable to use it and why your design may need a relook
From Effective C++, by Scott Meyers :
“Anytime you find yourself writing code of the form “if the object is of type T1, then do something, but if it’s of type T2, then do something else,” slap yourself.
Here is an example of the type of abuse Scott Meyers is speaking of : Read More…





Recent Comments