DSL* Tools in Visual Studio Stuart Kent Senior Program Manager Visual Studio Team System – DSL Tools http://blogs.msdn.com/stuart_kent http://lab.msdn.microsoft.com/vs2005/teamsystem/workshop/dsltools/ * DSL = Domain Specific Language.

Download Report

Transcript DSL* Tools in Visual Studio Stuart Kent Senior Program Manager Visual Studio Team System – DSL Tools http://blogs.msdn.com/stuart_kent http://lab.msdn.microsoft.com/vs2005/teamsystem/workshop/dsltools/ * DSL = Domain Specific Language.

DSL* Tools in Visual Studio
Stuart Kent
Senior Program Manager
Visual Studio Team System – DSL Tools
http://blogs.msdn.com/stuart_kent
http://lab.msdn.microsoft.com/vs2005/teamsystem/workshop/dsltools/
* DSL = Domain Specific Language
What is a domain?
Business
Systems
Real-Time
Systems
Requirements
Specification
Aircraft
control
systems
Airline
Baggage
Handling
Systems
Insurance
Management
Systems
Implementation
Deployment
What is a language?
C(x)
h2 2C(x)
ih
= –
t
2m  x2
a>b && c==d
jo
biscuits 24
pat cakes
32
Declarative
green
pink
<CallRecord>
<caller><number>07713248</number>
Textual
Employee
name
address
promote
0..*
Job
description
pay
assign
Pictorial
Call
Record
base rate: £/s

class Magnox : NuclearPowerStation
{
public void dropRods ()
call length
call
Procedural
store
Domain Specific Languages (DSLs) make
problems “Small Scale”
Small scale =
Not much design beyond existing platform

easy to understand
agile
small team
early prototypes
easy maintenance
changes inexpensive
Finding prime numbers is Small
Scale …
If we have a system that can:
do multiplication and division
do things repeatedly
_*_
_/_
_%_
while (…) {…}
language:
platform:
Von Neumann computer
with conventional CPU
C, Pascal, Fortran,…
Finding parts lists is Small Scale …
If we have a system that can:
keep large lists of parts & scan them quickly
combine and filter the lists efficiently
JOIN …
… WHERE …
platform:
Relational Database
CREATE …
SELECT …
language:
SQL
Developing a GUI is Small Scale …
If we have a system that can:
display combinations of windows and widgets
show things and interact with user in them
platform:
Interactive app
platform
language:
Visual programming
languages
Phone billing systems are Small
Scale …
if we have a language of phone billing
Call
Record
base rate: £/s
Telephone Billing Scheme


call length
store
call
friend discount rate: £/s

other calls
calendar
month

-
friends calls
call length
store
bill
billing period
Phone Billing Engine
and a platform to run it on
Using a domain specific language
7
prospect
initiated
prospective sale prospect
cancels
1 week delay
overflow
accumulator
4
Sat
weeklyempty
£30
£20
£
31
salesperson’s
account
monthlypay
bank a/c
animator
prototype
generator
phone bill
system
tweak
hack
for review
Other things you can do…
7
prospect
initiated
prospective sale prospect
cancels
1 week delay
overflow
accumulator
Sat
generator
list of parts
generator
business plan
4
weeklyempty
£30
£20
£
31
salesperson’s
account
monthlypay
bank a/c
animator
prototype
for review
C#, Java
C#
C#
generator
phone bill
system
XML
XML
SQL
mixed code
and config
files
Other inputs to generation
functional
model
7
prospect
initiated
prospective sale
prospect
1 week delaycancels
overflow
accumulator
4
Sat
empty
weekly
£30
£20
£
salesperson’s
account
monthly
pay
31
bank a/c
refine
animator
functional model
refined/augmented
for performance
data
model
generator
existing
api model
tweak
etc
hack
prototype
for review
phone bill
system
“Mind The Gap” –
DSLs & Code Generation
Model
Model
Model
Model
Generated
Code
Generated Code
Application
Code
Application
Generated
Generated
Code
Code
Framework
Domain
Specific
Framework
Pattern
Framework
Language
Platform
Platform
Platform
Frameworks
Platform
Platform
Platform
Frameworks
(a)
(c)
Model
Model
Model
Model
Generated
Application
Code
Code
Generated
Code
Platform
Platform
Platform
Frameworks
(b)
Generated
Application
Code
Code
Generated
Code
Platform
Platform
Platform
Frameworks
(d)
What are (could) DSLs (be) used for?
To write models that drive code generators
Configuring code frameworks, configuring deployment
DSL unifies points of variability scattered amongst artefacts
Delivers software product lines
To write interpreted configuration files
Often expressed in XML
To provide a domain-specific abstractions for the purposes of…
Simulation/animation
Monitoring system execution
What-if analysis
Metric taking
Generating business plans and reports
…
As part of a software factory
Combines all of the above
How are DSLs implemented now?
XML
Syntax very raw, no graphics
Validation weak
Multiple cross-referencing docs are difficult to manage
N.B. Required for large models in a team environment
UML profiles (UML + stereotypes / tagged values)
XML persistence ugly & hard to handle
Stereotypes / tagged values not very powerful
UML profiles can bear little semantic resemblance to
mainstream UML
Game of square peg in round hole
Packaging in UML is not so conducive to working with large
models in a team environment
How are DSLs implemented now?
MOF/EMF
Deals with conceptual aspects of language
Rest of designer/editor is hand-coded
In meta-environments
Releases a meta-monster that can be hard to tame
Often doesn’t scale to large models in a team
environment
Tools not integrated into familiar IDEs
DSL Tools in Visual Studio – V1
To make it cost-effective to develop DSLspecific, visual designers hosted in Visual Studio
For SI’s & large enterprises (at least)
For a particular class of DSLs
In a way that makes the model data easily
accessible by automation tools, that are easy to
author using XML and/or .Net technology
In a way that enables working with large models in a
team environment
To make it cost-effective to author DSL-driven
code/artefact generators
Mainline scenario
Wizard
Creates and configures
VS “MDF Designer”
solution from (a)
template(s)
Define DSL
Object model editor
Structure
Serialization
Constraints
Add code
Body of constraints
Diagram layout
Other enrichments
Notation editor
Notation
Explorer
Properties grid
Validation behaviour
Build
installer for
deployment
F5
Generate
Build
Launch VS Exp on debugging
solution
Debug
Demo
We’ll build a designer from scratch
Here’s a screenshot of the target
designer…
DSL Tools in Visual Studio
Stuart Kent
Senior Program Manager
Visual Studio Team System – DSL Tools
http://blogs.msdn.com/stuart_kent
http://lab.msdn.microsoft.com/vs2005/teamsystem/workshop/dsltools/