<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Alan Cameron Wills - Domain Specific Languages</title><link>http://blogs.msdn.com/alan_cameron_wills/default.aspx</link><description>Models, domain-specific languages, code generation, ....
</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>my new blog about UML</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2009/01/31/starting-a-new-blog.aspx</link><pubDate>Sat, 31 Jan 2009 17:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9386611</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/9386611.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=9386611</wfw:commentRss><description>&lt;P&gt;Since this blog has been all about my old job, I'm going to start a new one: &lt;A class="" href="http://blogs.msdn.com/alancameronwills/" mce_href="http://blogs.msdn.com/alancameronwills/"&gt;UML and Agile Development in Visual Studio&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9386611" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/UML/default.aspx">UML</category><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/model+driven/default.aspx">model driven</category><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/VSTS/default.aspx">VSTS</category></item><item><title>Writing about UML - my favorite pastime!</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2009/01/29/writing-about-uml-my-favorite-pastime.aspx</link><pubDate>Thu, 29 Jan 2009 15:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9383285</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/9383285.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=9383285</wfw:commentRss><description>&lt;P&gt;In the days long ago before I joined Microsoft, I was an itinerant consultant in UML. &lt;/P&gt;
&lt;P&gt;I'd wander the countryside with a slide deck, a projector and a cooking pot on my back, gathering small crowds under the shade of a tree to tell them the Good News: about how they could better understand and communicate about their&amp;nbsp;software designs by drawing boxes, lines and stick people on their cave walls; and about how they would, if they did this properly,&amp;nbsp;surely achieve their goals&amp;nbsp;and feed their families. Well - they'd improve the chances a bit, anyway. I asked only a mug of tea and a biscuit in return. (And my standard fee, of course.) It was an ascetic life but a rewarding one, particularly when some youngster would show especial enthusiasm and&amp;nbsp;I would introduce them,&amp;nbsp;by the&amp;nbsp;flickering light of my camp PC,&amp;nbsp;to the&amp;nbsp;arcane beauty of the Object Constraint Language and its virtues in the successful construction of tests; or the subtleties of covalent and contravalent composition among collaborations, and their uses in describing and applying design patterns.&lt;/P&gt;
&lt;P&gt;But there were sorrows too. And the most poignant of these came whenever my followers gathered about me would ask, as they inevitably would, "OK chief, this UML stuff is cool. But what about tools?" And I would have to shake my head with a heavy sigh and reply that alas, there were apps that would help you draw the diagrams, but few that really delivered the goods in terms of what you'd want to &lt;EM&gt;do&lt;/EM&gt; with the drawings once you'd drawn them. And that in consequence, they might as well stick to drawing on the cave walls. (Note: if you wish to do this, &lt;A class="" href="http://blogs.msdn.com/briankel/articles/Workspace_of_the_Future.aspx" mce_href="http://blogs.msdn.com/briankel/articles/Workspace_of_the_Future.aspx"&gt;please make sure your walls are&amp;nbsp;made of glass, and use dry-wipe pens&lt;/A&gt;.) &lt;/P&gt;
&lt;P&gt;And one or two of them, perhaps those who had traveled beyond the bounds of their own village, would sometimes say "Yeah, but we heard you can get these tools where you can reverse engineer your code into diagrams, and then edit the diagrams and transform the diagrams back into code." And I would agree that these tools are indeed of value in showing you the complex interactions between the objects, and to help you visualize the links and dependencies between the classes.&amp;nbsp;But after all, they only give you pictures of what is there in the program text. These tools&amp;nbsp;have no power to abstract the higher design of your code, the grand vision that was in your mind when you&amp;nbsp;wrote it (always assuming you had a grand vision, of course...);&amp;nbsp;they cannot know what you &lt;EM&gt;meant&lt;/EM&gt; when you wrote the code. That meaning has to come from you.&lt;/P&gt;
&lt;P&gt;This is the real strength of UML, properly used: to help you think about and discuss and communicate the crucial aspects of your design in just a handful of skillfully-chosen lines. A bit like a cartoonist drawing the key features of a politician; and not&amp;nbsp;like a camera slavishly recording pixels. Good UML tools don't just do the reverse engineering - they also help you express your big ideas, help you look at them from different angles, and help you turn them into plans, designs, and tests.&lt;/P&gt;
&lt;P&gt;So I'm delighted, now that I'm working for a toolsmith, to be working on modeling tools. And yes, some of the tools are about reverse engineering from code - and they do in fact &lt;A class="" href="http://blogs.msdn.com/camerons/archive/2008/07/11/layer-diagram.aspx" mce_href="http://blogs.msdn.com/camerons/archive/2008/07/11/layer-diagram.aspx"&gt;help you abstract the overall structure&lt;/A&gt;. But&amp;nbsp;they are also about using UML to understand your users' needs better, and to help you meet those needs successfully.&lt;/P&gt;
&lt;P&gt;My role is to write the user guides - not just at the mechanical level of what button to push, but also about how to make good use of UML in your project. &lt;A class="" href="http://blogs.msdn.com/alancameronwills/" mce_href="http://blogs.msdn.com/alancameronwills/"&gt;So&amp;nbsp;I'm going to start a new&amp;nbsp;blog&amp;nbsp;about UML&lt;/A&gt; - and, I hope, hear from you how &lt;U&gt;you&lt;/U&gt; use UML - and what you want from our tools. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9383285" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/UML/default.aspx">UML</category><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/model+driven/default.aspx">model driven</category><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Move to MSF</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2006/09/07/744209.aspx</link><pubDate>Thu, 07 Sep 2006 10:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:744209</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/744209.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=744209</wfw:commentRss><description>&lt;P&gt;I've joined MSF - the &lt;A href="http://msdn.microsoft.com/vstudio/teamsystem/msf/"&gt;Microsoft Solutions Framework&lt;/A&gt;.&amp;nbsp; MSF is about providing&amp;nbsp;process "guidance". &lt;/P&gt;
&lt;P&gt;Software development processes are about who does what and in what order - role X writes a spec or a story, role Y writes the software, role Z tests it, etc.&amp;nbsp; There are heaps of variations: different companies have widely differing sets of roles and responsibilities. In some outfits the workflow is simple: there's a list of tasks and people pick them off and do them; in some it's complex, involving multiple stages of work and signoffs. &lt;/P&gt;
&lt;P&gt;I put the quotes round process "guidance" because it used to mean a load of narrative text describing the responsibilities of each role - so if you're a tester, you can look up what to do in each circumstance.&amp;nbsp; But these days - particularly with the software factories movement - we're more interested in tooling up the guidance: "guidance" means everything in the user's environment (particularly Visual Studio) that supports the locally-adopted process.&amp;nbsp; Work-tracking tools, tools for doing particular tasks like UI design, languages specific to the company's business, constraints that help you remember to run your tests before you check in, queries that enable you to find how the project is progressing - everything that helps the team work together effectively; and everything that helps them work in the way that's best tuned to their business.&lt;/P&gt;
&lt;P&gt;Visual Studio already supports a lot of this customized process-oriented stuff. &lt;A href="http://msdn.microsoft.com/vstudio/teamsystem/Workshop/gat/download.aspx"&gt;GAT &lt;/A&gt;provides a way to extend VS so that a developer working on a particular type of job - designing UI or databases or some specific aspect of your project - can invoke tools specific to that type of work.&amp;nbsp; The &lt;A href="http://msdn.microsoft.com/vstudio/DSLTools/"&gt;DSL Tools &lt;/A&gt;provide ways to generate projectfuls of code from notations specific to your business.&amp;nbsp;&amp;nbsp; On a more process-oriented level, VS Team System lets you track progress of work items and set up a workflow&amp;nbsp;that's suited to your&amp;nbsp;project's way of working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Customizing and tuning the process to your company's business is a very important aspect. So a good chunk of my job over the coming months is going to be improving the tools for doing the customization. We're shifting the emphasis from the narrative style of guidance (though not losing it entirely) to the tooled-up style, and making it easy for people to make the tools suit them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=744209" width="1" height="1"&gt;</description></item><item><title>Models conference - place to show off your DSLs</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2006/02/14/531725.aspx</link><pubDate>Tue, 14 Feb 2006 11:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:531725</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/531725.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=531725</wfw:commentRss><description>&lt;P&gt;The &lt;A href="http://www.modelsconference.org/"&gt;Models Conference &lt;/A&gt;is in Genova, Italy this year (October 1-6). &lt;/P&gt;
&lt;P&gt;If you have developed some interesting stuff in DSL Tools, this is the place to share it and get useful feedback. If you're wondering about the best ways of using models to drive software, this is the place to hear about and discuss&amp;nbsp;others' experience and ideas. It's where you'll&amp;nbsp;meet the most innovative practitioners and tool makers in the field.&lt;/P&gt;
&lt;P&gt;If you have interesting questions you want to discuss, run a workshop.&amp;nbsp;&amp;nbsp;If you've got some interesting bits running on DSL Tools, show them off at a Poster Session - you'll get lots of good ideas and make interesting contacts. Or if you've advice to give, run a Tutorial. &lt;/P&gt;
&lt;P&gt;Models grew out of the old UML conference, and is the place to learn about model-driven software and development. Members of the DSL Tools team will be there; and have chaired and contributed to the conference on many occasions in the past.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=531725" width="1" height="1"&gt;</description></item><item><title>Extending the DSL Tools</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/12/20/505877.aspx</link><pubDate>Tue, 20 Dec 2005 12:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:505877</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/505877.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=505877</wfw:commentRss><description>&lt;P&gt;The &lt;A href="http://go.microsoft.com/fwlink/?LinkId=43636"&gt;DSL Tools&lt;/A&gt; are extensible - as well as&amp;nbsp;writing a specification of your own language, you can add your own code to extend the language and its tools in various ways. One of the best ways to learn the extensions is by reading the &lt;A href="http://go.microsoft.com/fwlink/?linkid=57539"&gt;DSL Samples&lt;/A&gt;. They include detailed writeups on how to customize the tools, with sections on validation, deployment, templates, customized shapes, menu commands, and other goodies.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=505877" width="1" height="1"&gt;</description></item><item><title>Models/UML conference</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/12/20/505875.aspx</link><pubDate>Tue, 20 Dec 2005 12:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:505875</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/505875.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=505875</wfw:commentRss><description>&lt;P&gt;The Models/UML conference has posted&amp;nbsp;its call for papers&amp;nbsp;&lt;A href="http://www.modelsconference.org/"&gt;http://www.modelsconference.org/&lt;/A&gt;. Steve, Stuart and I take it in turns on the programme committee for this. (Stuart was Programme Chair last year.)&lt;/P&gt;
&lt;P&gt;"The MoDELS series of conferences are devoted to the topic of model-driven engineering, covering both languages and systems used to create complex systems. These conferences are both an expansion and a re-direction of previous Unified Modeling Language (UML) conferences, and replaced that series of conference since last year."&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=505875" width="1" height="1"&gt;</description></item><item><title>End-to-end DSL samples available</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/12/13/503093.aspx</link><pubDate>Tue, 13 Dec 2005 11:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:503093</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/503093.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=503093</wfw:commentRss><description>&lt;P&gt;We've just published an&lt;A href="http://go.microsoft.com/fwlink/?linkid=57539"&gt; updated set of samples&lt;/A&gt; for the DSL Tools. As well as updates to the previous examples, which show how to customize your DSL, there's now a complete small end-to-end showing how&amp;nbsp;a DSL can be used to generate the code of&amp;nbsp;a project, and work as part of a larger solution.&lt;/P&gt;
&lt;P&gt;The scenario in the end-to-end is in a team where they often have to design Windows wizards. The layout of the wizard pages is constant, with Next and Back buttons and so on; but the sequence of pages can change. So the team decide to create a Wizard Sequence Definition language. From the language, most of the code for the wizards is generated. &lt;/P&gt;
&lt;P&gt;The developer assigned to author the language actually has two jobs: as well as creating the wizard sequence DSL itself, she has to create the generators that turn it into code.&amp;nbsp;She begins by designing a typical wizard, and then gradually turns it into a template which reads the page sequence from a DSL instance. There are multiple code files in the wizard, so there is a complete project full code all generated from one DSL file. &lt;/P&gt;
&lt;P&gt;When she is confident she has the language and the generated wizard project working, she packages it into a standard installer (MSI), with the help of the DSL Setup project. After her colleagues run the installer, they have a new project template available in theVisual Studio&amp;nbsp;"new project" menu, which creates their own copy of the wizard project. They can now add a wizard to any application, and quickly generate the wizard code from a drawing of the page sequence.&lt;/P&gt;
&lt;P&gt;The sample also makes good use of the new validation framework. Not all wizard sequences are valid - for example, you shouldn't have pages that can't be reached from the start page.&amp;nbsp;The language author only has to create the code for the constraints themselves, and the validation framework applies them at the right times and manages the error list.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=503093" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/DSL+Tools/default.aspx">DSL Tools</category></item><item><title>partial classes</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/11/03/483726.aspx</link><pubDate>Thu, 03 Nov 2005 05:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:483726</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/483726.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=483726</wfw:commentRss><description>&lt;P&gt;We use partial classes a lot in the &lt;A href="http://lab.msdn.microsoft.com/teamsystem/workshop/dsltools/default.aspx"&gt;DSL Tools&lt;/A&gt;. We need them to help compose code that's generated from different places, and generated with handwritten code.&lt;/P&gt;
&lt;P&gt;If you're not familiar with it, a partial class definition is just a set of methods, properties etc that gets combined with another partial definition at link time, to form a complete class. The parts can be in different source files, which makes it easier to manage them separately: different generators can output to different files. So in the DSL Tools Use Case template, there are two&amp;nbsp;generated files Designer.dsldm.cs&amp;nbsp;and Shapes.cs that each contain aspects of every shape you have defined in your language. You can add a separate file with your own definitions.&lt;/P&gt;
&lt;P&gt;There is a particularly useful pattern for providing a hook for optional manually defined features.&amp;nbsp; Each generated class - let's take Container.cs in the Use Case template - has a framework superclass in which default values are defined as&amp;nbsp;overridable properties. For example, HasBackgroundGradient is defined in the framework superclass OutlinedShape. This enables you to override HasBackGroundGradient if you wish in a partial Container class, but to leave it to default to the OutlinedShape value otherwise.&lt;/P&gt;
&lt;P&gt;Generated:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;partial&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ContainerShape&lt;/FONT&gt;&lt;FONT size=2&gt; : Microsoft.VisualStudio.Modeling.Utilities.OutlinedShape {...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;Framework&lt;/FONT&gt;: &lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;public class&lt;/FONT&gt; OutlinedShape { &lt;FONT color=#0000ff&gt;protected virtual bool&lt;/FONT&gt; HasBackgroundGradient { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; true; } } ...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Optional manual override:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;public class&lt;/FONT&gt; OutlinedShape { &lt;FONT color=#0000ff&gt;protected override bool&lt;/FONT&gt; HasBackgroundGradient { &lt;FONT color=#0000ff&gt;get&lt;/FONT&gt; { &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; false; } } ...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;It isn't as sophisticated or flexible as delegation or aspect weaving, but does the trick.&lt;/P&gt;
&lt;P dir=ltr&gt;Unfortunately, it only works for program code! If we're generating tables, configuration files, or reports, we need a way of merging them together. One way is to get the generator to read the file and only replace particular bits, corresponding to one view. Another, cleaner, way is to have each source generating to a separate file, and then weave them together in a final step.&lt;/P&gt;
&lt;P dir=ltr&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=483726" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/DSL+Tools/default.aspx">DSL Tools</category></item><item><title>Constraints and Restrictions in MS DSL Tools</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/10/31/483716.aspx</link><pubDate>Mon, 31 Oct 2005 03:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:483716</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/483716.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=483716</wfw:commentRss><description>&lt;P&gt;I do get irritated by over-officious tools. "You can't use that name, you've used it already over there." Well, I know, but I'm going to change that in a moment, and it'll be alright in the end, really. &lt;/P&gt;
&lt;P&gt;In the &lt;A href="http://lab.msdn.microsoft.com/teamsystem/workshop/dsltools/default.aspx"&gt;DSL Tools&lt;/A&gt; &lt;A href="http://go.microsoft.com/fwlink/?linkid=54997"&gt;Customization Samples &amp;amp; Guide&lt;/A&gt;, there is a section showing you how to prevent the user from making undesirable connections, such as loops in inheritance graphs. As the user moves the mouse to complete the last link in a loop, a tooltip pops up saying "that connection would create a loop" and the arrow changes to a not-allowed&amp;nbsp;sign. This is quite effective, but of course you might prefer to let your user make the loop, and then cut it somewhere else later.&lt;/P&gt;
&lt;P&gt;Also, the computation to find the loop - or whatever other restriction - has to be fast, to respond to the user's mouse movements in real time. In some cases, that might prohibit this method.&lt;/P&gt;
&lt;P&gt;The solution is to use the new Validation framework, which is coming in the next version of DSL Tools. It allows you to specify constraints on any class (or superclass, or relation, or the whole model). These are applied&amp;nbsp;to all instances of the type&amp;nbsp;when the model is opened or saved, or on the user's explicit command. Error messages appear in the VS task list, and clicking on an error selects the offending objects. You write just the C# code for the constraint itself, and the framework applies it as required.&lt;/P&gt;
&lt;P&gt;This means you have a choice of when to apply a constraint - at the moment it is about to be contravened, or at validation time.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=483716" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/DSL+Tools/default.aspx">DSL Tools</category></item><item><title>Rules in the DSL Tools</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/10/27/483708.aspx</link><pubDate>Thu, 27 Oct 2005 02:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:483708</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/483708.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=483708</wfw:commentRss><description>&lt;P&gt;In the&amp;nbsp;&lt;A href="http://lab.msdn.microsoft.com/teamsystem/workshop/dsltools/default.aspx"&gt;DSL Tools&lt;/A&gt; &amp;nbsp;&lt;A href="http://go.microsoft.com/fwlink/?linkid=54997"&gt;Customization Samples &amp;amp; Guide&lt;/A&gt;&amp;nbsp;there's some examples that use MDF rules to spot a change and react to it. (1) In the class diagram sample, attributes are displayed as a string like "aName : SomeType", and in the properties grid, the name and type are in separate properties. All three forms are accessible to code, for example in any generator template. A rule&amp;nbsp;fires when any of the properties changes, and propagates the change to the others. (2) In the activity diagram sample, rules are used to snap the Sync Bar shape always to be a constant width or height, no matter how the user pulls the corners. (3) There is&amp;nbsp;a (rather primitive!) container shape in the activities and use-case samples, vaguely reminiscent of a swimlane and a system boundary respectively. The shape manages the trick of always remaining behind other shapes; and when it moves, so do any shapes within its boundaries.&lt;/P&gt;
&lt;P&gt;In all these cases, you'll notice that if you undo&amp;nbsp;a change, the whole thing undoes in one go: you don't, for example, have to first undo the readjustment to the shape, and then another undo for&amp;nbsp;the original change. This is because the rule framework is part of the MDF transaction system. (MDF is the framework underlying the DSL Tools and other graphical designers in Visual Studio.) All the properties of an object - size and color of a shape, the value properties you've specified in your language, etc - are accessed through a framework that knows about the rules, and schedules firings as appropriate. Changes are always made within a transaction, and when the transaction is committed, the rules fire. All the firings are counted as being part of the transaction, which is the unit of undo/redo.&lt;/P&gt;
&lt;P&gt;As you can see from the samples, rules are attached to specific types (such as SyncBarShape), using a class attribute.&amp;nbsp;Each rule is a class inheriting from one of&amp;nbsp;a few abstract parents. The most useful of these are ChangeRule, which monitors property changes, AddRule, RemovingRule (about to delete)&amp;nbsp;and RemovedRule (after deletion). The main thing to be careful of is infinite reiterations: if a rule makes a change, it the appropriate rule will be scheduled on the firing list. However, ChangeRules only fire if there is an actual change of value - a set operation by itself doesn't fire. So in a rule that re-adjusts the same property that caused the firing, you just have to make sure things always converge rapidly on a stable value that gets adjusted to itself.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size=2&gt;(If you're fascinated by scrolling through that long list you get after typing "override"&amp;nbsp;in&amp;nbsp;one of your language classes, you'll notice some&amp;nbsp;methods called "On...Changed". You can override these to get an effect like the rules, but it doesn't work so well. The On... method is called after the end of the transaction, so you have to open another transaction to make your adjustments. Then of course, the user gets a horrible two-stage undo (which might sometimes be what you want, I suppose). And the biggest pitfall is that you mustn't make changes if the original change is part of an undo or redo - so if you decide you really must use this method, bracket the code with "if (!&lt;FONT color=#008080&gt;Store&lt;/FONT&gt;.InUndoRedoOrRollback)..."&amp;nbsp; But it's really not recommended, and may not work in future versions.)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=483708" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/DSL+Tools/default.aspx">DSL Tools</category></item><item><title>Code is Model?</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/10/22/483718.aspx</link><pubDate>Sat, 22 Oct 2005 04:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:483718</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/483718.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=483718</wfw:commentRss><description>&lt;P&gt;Interesting post and comments on Harry Pierson's blog:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://devhawk.net/2005/10/05/Code+Is+Model.aspx"&gt;http://devhawk.net/2005/10/05/Code+Is+Model.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=483718" width="1" height="1"&gt;</description></item><item><title>Customizing the MS Domain Specific Language Tools</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/10/22/483692.aspx</link><pubDate>Sat, 22 Oct 2005 01:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:483692</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/483692.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=483692</wfw:commentRss><description>&lt;P&gt;One of the features of the &lt;A href="http://lab.msdn.microsoft.com/teamsystem/workshop/dsltools/default.aspx"&gt;DSL Tools&lt;/A&gt;&amp;nbsp;is extensibility.&amp;nbsp;With the language definition files, you can define a wide range of thing-and-link style graphical notations. The current version of the Tools comes with a set of templates for creating class, use case and activities diagrams; but the idea is that you adapt the language definitions to suit your own purposes -&amp;nbsp;for example to add new sorts of classes, or cut out some sorts of association.&lt;/P&gt;
&lt;P&gt;That kind of change can be made in the language definition files. But by plugging in your own custom code, you can extend the features of your language to obtain&amp;nbsp;even more&amp;nbsp;interesting effects. &lt;/P&gt;
&lt;P&gt;For example, in the Activity Diagrams template in the latest version of the Tools, there's a shape called Synchronisation Bar. It comes onto the diagram as a long thin black rectangle; but of course, the user can pull the corners so that it doesn't look like a Sync Bar any more. But with a bit of custom code, you can constrain the height to be constant - so that the user can only make it longer or shorter. (Actually, a neat trick is to snap it either to a thin horizontal bar or a thin vertical one, depending on how the user tries to reshape it - so they can reorient it and change the length, but it's always a bar, one way or the other.)&lt;/P&gt;
&lt;P&gt;Another useful extension is connectivity restrictions.&amp;nbsp;With the Class Diagrams template, you can make a language with classes, associations and inheritance etc. Again, your first step would probably be to adapt the language definition to do what your team needs; but pretty soon, you'll notice that it's perfectly possible to draw diagrams in which Class A inherits from Class B inherits from Class A - round in a loop. If your application&amp;nbsp;needs to exclude this, you can write code that stops the user making a loop -- popping up a warning as soon as the mouse hovers over the target of the last link. &lt;/P&gt;
&lt;P&gt;There are also a few features you can obtain with custom code in the current version of the Tools, that will probably be controlled through the language definition files in the Release version -- for example, whether connectors are straight or rectangular, background color is graduated, and other basic stuff.&amp;nbsp; Other features require fairly complex code at present, but will be simplified in the future - for example, if you want to add your own menu commands to the designer.&lt;/P&gt;
&lt;P&gt;We've recently released a&amp;nbsp;&lt;A href="http://go.microsoft.com/fwlink/?linkid=54997"&gt;Customization Samples&amp;nbsp;&amp;amp; How-To Guide&lt;/A&gt;&amp;nbsp;package that explains these techniques, and include code for all these features. Follow the link, download, and enjoy!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=483692" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/alan_cameron_wills/archive/tags/DSL+Tools/default.aspx">DSL Tools</category></item><item><title>DSLs at JAOO</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/09/30/475597.aspx</link><pubDate>Fri, 30 Sep 2005 05:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:475597</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/475597.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=475597</wfw:commentRss><description>&lt;P&gt;JAOO&amp;nbsp; in Aarhus, Denmark, is getting big - almost 900 participants, I heard.&lt;/P&gt;
&lt;P&gt;There was a Domain Specific Languages track on Wednesday - DSLs is really gathering steam!&amp;nbsp; The day kicked off with an excellent plenary on Software Factories and DSLs&amp;nbsp;by Microsoft architects &lt;A href="http://www.thearchitectexchange.com/asehmi/"&gt;Arvindra Sehmi &lt;/A&gt;and &lt;a href="http://blogs.msdn.com/beatsch/"&gt;Beat Schwegler&lt;/A&gt;. Markus Voelter gave a very interesting talk on how to design DSLs, and Juha-Pekka Tolvanen&amp;nbsp;- who has been doing it&amp;nbsp;for a decade - about how to put them to use.&lt;/P&gt;
&lt;P&gt;MetaCase (usually represented by Juha-Pekka or Steve Kelly) always emphasise how you can build whole systems from DSLs, without any (or much) extra 'glue' code. I guess this is because in general they're working with mature product lines - often in embedded systems like phones. There, the generic framework is sufficiently evolved with sufficiently well-defined bounds.&amp;nbsp; In the MS work, we tend to talk more about cases where the DSL is just covering some part of it.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=475597" width="1" height="1"&gt;</description></item><item><title>Frequently Asked Questions</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/08/08/448934.aspx</link><pubDate>Mon, 08 Aug 2005 11:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:448934</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/448934.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=448934</wfw:commentRss><description>&lt;P&gt;There's now a &lt;A href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=64869"&gt;DSL Tools FAQ&lt;/A&gt;, which I've pulled together from the multifariouse Q&amp;amp;A on the DSL Tools Forum over the past few months.&lt;/P&gt;
&lt;P&gt;Thanks to all the questioners and answerers.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=448934" width="1" height="1"&gt;</description></item><item><title>Course on DSLs</title><link>http://blogs.msdn.com/alan_cameron_wills/archive/2005/08/02/446543.aspx</link><pubDate>Tue, 02 Aug 2005 10:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:446543</guid><dc:creator>Alan Cameron Wills</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/alan_cameron_wills/comments/446543.aspx</comments><wfw:commentRss>http://blogs.msdn.com/alan_cameron_wills/commentrss.aspx?PostID=446543</wfw:commentRss><description>&lt;P&gt;Interesting progress - there's an independent company offering courses on DSLs, including DSL Tools as an exemplar.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.clipcode.biz/workshops/Clipcode_DSL_Workshop_Data_Sheet.pdf"&gt;http://www.clipcode.biz/workshops/Clipcode_DSL_Workshop_Data_Sheet.pdf&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=446543" width="1" height="1"&gt;</description></item></channel></rss>