Wednesday, December 20, 2006

Some time ago I started building a new Domain Specific Language for modeling message and data contracts. Building the DSL was pretty straight forward so it didn't take me too much time to build the beauty. However, during the debugging and testing phase of that DSL I noticed that the user experience of the DSL wasn't too good. For example, this particular DSL lets you model a data contract. Each data contract has a relation with one or more data members (implemented as compartment items) and for each data member you have to set its name, type, order and required properties. So, to add a data member to a data contract in my DSL I first had to do two right mouse clicks, after that I had to type the name of the data member, after that I had to switch to the properties windows and type the various values of the data members properties. This just didn't feel too good, especially when modeling a number of message and data contracts in a row. At that time I decided not to use the DSL, simply because of the, in my opinion, poor user experience.

Just recently, during some other Domain Specific Language related work I noticed again that I had some trouble getting the user experience right for modeling "relations" between model elements. Again, it was the same number of mouse clicks that bothered me (maybe it's just me?!). So, it was about time to try and find a solution for this "problem". I soon decided to build my own custom tool window specifically for my DSL but didn't know yet how to represent the "relational data" in that tool window. Luckily, in one of my talks with Jezz he came up with this brilliant idea to use the "VirtualTreeControl" (Microsoft.VisualStudio.VirtualTreeGrid.dll) for this purpose. He already used this control in the EFx Factory as you can see here. I have to be honest, this control is a real bitch to figure out, it isn't documented and I don't even know if it is officially supported but with some help of Jezz and a wrapper he built for it specifically for DSL relations, I got this working for my message-/data contracts DSL.

With this control you can show hierarchical domain relationships, and each row can have child rows, and you can display whatever columns of data you want from the relationships and domain classes.

As you can see in the picture below I can now maintain my "relational data", for my data contracts (in this case data members) in my custom tool window ("Data Contract Editor". I can easily add new data members and set their properties without having to switch between the mouse and keyboard over and over again. I think this control really rocks and I absolutely love its user experience.

The control is especially useful for exposing domain relations and domain classes which don’t have shapes or connectors on the diagram. For example, children of domain classes displayed in compartments. Therefore the control reduces shape ‘clutter’ on the diagram.

I like to consider tool windows and/or editing controls like this as "out of the box" features for future releases of the DSL Tools! In my opinion, it will dramatically improve the usage scenarios of DSL build with the DSL Tools.

posted on 12/20/2006 12:08:19 PM UTC  #