This chapter will walk you through the creation of a Navigation Designer, which enables a business user to express the navigation of an Internet site or application using a custom designer built using the DSL Tools.
This chapter is based on the February 2006 CTP build of the DSL Tools; further changes are expected in later releases, mainly around the way you express your domain model and the designer definition. (See the Wiley website at http://www.wiley.com for future updates.) The latest release of the DSL Tools can be found at http://www.msdn.microsoft.com/vstudio/OSLTools/.
Navigation — say, of an Internet site — can be highly complex, and the semantics are typically wrapped up inside code, making the navigation hard to understand and change as the site evolves. At the initiation of such a project, a developer could spend weeks creating all of the pages and the links between them. The developer would reference documentation of the navigation during this stage, which can lead to errors as he or she "transcribes" from documentation to code. Generating the pages, code, and links directly from the model avoids this problem, and ensures that the model is always the primary source moving forward.
Consider the scenario in which your chosen technology vendor releases a new vision for site development. This typically requires you to rewrite much of the application.
Once the business user has expressed the navigation semantics graphically using the designer, you can then generate code from the model. In this case, you generate ASP.NET pages directly from the in-memory model as generated by the graphical designer.
Then, when Microsoft releases Windows Presentation Foundation, for example, you can modify the designer to emit XAML and instantly retool the application against a brand-new software technology. You're effectively abstracting yourself from the implementation technology, enabling your business to be more agile.
Another possible scenario is having this navigation domain model, but different users within your organization who wish to view and change the domain model in different ways. You can have two different designers who target the same navigation model but provide a different graphical designer. Perhaps a business user wishes to annotate the diagram to identify auditing points that are used during the code-generation phases to add code to write to an audit trail.