Hi,
I find there is a tension between the principles of "tell don't ask" and model view seperation. For example, I always end up with code like this :
Not ideal, switching on the objects type.
However to maintain model/view seperation, I cannot ask the object for it's image.
I could also create a map of class to image, but that is just another way of writing the switch statement, and it doesn't handle subclasses so well
I've tried using a double dispatch
pattern, and while this does get rid of the switch, it makes the code much more confusing.
So in the end, I just live with the switch statement. Are there any other patterns/approaches I could use here?
thanks, Don.