I am surely missing something huge, I've seen this problem several times so I would like to know your opinion on resolving these code-smells.
- Background is a windows forms app organized using the MVC architecture pattern.
- Data is organized in a hierarchical way (tree model), with different types of nodes representing different types of data.
- Data view is a composite view, containing various views which can be added or modified according to customers request. Each data node can be represented using several views (table, chart, custom stuff), and each view knows how to display one or more different data node types.
- Before displaying, some views also require that the data is processed in some way. Multiple views can use the same processed data, but not all views use the same data, so this processing is not related to the only one view or one node type.
So the thing that bothers me is that, in current implementation, nodes' interface is becoming overloaded with many properties like "Node.CanProvideThisData" or "Node.CanProvideSomeOtherData", which each derived node is required to implement. This shows that a node's interface knows too much about everything, right?
Who should, in your opinion, decide where and when will this processing happen, so that each view gets the desired processed data, and that no processing is duplicated?
Did you have similar problems before? Or do you think that there is something wrong with the implementation (or my understanding of implementation) of MVC? Or is this something that could be fixed with some refactoring?
Edit: One more thing that should be considered, of course, is handling later modifications. This interface, as bad as it may be, does force the programmer to implement each part of the contract, so any new node implementations should work instantly.