Domain-Specific Development with Visual Studio DSL Tools

by ; ; ;
  • ISBN13:


  • ISBN10:


  • Edition: 1st
  • Format: Paperback
  • Copyright: 2007-05-24
  • Publisher: Addison-Wesley Professional
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $59.99 Save up to $9.00
  • Buy New
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


Domain-Specific Languages (DSLs)--languages geared to specific vertical or horizontal areas of interest--are attracting growing excitement from software engineers and architects. DSLs bring new agility to the creation and evolution of system requirements and simplify their translation into code, significantly reducing development costs in large-scale projects. In this breakthrough book, four leading experts reveal exactly how DSLs work, and how you can make the most of them in your environment. You'll begin by mastering DSL concepts and techniques that apply to all platforms. Next, discover how to create and use DSLs with the powerful new Microsoft DSL Tools--a toolset designed by this book's authors. Learn how the Microsoft DSL Tools integrate into Visual Studio 2005--and how to define DSLs and generate Visual Designers using Visual Studio's built-in modeling technology. In-depth coverage includes Determining whether DSLs will work for you Comparing DSLs with other approaches to model-driven development Defining, tuning, and evolving DSLs: models, presentation, creation, updates, serialization, constraints, validation, and more Creating Visual Designers for new DSLs with little or no coding Multiplying productivity by generating application code from your models with easy-to-use text templates Automatically generating configuration files, resources, and other artifacts Deploying Visual Designers across the organization, quickly and easily Customizing Visual Designers for specialized process needs The book's companion Web site (www.domainspecificdevelopment.com) includes code samples, plus additional resources and information.

Author Biography

Steve Cook is a software architect in the Enterprise Frameworks and Tools group at Microsoft Gareth Jones, DSL Tools Lead Developer, has been at Microsoft since 1997 Stuart Kent joined Microsoft in 2003 as a program manager to work on the DSL Tools Alan Cameron Wills was a methodology consultant for nearly a decade before joining Microsoft in 2003

Table of Contents

List of Figuresp. xvii
List of Tablesp. xxv
Forewordp. xxvii
Prefacep. xxix
About the Authorsp. xxxv
Domain-Specific Developmentp. 1
Introductionp. 1
Domain-Specific Developmentp. 2
Examplesp. 4
Software Defined Circuitryp. 8
Embedded Systemsp. 9
Device Interfacesp. 9
Software Development Process Customizationp. 9
Benefitsp. 10
Languagesp. 11
Textual DSLsp. 15
Graphical DSLsp. 20
Conventions for Representing Structurep. 21
Conventions for Representing Behaviorp. 22
Aspects of Graphical DSLsp. 23
Notationp. 24
Domain Modelp. 24
Generationp. 24
Serializationp. 25
Tool Integrationp. 26
Putting It All Togetherp. 26
DSLs in Visual Studiop. 27
The Customization Pitp. 32
UMLp. 34
Summaryp. 40
Creating and Using DSLsp. 41
Introductionp. 41
Process: Incremental Development of DSLsp. 41
Generalizing an Application: Identify Variability, Discover DSLsp. 42
Top-Down and Bottom-Upp. 46
Developing the DSL: From Sketches to Domain Modelp. 48
Domain Model and Presentation Are Separatep. 49
Refining the DSLp. 50
Driving the Framework from the DSLp. 51
Using the DSLp. 53
Evolving the DSLsp. 55
Interpretive Architecturesp. 56
Creating a DSL in Visual Studiop. 57
Creating a DSL Authoring Solution in Visual Studiop. 57
Trying Out the DSL Solutionp. 61
Defining the DSLp. 64
Generating the Code for the Designerp. 66
Adding to the DSLp. 67
Constraintsp. 68
Customizing the Explorer Windowp. 71
Customizing the Properties Windowp. 72
Custom Code for the Designersp. 73
Serialization Format of the DSL Filep. 73
Driving Applications from the DSLp. 74
Deploymentp. 76
A Second DSL: The Project Definition DSLp. 77
Architecture of the DSL Toolsp. 78
The Generated Codep. 78
DSL Tools Architectural Layersp. 79
The Framework Assembliesp. 79
Content of the DSL Projectp. 81
Content of the DslPackage Projectp. 83
Summaryp. 85
Domain Model Definitionp. 87
Introductionp. 87
The Domain Model Designerp. 88
The In-Memory Storep. 89
Domain Classesp. 92
Domain Relationshipsp. 98
Embeddingsp. 101
Multiplicityp. 104
Referencesp. 105
Relationship Derivationp. 106
Generating a Designer with No Shapesp. 108
The Generated Codep. 109
Using the Generated Codep. 113
More about Domain Classesp. 115
DomainClassInfop. 118
More about Domain Propertiesp. 119
Calculated Propertiesp. 121
DomainPropertyInfop. 121
More on Domain Relationships and Rolesp. 122
Accessing Linksp. 124
More on Relationship Derivationp. 126
DomainRelationshipInfo and DomainRoleInfop. 129
More about the Storep. 129
Looking Up Elementsp. 129
Partitionsp. 130
Rulesp. 130
DomainModelInfop. 130
Summaryp. 131
Presentationp. 133
Introductionp. 133
Graphical Notation-Overviewp. 134
Diagram and Editorp. 137
Diagramp. 138
Editorp. 141
Designerp. 142
Custom Editorp. 142
Shapesp. 146
Kinds of Shapesp. 147
Shape Mapsp. 154
Connectorsp. 164
Connector Anatomy and Appearancep. 164
Connectors and Inheritancep. 165
Connector Mapsp. 165
Advanced Connector Mapsp. 167
Decoratorsp. 167
Kinds of Decoratorsp. 168
Positioningp. 169
Decorator Mapsp. 170
Customizing the Graphical Notation in Codep. 173
Multiline Text Decoratorsp. 173
Variable Image Shapep. 174
Set a Background Picturep. 176
Set Custom Connection Pointsp. 177
Change Routing Style of Connectorsp. 178
Explorerp. 180
Default Appearancep. 181
Changing the Window Icon and Labelp. 183
Customizing the Appearance of Nodesp. 184
Hiding Nodesp. 186
Customizing the Explorer through Codep. 187
Properties Windowp. 188
Default Appearance of Properties Windowp. 188
Categories, Names, and Descriptionsp. 190
Hiding Properties and Making Them Read-Onlyp. 192
Forwarding Propertiesp. 192
Customizing the Properties Window through Codep. 193
Summaryp. 195
Creation, Deletion, and Update Behaviorp. 197
Introductionp. 197
Element Creationp. 197
The Toolboxp. 198
Element Merge Directivesp. 200
Custom Element Merge Directivesp. 208
Re-Parenting with Element Merge Directivesp. 211
Custom Element Tool Prototypesp. 212
Connection Buildersp. 216
Multiple Source and Target Role Directivesp. 217
Multiple Link Connect Directivesp. 219
Custom Connection Buildersp. 222
Element Deletionp. 229
Default Delete Propagation Rulesp. 229
Controlling Delete Propagationp. 231
Customizing Delete Propagationp. 232
Summaryp. 234
Serializationp. 237
Introductionp. 237
Saving and Loading Models and Diagramsp. 238
Model XML File Formatp. 239
Elements and Propertiesp. 242
Relationshipsp. 243
Relationship Derivationp. 245
Cross-Referencingp. 245
Using Guids as Referencesp. 246
Using Qualified Names as Referencesp. 248
References to Linksp. 249
Diagram XML File Formatp. 251
Versioning and Migrationp. 254
The XML Schemap. 257
Customizationp. 258
Modifying XML Element Namesp. 259
Element Datap. 261
Implementing Your Own Serializerp. 264
Generated Serialization Codep. 264
Customized Serialization Codep. 271
Impact of Customization on the Schemap. 272
Summaryp. 273
Constraints and Validationp. 275
Introductionp. 275
Choosing Hard or Soft Constraints?p. 277
Choices Made by the DSL Toolsp. 280
Soft Constraints in the DSL Toolsp. 280
Validation Methodsp. 282
Enabling Validationp. 284
Invoking Validationp. 288
Custom Validation Categoriesp. 289
Inheriting Validation Behaviorp. 292
Validation Outputp. 292
Using Validation Outside the IDEp. 293
Validation Against External Datap. 294
Hard Constraints in the DSL Toolsp. 295
Rulesp. 296
Putting Together Hard and Soft Constraintsp. 299
Summaryp. 307
Generating Artifactsp. 309
Introductionp. 309
Artifact Generation Stylesp. 311
Extensible Stylesheet Language Transformationsp. 311
Making Use of the Domain-Specific APIp. 314
A Template-Based Approachp. 319
Complex Relationships and Round-Trippingp. 321
The Templatization Processp. 325
The First Cut Templatep. 328
Generation-Specific Model Datap. 338
Starting to Build a Libraryp. 340
Syntax of a Text Templatep. 341
Directivesp. 341
Custom Directivesp. 344
Control Block Typesp. 346
Problems of Large-Scale, Real-World Artifact Generationp. 349
Advanced Customizationsp. 351
Text Templating Architecturep. 352
Custom Hostingp. 354
Custom Directive Processorp. 357
Custom Orchestrationp. 359
Summaryp. 366
Deploying a DSLp. 369
Introductionp. 369
Files Needed to Install a Designerp. 370
Getting Started-Creating a Setup Projectp. 373
Setup Project Contentsp. 376
Customizing Setupp. 377
Customizing InstallerDefinition.dslsetupp. 377
Customizing settings.inip. 377
Customizing Strings.wxlp. 378
Customizing Product.icop. 378
The .dslsetup Formatp. 378
[left angle bracket]dslPackage[right angle bracket]p. 380
[left angle bracket]licenseAgreement[right angle bracket]p. 382
[left angle bracket]supportingFiles[right angle bracket]p. 382
[left angle bracket]vsItemTemplates[right angle bracket]p. 383
[left angle bracket]dslSchemas[right angle bracket]p. 384
[left angle bracket]vsProjectTemplates[right angle bracket]p. 384
[left angle bracket]mergeModules[right angle bracket]p. 384
[left angle bracket]textTemplates[right angle bracket]p. 385
Refreshing the Installation Filesp. 387
Package Load Keyp. 388
Deploying Text Templates for Code Generationp. 390
Creating a Project Template from the Debugging Projectp. 390
Using a Text Template Include Filep. 392
Including Text Templates in the VS Item Templatep. 393
Summaryp. 396
Advanced DSL Customizationp. 397
Introductionp. 397
Tools for Customizationp. 397
Partial Classesp. 397
Double Derived-The Generation Gapp. 398
Custom Constructorsp. 399
Customization Switchesp. 399
Custom Overridesp. 401
Responding to Changesp. 402
Property Handlers "On Value Changed/Changing"p. 402
Calculated Domain Propertiesp. 404
Custom Storage Domain Propertiesp. 405
Notify Value Changep. 407
Propagating Change from Model to Shape: OnAssociatedPropertyChangedp. 408
Rulesp. 412
Store Eventsp. 417
.NET Event Handlersp. 419
Event Overridesp. 420
Bounds Rulesp. 420
Summary of Change Propagation and Constraint Techniquesp. 424
DSL Shell Architecturep. 426
How to Add a Menu Commandp. 429
Add a Command Id for Each Commandp. 430
Increment Menu Resource Indexp. 430
Add Commands to Command Setp. 431
Define the Command Handlersp. 432
Good Practices for Command Handlersp. 434
Build and Runp. 435
Providing Handlers for Standard Commandsp. 435
Building the DSL Diagram into Another Interfacep. 435
Implementing Copy and Pastep. 437
The Copy Methodp. 437
The Paste Methodp. 438
Registering the Menu Handlersp. 440
Shape Containersp. 442
Child Shapesp. 442
A DSL Using Nested Child Shapesp. 443
Shape Containment Using Rulesp. 446
Summaryp. 453
Designing a DSLp. 455
Introductionp. 455
Identifying Variabilityp. 456
Bottom-Up or Top-Down?p. 457
Feature Treesp. 458
Feature Trees and DSLsp. 459
Developing the Domain Modelp. 460
Sketch Domain Snapshotsp. 460
Domain Model from Snapshotsp. 464
Developing the Notationp. 468
Project Definition Notationp. 470
Issue State Notationp. 471
Familiar Notationsp. 474
Defining Validation Constraintsp. 475
Internal Consistencyp. 476
Consistency with External Data and Modelsp. 478
Developing and Evolving the Frameworkp. 479
Generation versus Interpretationp. 479
Evolving a Generic Frameworkp. 481
Driving a Framework from the DSLp. 483
Testingp. 484
Validation Constraintsp. 486
Generator Templatesp. 488
Generated Codep. 488
Rulesp. 489
Language Definitionp. 489
Evolving a DSLp. 489
What Makes a Good DSL?p. 491
Appropriate Notation: An Example with Regular Expressionsp. 493
Candidate Notationsp. 495
Graphs Are Not Syntax Treesp. 498
Summaryp. 498
Conclusionp. 499
Indexp. 503
Table of Contents provided by Ingram. All Rights Reserved.


This book is a software developer's guide to using the Microsoft Tools for Domain-Specific Languages ("DSL Tools"), which are included in the SDK (Software Development Kit) for Microsoft Visual Studio 2005.The software industry is showing considerable interest in using "domain-specific languages," an approach to building software that promises to reduce software development costs, especially in large projects. A domain-specific language (DSL) is a language specially geared to working within a particular area of interest: a vertical domain such as telephone design, or a horizontal one like workflow. It may be a programming language or a specification or design language. It may be textual or graphical, or a mixture of both. The language is expressed in terms that are used in a particular domain, such as "connect," "ringtone," or "work item," uncluttered by the details of how those concepts are implemented. Software, configuration files, resources, and other documents can be generated from instances of the language--often many of those artifacts can be generated from one DSL--or the language may be interpreted directly. This makes it much easier to discuss the software at the requirements level, and to make changes in an agile way. In vertical domains, the accessibility of the language to business users helps when discussing requirements with them.DSLs are not a new idea--HTML and SQL are well-known examples of DSLs. Less widespread, however, is the idea of creating your own DSL for your own project. The purpose of the Microsoft DSL Tools is to reduce the upfront cost of doing so. You can quickly create a range of diagrammatic languages, such as workflow, class, or entity diagrams, and you can create tools for generating artifacts from them. Goals and ScopeThis book is for you if you are a software developer or architect using, or thinking about using, the Microsoft DSL Tools. It explains how to create and use languages, how to tune them to your needs, and how to employ them within the context of your project. The book should also be of significant value to readers who are interested in the broader general topic of domain-specific languages, or who wish to compare and contrast different approaches to model-driven development, or tools that support model-driven development. Chapters 1 and 11 discuss the more general topic of domain-specific languages, and how you go about designing one. The middle chapters focus exclusively on providing a detailed yet readable reference on building DSLs and code generators using the DSL Tools.The book's authors are the main designers of the Microsoft DSL Tools. They have worked together on the product since its inception, and are responsible for most of the key design decisions. Why You Might Want to Use DSL ToolsIf you (or your organization) are writing the same or similar code repeatedly, whether within a single large project or over the course of multiple projects, then such code can probably be generated. If this is the case, you should consider using the DSL Tools as a way to generate this code. This is especially the case if the code can be generated from structures that can easily be understood by domain specialists rather than software development specialists. After reading this book, you should be able to assess the capabilities of the DSL Tools to address problems of this kind, either directly or after some customization. Organization of This BookChapter 1, Domain-Specific Development, explains the DSL approach, compares it with similar techniques, and introduces typical scenarios in which a DSL is used.Chapter 2, Creating and Using DSLs, looks at the various parts of the DSL Tools system, shows how they fit together, and introduces the main examples that will be used through the remainder of the book.Chapter 3, Domain Model Definition, details how to define the concepts of the language.Chapter 4, P

Rewards Program

Write a Review