Upload
job-webster
View
233
Download
0
Tags:
Embed Size (px)
Citation preview
Domain-Specific Development
Stuart Kent, Senior Program Manager,DSL Tools, Visual Studio Team System, Microsoft
Domain-Specific Development Pattern
Model
FixedPart
Abstraction of the variable part, expressed in a Domain-Specific Language
Framework, API, Interpreter …
Hand-crafted
Generate, interpret, some of each
Integrate
Contents
Domain-Specific Development Pattern• Demo 1 – Wizard UIP example• DSD in Software Factories
• Domain-Specific Languages (DSLs)• Integration: Generation versus Interpretation from/of models• Costs & benefits of the DSD approach
• DSL Tools in Visual Studio• Demo 2 – Building and deploying a DSL
• Release schedule• Difference between Feb CTP and V1• Follow-up session
Demo 1 – Wizard User Interaction Process
Model
FixedPart
Integrate
Expressed in Graphical Page Flow DSL
UIP frameworkWindows Forms
Additional control logic code added
Generate:• Some control logic code• Starter UI• Config file that’s interpreted
<CallRecord>
<caller><number>07713248</number>
call
CallRecord
call length
base rate: £/s
store
ArchitectureFramework,Components
Process and roles
Tools
PatternsDSD Is Part of Software Factories
Libraries
Domain-Specific languages
Test suites
Models
Method & procedures
TemplatizingTemplatizing …… …… ……
TemplatizingTemplatizing …… …… ……
Guidelines
Reminder – DSD Pattern
Model
FixedPart
Abstraction of the variable part, expressed in a Domain-Specific Language
Framework, API, Interpreter …
Hand-crafted
Generate, interpret, some of each
Integrate
Domain-Specific Language Classification
Horizontal GUI web business logic database deployment
Vertical telephone bills insurance ticketing hardware construction
Domain-Specific Language
generalpurpose
specific
next slide …
Parts of a DSL
Domain Model+ validation
Reminder – DSD Pattern
Model
FixedPart
Abstraction of the variable part, expressed in a Domain-Specific Language
Framework, API, Interpreter …
Hand-crafted
Generate, interpret, some of each
Integrate
What does ‘Integrate’ Mean?
• Generate• Generate code that talks to framework APIs
• E.g. completely new classes
• Generate code that completes a framework• E.g. C# partial classes
• Interpret• The model file itself or some data pushed into a live
environment from the model (e.g. xml configuration file, data in a database) is interpreted
• A Combination of the above
• Easier to produce initially• More customisation options
• Behaviour can be changed at run-time• Fewer artifacts to keep in sync
Customisation (1)
What?
• Customise/extend the behaviour expressed by the model + fixed part
Why?
• However good the fixed part, not every point of variability will have been predicted
• Some things (e.g. complex logic) are just easier to express in code – avoids reinventing programming languages in a DSL
• There will be undiscovered bugs in the code generators / interpreter / framework which need to be fixed somehow
DSL Area
customisation
Customisation (2)
DSL Area
Customisationstep
Expertcustomisation
step
Platformcustomisation
Hand crafted code for specific plug-points
Change the code generators
Change the framework
customisation
Customisation (2)
DSL Area
Customisationstep
Expertcustomisation
step
Platformcustomisation
Hand crafted code for specific plug-points
Change the code generators
Change the framework
Interpretation
Generation
Domain-Specific Development – Cost / Benefit
Benefits• Fewer copies of the same code to
maintain
• Fix bug in code generators or framework fixes for all
• Change in requirements (e.g. business rules) = change in model
• Change in technology = change in code generators / framework
• Better communication with stakeholders
Cost• Creating/maintaining the DSL / code
generators / framework potentially across many projects and versions
Model
FixedPart
Integrate
Goal of Microsoft DSL Tools is to bring down this cost
DSL Tools in Visual Studio
What?
• Tools for authoring and deploying DSLs and template-based text artefact (e.g. code) generators
Where?
• Now installed as part of the Visual Studio SDKhttp://msdn.microsoft.com/vstudio/extend/
• Also seehttp://msdn.microsoft.com/vstudio/DSLTools/
Reminder – Parts of a DSL
Domain Model+ validation
DSL Tools V1
Designer for a DSL in Visual Studio
Domain Model Framework
DesignSurface
Framework ShellFramework
TemplatingEngine
ValidationF’work
DSL Tools – Modeling Platform
In-memory graph In-memory graph database with rich database with rich
services (e.g., services (e.g., transactions, transactions,
serialisation, rules …) serialisation, rules …) Extensible Extensible drawing surface drawing surface with support for with support for
routing and routing and auto-layout auto-layout
Artefact Artefact generatigenerati
on on
Checks constraints Checks constraints and guides user to and guides user to
resolve issuesresolve issues
Visual Studio Visual Studio UI integration UI integration
for for components components like toolbox, like toolbox,
menus, menus, properties properties
grid, explorergrid, explorer
DSL Tools – Architecture of a Designer
Domain Model Framework
DesignSurface
Framework
generateddomain classes
generatedshapes
ShellFramework
generatedserialisers
TemplatingEngine
generateddirectiveprocessor
generatedshell code
generatedshape 2 class mappingstext
templates
DSL Definition
generate
hand-crafteddesigner extensions
ValidationF’work
hand-coded
validationlogic
A DSL for Activities
Apply forpre-approved
Loan
Setup on-lineaccount
for customer
Create creditcheck report
AcceptedAcceptedRejectedRejected
Defining a DSL, Step 1: Define Domain Model
Apply forpre-approved
Loan
Setup on-lineaccount
for customer
Create creditcheck report
Defining a DSL, Step 2: Define Notation
Apply forpre-approved
loan
Rounded RectangleRounded Rectangle Outline color: orangeOutline color: orange
Fill color: whiteFill color: white Text DecoratorText Decorator Position: CentrePosition: Centre
AcceptedAcceptedConnectorConnector solidsolid orangeorange filled arrowheadfilled arrowheadText DecoratorText Decorator
Position: Source, bottomPosition: Source, bottom
Apply forpre-approved
loan
Defining a DSL, Step 3
Define visualisation of domain model via notation elements
ShapeShape Domain ModelDomain Model
Demo 2 – Building & Deploying a DSL
Customize & Extend Designer
CreateAuthoringSolution
Customize DSL
GenerateInstaller
AddCode
GenerateCode
F5
Exercise tools
Create project
templates
Deploy !
Work withdesigner
Createtext
templates
Contents
Domain-Specific Development Pattern Demo 1 – Wizard UIP example DSD in Software Factories
Domain-Specific Languages (DSLs) Integration: Generation versus Interpretation from/of models Costs & benefits of the DSD approach
DSL Tools in Visual Studio Demo 2 – Building and deploying a DSL
• Release schedule• Difference between Feb CTP and V1• Follow-up session
Release Schedule
• February 2006, part of VS SDK
• May 2006, V1 Release Candidate(as part of VS SDK CTP released in that month)
• August 2006, V1 RTM(as part of VS SDK V3 released in that month)
Differences between Feb CTP and V1
• Cleaner APIs
• A single DSL definition format• combines domain model and notation aspects
• more flexible mapping between notation and domain model
• A DSL Designer (edits the DSL definition format)
• Serialisation• Domain-Specific serialisation format in XML
• forgiving, version aware reader
• Extra notation – ports & swimlanes
• Customisation• more explicit customisation points called out
• generated code is easier to override
Replace <object type=“MyX”> … </object>with <MyX> … </MyX>
Follow-up Session
Domain-Specific Languages Futures
• Led by Gareth Jones, Developer, DSL Tools
• At 12.00, after break, in Denbigh 1 (Workshop 2)
• Come and discuss the features you’d like to see in future versions of DSL Tools
• Please bring signed Design Preview Agreement form(blank forms are available if you haven’t got one)