Victor Garcia Aprea : Wednesday, June 06, 2007 - Posts

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Post Categories




Wednesday, June 06, 2007 - Posts

Adding Commands to a DSL from a 10,000ft view

The DSL Tools are a huge improvement towards getting a VS designer up and running in no time.

They make a good job of keeping you abstracted at a 10,000ft view from the inner workings of a Visual Studio designer.  You drag and drop shapes all around, defining your domain model and its graphical representation. You set properties here and there. And… you’re ready to go!

You now have thousands and thousands of automatically generated code implementing a VS designer which would have took you weeks to write if you went from scratch. That’s nice.

Now, let’s say you’re the kind of developer that likes to push the envelope and you come with the very wild idea of adding a menu command to the designer surface or a given shape of your DSL. Oh, yes, you’re wild.

At this point if you were an airplane you would have crashed. The nice 10,000ft altitude and the “I don’t have to worry about the dirty details” that you were used to while designing your domain model have changed for the feeling of hitting hard the ground.

You need to follow several steps procedure which includes things as dealing with a C++ preprocessor and knowing in lots of detail one of the most arcane format that Microsoft may have invented, the obscure world of Command Table definitions.

So, you’re already thinking of hiring a skilled senior C++ developer so you can add your menu command? Well, that’s not required if you’re willing to put the time to learn lots of non-interesting stuff about how to define a command, but if you have the time, you will eventually make it work (and that’s because you’re a wild developer, remember that).

With SFT we try to keep you at the 10,000ft for adding commands too. And in our latest public drop we’ve included an enhanced DSL Recipe Binder Wizard that will do the magic for you.

It allows you to choose between binding a command to a built-in shape (the designer surface, a link, etc) or one of your custom shapes (your foo shape), and specifying on which kind of selection you want your command to appear: single, multiple or any? Moreover, you want your command to appear only for those Foo shapes whose Bar whose property start with a ‘C’? Easy enough, click a checkbox specifying you want to customize the selection logic and you will get a partial class with an override method taking a Foo shape where you can write the single line of code required to check the Bar property.

This is how it looks like:

DslRecipeBinderWizard.png

Trust me, this is as easy as it gets.

posted Wednesday, June 06, 2007 11:39 PM by vga with 2270 Comments

Deploying Guidance Packages and DSLs the easy way

Let’s do a 15 seconds recap on what currently GAX/GAT and DSL Tools offer regarding deployment.

GAT : uses Visual Studio Setup projects (can you feel the pain already?) to deploy your custom guidance packages. If you don’t need anything beyond the very simply basics this setup will work nice even if you modify your guidance package sources after you created the setup, something that sounds basic enough but it’s not true for DSL Setup projects. Now, do you want to customize any part of the Guidance Package setup process with some detail? Good luck!

DSL Tools : uses WiX-based setups (hurray!) but… they’re as “static” as something can get. If you play with your DSL Tools and you afterwards create the Setup project high chances are that you end up with a non-working setup that needs manual editing, that’s not nice at all (after all: can’t you just read my DSL project at Setup creation time and play clever outputting something that works?). Even if you manage to create a working Setup (meaning basically you didn’t touch a thing from the original created DSL Package project) it will break as soon as you need any customization. Yes, you can try to learn the setup domain model that is there and update it manually every time you make a change, but... who really wants to do this?

Sounds bad enough already? Let’s complicate things a bit more. Let’s say your solution includes more than one guidance package and more than one DSL Tools, the successfully Web Services Software Factory from p&p, in its latest incarnation v3 (under development), is an example of this, last time I checked it included a couple of guidance packages and a couple DSL designers. You want to deploy this beast? Be my guest, you will only need to ask your users to install 4 or 5 different MSIs...

We notice this and took action in SFT by introducing a new SFT Setup project feature which lets you choose from all the guidance packages and DSLs found in your solution and get a single WiX-based project that generates a single MSI that will install as many guidance packages and DSLs as you wish; this is how it looks like:

 SFTSetupProject-Wizard.png

 

All you need to do is a few mouse clicks, no manual editing required, auto-updating of the setup project, and no custom domain model to learn about.

Can this get even better? Let me know how: vga -AT- clariusconsulting -DOT- net.

Want to learn more about this feature? Check Adrian’s blog who developed it.

posted Wednesday, June 06, 2007 11:19 PM by vga with 18064 Comments

Editing Text Template (T4) files: the Visual Studio/Notepad vs. SFT experience

If you have ever worked with GAX/GAT and/or the DSL Tools chances are that you had to look at existing templates and maybe customize them or create your own. Currently none of these two technologies offers you any remedies for the pain that is browsing and editing these templates with a “plain-text” experience.

So, let’s say you want to understand the serialization code in order to being able to introduce a few customizations of your own here and there. Try editing C:\Program Files\Visual Studio 2005 SDK\2006.09\VisualStudioIntegration\Tools\DSLTools\TextTemplates\Dsl\DomainClassSerializer.tt with Visual Studio (or notepad for that matter, as you’re not going to tell the difference in this case), it’s “only” 3751 lines of NO syntax coloring, NO code completion, NO quick navigation, NO nothing.

Let’s take another large file, Diagram.tt (living in the same folder as the file pointed out above). What changes in this case? It’s “only” 2469 lines in length, much shorter than the previous file, and we still get the NO nothing.

Ok, these are large files, not every text template file will be that large, granted. But can you still live with the “NO nothing” experience even for smaller files? I don’t think so, I know I can’t.

This is the reason why we have introduced a Text Template editor into SFT, for helping you today with your daily tasks in developing Software Factory projects.

Here is a single screenshot that should tease you enough to go download the bits:

T4editor-editingfile.png

You can also take a look at the Text Template Editor Quick Users Guide (lots of screenshots in there) and if you want to learn more about the technical side on how we implemented this feature you can check Jose’s blog who works on the SFT team.

posted Wednesday, June 06, 2007 9:57 PM by vga with 9851 Comments