At my company, we have many different "services" that work in parallel and send messages to each other using a common messaging system. All message objects are derived from a common generic object we defined for messaging. When any service receives a message, the first thing it must do is downcast the object to the derived type so that it can extract the data needed.
I have read all over the internet that you should not have to downcast a base object pointer to a derived object pointer and that having to do this is often a sign of bad design. I agree with this sentiment for most cases. And I can imagine different designs for the generic message object that wouldn't necessitate down-casting. But I don't see any big reason to handle this situation differently.
So my overall question is: Is down-casting always a bad thing? Are there situations in which down-casting is necessary or acceptable?
