Why we do ViewModels in ECO:1. I really think that will make you and me more productive.
- No other reasons really.
How?
Using the ExpressionHandles, ReferenceHandle, VariableHandle etc lets you do the rendering part of Winforms, and also WPF (yes they work for WPF, we have added CursorManagerHandleWPF, but we have not spent time on bringing up the designers from WPF designer (other story really)).
Using EcoDataSource you can handle serverside rendering of ASP.NET.
- But is it REALLY an ideal situation to take model-info in the form of ocl and spread it out in many places like we do in all the handles and their columns? Sure you may only use default columns and nestings so you may not suffer from this. But having a transformation step between what you render (FullName) and your data (Titel FirstName Lastname) is actually very usefull. BUT I can use derived attributes for that you may say, and sure you can, but it does not necessarily remove the good thing of having a rendering layer between the model and UI.
This is more clear now than ever before; the WPF rendering model allow for true separation between UI and model. This may very well lead to a situation where you expose an idea for the UI that you hand over to designers to work on, while you continue to work on your model.... When you work on the model you will rename things, make things more detailed etc -> you have a different model than the one you gave the designers.
In this case it would be perfect if you had a rendering layer that states how you transform from the model to the UI-model - the ViewModel.
What ViewModels in ECO are is the declaration of this transformation, what the transformation is and how far it goes - nothing else.
ViewModels in ECO are NOT AutoGenerated forms Nagir. Promise (almost).
BUT when we have these named model transformations available in runtime it sort of opens up new possibilities. Instead of having to use 3 to 15 different handles on your form to make the master detail and comboboxes work as you want, we can use one ViewModel.
Thats why we did the ViewModelUserControl for Winforms, that reads the viewmodel and creates all the handles needed to fullfill a ViewModel. And sure you may not want to spend time on the UI-parts, even if you are able to plug and override it to get your own stuff in there. But you may still want to use the Datapart of it, to avoid the Handle mess.
In WPF where the ability to style the UI is endless, the ViewModel based user controls shows great promise to actually solve most of your needs, leaving more time to the complex stuff.
Having worked this way for a couple of weeks I am pretty confident that this is good stuff.
My vision is to provide ViewModels, then have different tools that work on these in runtime like the WinForm-UserControl, same for WPF, Silverlight, ASP.NET. Why not produce DTO's from the ViewModel (since it describes the transformation it would be perfect for this).
(Oh, before I get you started Pete, No I have not forgotten about our discussion about the naming of the ViewModels, but signs point to that the name stays)
/Hans Karlsen