Domain-Specific Development with Visual Studio DSL Tools

Domain-Specific Languages (DSLs)--languages geared to specific vertical or horizontal areas of interest--are generating growing excitement from software engineers and architects. DSLs bring new agility to the creation and evolution of software, allowing selected design aspects to be expressed in terms much closer to the system requirements than standard program code, significantly reducing development costs in large-scale projects and product lines. In this breakthrough book, four leading experts reveal exactly how DSLs work, and how you can make the most of them in your environment.

With Domain-Specific Development with Visual Studio DSL Tools, you'll begin by mastering DSL concepts and techniques that apply to all platforms. Next, you'll 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 DSL Tools integrate into Visual Studio--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

List of Figures
List of Tables

Foreword

Preface

About the Authors
Chapter 1 Domain-Specific Development
Chapter 2 Creating and Using DSLs
Chapter 3 Domain Model Definition
Chapter 4 Presentation
Chapter 5 Creation, Deletion, and Update Behavior
Chapter 6 Serialization
Chapter 7 Constraints and Validation
Chapter 8 Generating Artifacts
Chapter 9 Deploying a DSL
Chapter 10 Advanced DSL Customization
Chapter 11 Designing a DSL
Index 
1100834885
Domain-Specific Development with Visual Studio DSL Tools

Domain-Specific Languages (DSLs)--languages geared to specific vertical or horizontal areas of interest--are generating growing excitement from software engineers and architects. DSLs bring new agility to the creation and evolution of software, allowing selected design aspects to be expressed in terms much closer to the system requirements than standard program code, significantly reducing development costs in large-scale projects and product lines. In this breakthrough book, four leading experts reveal exactly how DSLs work, and how you can make the most of them in your environment.

With Domain-Specific Development with Visual Studio DSL Tools, you'll begin by mastering DSL concepts and techniques that apply to all platforms. Next, you'll 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 DSL Tools integrate into Visual Studio--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

List of Figures
List of Tables

Foreword

Preface

About the Authors
Chapter 1 Domain-Specific Development
Chapter 2 Creating and Using DSLs
Chapter 3 Domain Model Definition
Chapter 4 Presentation
Chapter 5 Creation, Deletion, and Update Behavior
Chapter 6 Serialization
Chapter 7 Constraints and Validation
Chapter 8 Generating Artifacts
Chapter 9 Deploying a DSL
Chapter 10 Advanced DSL Customization
Chapter 11 Designing a DSL
Index 
43.49 In Stock
Domain-Specific Development with Visual Studio DSL Tools

Domain-Specific Development with Visual Studio DSL Tools

Domain-Specific Development with Visual Studio DSL Tools

Domain-Specific Development with Visual Studio DSL Tools

eBook

$43.49  $57.99 Save 25% Current price is $43.49, Original price is $57.99. You Save 25%.

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Domain-Specific Languages (DSLs)--languages geared to specific vertical or horizontal areas of interest--are generating growing excitement from software engineers and architects. DSLs bring new agility to the creation and evolution of software, allowing selected design aspects to be expressed in terms much closer to the system requirements than standard program code, significantly reducing development costs in large-scale projects and product lines. In this breakthrough book, four leading experts reveal exactly how DSLs work, and how you can make the most of them in your environment.

With Domain-Specific Development with Visual Studio DSL Tools, you'll begin by mastering DSL concepts and techniques that apply to all platforms. Next, you'll 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 DSL Tools integrate into Visual Studio--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

List of Figures
List of Tables

Foreword

Preface

About the Authors
Chapter 1 Domain-Specific Development
Chapter 2 Creating and Using DSLs
Chapter 3 Domain Model Definition
Chapter 4 Presentation
Chapter 5 Creation, Deletion, and Update Behavior
Chapter 6 Serialization
Chapter 7 Constraints and Validation
Chapter 8 Generating Artifacts
Chapter 9 Deploying a DSL
Chapter 10 Advanced DSL Customization
Chapter 11 Designing a DSL
Index 

Product Details

ISBN-13: 9780132701556
Publisher: Pearson Education
Publication date: 05/24/2007
Series: Microsoft Windows Development Series
Sold by: Barnes & Noble
Format: eBook
Pages: 576
File size: 13 MB
Note: This product may take a few minutes to download.
Age Range: 18 Years

About the Author

Steve Cook joined Microsoft in 2003 to work on the DSL Tools. Previously, he was a Distinguished Engineer at IBM, which he represented in the UML 2.0 specification process at the OMG. He has worked in the IT industry for 30 years, as architect, programmer, author, consultant, and teacher. He was one of the first people to introduce object-oriented programming into the UK, and has concentrated on languages, methods, and tools for modeling since the early 1990s.

Gareth Jones is a lead developer in the DSL Tools team. He's been at Microsoft since 1997 doing various developer jobs such as building bespoke enterprise solutions, running the development of Microsoft UK's small business portal, and managing a consultancy team. Before joining Microsoft, he spent seven years leading development projects in the intelligence analysis, simulation, and aerospace industries.

Stuart Kent joined Microsoft in 2003 to work on the DSL Tools. Previously, he was an academic and consultant, with a reputation in modeling and model-driven development. He has over 50 publications to his name and made significant contributions to the UML 2.0 and MOF 2.0 specifications. He is a member of the editorial board of the journal Software and Systems Modeling, and on the steering committee for the MoDELS series of conferences. He has a Ph.D. in computing from Imperial College, London.

Alan Cameron Wills was a methodology consultant for almost a decade, and used to get very frustrated when people asked about good tools to support the methods. So he was very pleased to join Microsoft in 2003 to help in the DSL Tools project. He has a Ph.D. in computer science, and was joint creator of the Catalysis approach to component-based development. He gets excited about software factories, photography, sailing, and hills.

Read an Excerpt

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 Scope

This 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 Tools

If 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 Book

Chapter 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, Presentation, deals with defining the visual appearance of your language.

Chapter 5, Creation, Deletion, and Update Behavior, covers these important aspects of the behavior of your language.

Chapter 6, Serialization, deals with how models and diagrams in your language are represented in files.

Chapter 7, Constraints and Validation, shows you how to ensure that the users of your language create valid statements.

Chapter 8, Generating Artifacts, shows you how to use your language to drive or configure your system by creating configuration files, program code, resources, and other artifacts.

Chapter 9, Deploying a DSL, explains how to create an installer that will install your finished language on multiple computers.

Chapter 10, Advanced DSL Customization, shows you how to make specialized features of your language (or specialized behavior in the editor) in addition to those provided by the standard definition facilities.

Chapter 11, Designing a DSL, provides a lightweight kit of principles and procedures for developing and evolving languages within the context of your project.

Updates and all of the main examples are available for download at the website www.domainspecificdevelopment.com. What You Need to Use This Book

To get the full value of this book, you need to be reasonably familiar with the facilities that Visual Studio offers to developers of program code, including the code editor and

DSL Tools can be downloaded as part of the Visual Studio SDK and used with Visual Studio Professional Edition and later. Tools created using the DSL Tools can be deployed on Visual Studio Standard Edition and later. The website http://msdn.microsoft.com/vstudio/DSLTools/ is the entry point to information about the DSL Tools. There you can find links to where the SDK can be downloaded, a popular online forum with active discussions about the DSL Tools, weblogs containing discussions about the DSL Tools by the authors of this book and others, a tool for reporting bugs and making suggestions, white papers, chats, and other resources.

Table of Contents


List of Figures     xvii
List of Tables     xxv
Foreword     xxvii
Preface     xxix
About the Authors     xxxv
Domain-Specific Development     1
Introduction     1
Domain-Specific Development     2
Examples     4
Software Defined Circuitry     8
Embedded Systems     9
Device Interfaces     9
Software Development Process Customization     9
Benefits     10
Languages     11
Textual DSLs     15
Graphical DSLs     20
Conventions for Representing Structure     21
Conventions for Representing Behavior     22
Aspects of Graphical DSLs     23
Notation     24
Domain Model     24
Generation     24
Serialization     25
Tool Integration     26
Putting It All Together     26
DSLs in Visual Studio     27
The Customization Pit     32
UML     34
Summary     40
Creating and Using DSLs     41
Introduction     41
Process:Incremental Development of DSLs     41
Generalizing an Application: Identify Variability, Discover DSLs     42
Top-Down and Bottom-Up     46
Developing the DSL: From Sketches to Domain Model     48
Domain Model and Presentation Are Separate     49
Refining the DSL     50
Driving the Framework from the DSL     51
Using the DSL     53
Evolving the DSLs     55
Interpretive Architectures     56
Creating a DSL in Visual Studio     57
Creating a DSL Authoring Solution in Visual Studio     57
Trying Out the DSL Solution     61
Defining the DSL     64
Generating the Code for the Designer     66
Adding to the DSL     67
Constraints     68
Customizing the Explorer Window     71
Customizing the Properties Window     72
Custom Code for the Designers     73
Serialization Format of the DSL File     73
Driving Applications from the DSL     74
Deployment     76
A Second DSL: The Project Definition DSL     77
Architecture of the DSL Tools     78
The Generated Code     78
DSL Tools Architectural Layers     79
The Framework Assemblies     79
Content of the DSL Project     81
Content of the DslPackage Project     83
Summary     85
Domain Model Definition     87
Introduction     87
The Domain Model Designer     88
The In-Memory Store     89
Domain Classes     92
Domain Relationships     98
Embeddings     101
Multiplicity     104
References     105
Relationship Derivation     106
Generating a Designer with No Shapes     108
The Generated Code     109
Using the Generated Code     113
More about Domain Classes     115
DomainClassInfo     118
More about Domain Properties     119
Calculated Properties     121
DomainPropertyInfo     121
More on Domain Relationships and Roles     122
Accessing Links     124
More on Relationship Derivation     126
DomainRelationshipInfo and DomainRoleInfo     129
More about the Store     129
Looking Up Elements     129
Partitions      130
Rules     130
DomainModelInfo     130
Summary     131
Presentation     133
Introduction     133
Graphical Notation-Overview     134
Diagram and Editor     137
Diagram     138
Editor     141
Designer     142
Custom Editor     142
Shapes     146
Kinds of Shapes     147
Shape Maps     154
Connectors     164
Connector Anatomy and Appearance     164
Connectors and Inheritance     165
Connector Maps     165
Advanced Connector Maps     167
Decorators     167
Kinds of Decorators     168
Positioning     169
Decorator Maps     170
Customizing the Graphical Notation in Code     173
Multiline Text Decorators     173
Variable Image Shape     174
Set a Background Picture     176
Set Custom Connection Points     177
Change Routing Style of Connectors     178
Explorer     180
Default Appearance     181
Changing the Window Icon and Label      183
Customizing the Appearance of Nodes     184
Hiding Nodes     186
Customizing the Explorer through Code     187
Properties Window     188
Default Appearance of Properties Window     188
Categories, Names, and Descriptions     190
Hiding Properties and Making Them Read-Only     192
Forwarding Properties     192
Customizing the Properties Window through Code     193
Summary     195
Creation, Deletion, and Update Behavior     197
Introduction     197
Element Creation     197
The Toolbox     198
Element Merge Directives     200
Custom Element Merge Directives     208
Re-Parenting with Element Merge Directives     211
Custom Element Tool Prototypes     212
Connection Builders     216
Multiple Source and Target Role Directives     217
Multiple Link Connect Directives     219
Custom Connection Builders     222
Element Deletion     229
Default Delete Propagation Rules     229
Controlling Delete Propagation     231
Customizing Delete Propagation     232
Summary      234
Serialization     237
Introduction     237
Saving and Loading Models and Diagrams     238
Model XML File Format     239
Elements and Properties     242
Relationships     243
Relationship Derivation     245
Cross-Referencing     245
Using Guids as References     246
Using Qualified Names as References     248
References to Links     249
Diagram XML File Format     251
Versioning and Migration     254
The XML Schema     257
Customization     258
Modifying XML Element Names     259
Element Data     261
Implementing Your Own Serializer     264
Generated Serialization Code     264
Customized Serialization Code     271
Impact of Customization on the Schema     272
Summary     273
Constraints and Validation     275
Introduction     275
Choosing Hard or Soft Constraints?     277
Choices Made by the DSL Tools     280
Soft Constraints in the DSL Tools     280
Validation Methods     282
Enabling Validation      284
Invoking Validation     288
Custom Validation Categories     289
Inheriting Validation Behavior     292
Validation Output     292
Using Validation Outside the IDE     293
Validation Against External Data     294
Hard Constraints in the DSL Tools     295
Rules     296
Putting Together Hard and Soft Constraints     299
Summary     307
Generating Artifacts     309
Introduction     309
Artifact Generation Styles     311
Extensible Stylesheet Language Transformations     311
Making Use of the Domain-Specific API     314
A Template-Based Approach     319
Complex Relationships and Round-Tripping     321
The Templatization Process     325
The First Cut Template     328
Generation-Specific Model Data     338
Starting to Build a Library     340
Syntax of a Text Template     341
Directives     341
Custom Directives     344
Control Block Types     346
Problems of Large-Scale, Real-World Artifact Generation     349
Advanced Customizations      351
Text Templating Architecture     352
Custom Hosting     354
Custom Directive Processor     357
Custom Orchestration     359
Summary     366
Deploying a DSL     369
Introduction     369
Files Needed to Install a Designer     370
Getting Started-Creating a Setup Project     373
Setup Project Contents     376
Customizing Setup     377
Customizing InstallerDefinition.dslsetup     377
Customizing settings.ini     377
Customizing Strings.wxl     378
Customizing Product.ico     378
The .dslsetup Format     378
[left angle bracket]dslPackage[right angle bracket]     380
[left angle bracket]licenseAgreement[right angle bracket]     382
[left angle bracket]supportingFiles[right angle bracket]     382
[left angle bracket]vsItemTemplates[right angle bracket]     383
[left angle bracket]dslSchemas[right angle bracket]     384
[left angle bracket]vsProjectTemplates[right angle bracket]     384
[left angle bracket]mergeModules[right angle bracket]     384
[left angle bracket]textTemplates[right angle bracket]     385
Refreshing the Installation Files     387
Package Load Key     388
Deploying Text Templates for Code Generation     390
Creating a Project Template from the Debugging Project     390
Using a Text Template Include File     392
Including Text Templates in the VS Item Template     393
Summary     396
Advanced DSL Customization     397
Introduction     397
Tools for Customization     397
Partial Classes     397
Double Derived-The Generation Gap     398
Custom Constructors     399
Customization Switches     399
Custom Overrides     401
Responding to Changes     402
Property Handlers "On Value Changed/Changing"     402
Calculated Domain Properties     404
Custom Storage Domain Properties     405
Notify Value Change     407
Propagating Change from Model to Shape: OnAssociatedPropertyChanged     408
Rules     412
Store Events     417
.NET Event Handlers     419
Event Overrides     420
Bounds Rules     420
Summary of Change Propagation and Constraint Techniques     424
DSL Shell Architecture     426
How to Add a Menu Command     429
Add a Command Id for Each Command     430
Increment Menu Resource Index     430
Add Commands to Command Set     431
Define the Command Handlers     432
Good Practices for Command Handlers     434
Build and Run     435
Providing Handlers for Standard Commands     435
Building the DSL Diagram into Another Interface     435
Implementing Copy and Paste     437
The Copy Method     437
The Paste Method     438
Registering the Menu Handlers     440
Shape Containers     442
Child Shapes     442
A DSL Using Nested Child Shapes     443
Shape Containment Using Rules     446
Summary     453
Designing a DSL     455
Introduction     455
Identifying Variability     456
Bottom-Up or Top-Down?     457
Feature Trees     458
Feature Trees and DSLs     459
Developing the Domain Model     460
Sketch Domain Snapshots     460
Domain Model from Snapshots     464
Developing the Notation      468
Project Definition Notation     470
Issue State Notation     471
Familiar Notations     474
Defining Validation Constraints     475
Internal Consistency     476
Consistency with External Data and Models     478
Developing and Evolving the Framework     479
Generation versus Interpretation     479
Evolving a Generic Framework     481
Driving a Framework from the DSL     483
Testing     484
Validation Constraints     486
Generator Templates     488
Generated Code     488
Rules     489
Language Definition     489
Evolving a DSL     489
What Makes a Good DSL?     491
Appropriate Notation: An Example with Regular Expressions     493
Candidate Notations     495
Graphs Are Not Syntax Trees     498
Summary     498
Conclusion     499
Index     503
From the B&N Reads Blog

Customer Reviews