Thinking in wpf ivan towlson mindscape. model is everything.
Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools?...
-
Upload
alexander-chambers -
Category
Documents
-
view
222 -
download
1
Transcript of Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools?...
![Page 1: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/1.jpg)
BUILD YOUR OWN DESIGNERAN INTRODUCTION TO VISUAL STUDIO DSL TOOLS
Ivan TowlsonMindscape
![Page 2: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/2.jpg)
Agenda What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL
Vocabulary and grammar Spiffing it up
Using the DSL Distributing your DSL
![Page 3: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/3.jpg)
Domain-Specific Languages A vocabulary and grammar tailored to a
particular field of use SQL – a DSL for manipulating relational data Regex notation – a DSL for text matching Mathematica – a DSL for symbolic mathematics BPMN – a DSL for business processes LINQ designer – a DSL for mapping SQL tables Windows Forms designer?! VS class diagrams?
UML!
![Page 4: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/4.jpg)
Classifying DSLs Internal or external – a vocabulary
within the host language (e.g. fluent APIs) or a separate language
Textual or graphical Vertical or horizontal – a specific
business (e.g. a DSL for rail networks) or a technical area (e.g. SQL, regex)
![Page 5: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/5.jpg)
“I was researching implementation techniques for graphical DSLs in vertical domains”
![Page 6: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/6.jpg)
When Would You Create One? You are addressing a well-defined problem area The problem area supports a more concise
expression than “longhand” programming You need the flexibility to express a range of
problems, situations or solutions within that area
The people you expect to use your language have the analytical and technical skills to express their problems in a way a dumb computer can handle
![Page 7: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/7.jpg)
Visual Studio DSL Tools A kit for hosting graphical DSLs within
Visual Studio
![Page 8: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/8.jpg)
Consequences Users must have a Visual Studio licence Users must not freak out when they see
the Visual Studio UI Models must be hosted within Visual
Studio projects Therefore typically not aimed at end
users
![Page 9: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/9.jpg)
Example: LightSpeed Domain modelling tool / object-
relational mapper User base: .NET developers
Core concepts: entities with attributes and associations between them
Convention over configuration Entity classes typically follow standard
formula Predictable mapping between objects and
tables
![Page 10: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/10.jpg)
public class Contribution : Entity<int>{ private string _title;
public string Title { get { return _title; } set { Set(ref _title, value, "Title"); } }}
![Page 11: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/11.jpg)
public class Contribution : Entity<int>{ private string _title;
public string Title { get { return _title; } set { Set(ref _title, value, "Title"); } }}
![Page 12: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/12.jpg)
Enough talk! Show me code!
![Page 13: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/13.jpg)
Using the Model At compile time – code generation At runtime – as just another object
![Page 14: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/14.jpg)
Custom Tool .tt Files
Regenerated on save- Must be fast!- Largely transparent
Regenerated on request- User may forget (well, I often do)
All output in one file- Must all be in same language
One output file per .tt file- Mixed output possible- Nicer structure for e.g. diffs
Invisible to user- Avoids clutter in user project
.tt files in user project- Selective generation- User can tweak or create own
Tool must be registered- You might even have to write it
Already handled by VS
Code Generation Options
![Page 15: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/15.jpg)
Distribution DSL and Package DLLs .vstemplate .xsd Optional custom tool No redistributables required for VS2008
Must install free redistributables for VS2005 DSL Tools includes rudimentary MSI
generator
![Page 16: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/16.jpg)
Distribution Package load key
Free from VSIP program Attributes must match DLL – new version,
new PLK! “The most common cause of package load failures.”
Branding: register under InstalledPackages key
The curse of devenv /setup
![Page 17: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/17.jpg)
Visual Studio Extensibility homepage:http://msdn.microsoft.com/en-us/vsx/
default.aspx
![Page 18: Ivan Towlson Mindscape. What are DSLs and why should I care? What are the Visual Studio DSL Tools? Building a DSL Vocabulary and grammar Spiffing.](https://reader035.fdocuments.net/reader035/viewer/2022062320/56649cff5503460f949d068f/html5/thumbnails/18.jpg)
Thanks! Cook, Jones, Kent & Wills, “Domain
Specific Development with Visual Studio DSL Tools”
Same authors’ blogs on blogs.msdn.com
VSX developer centre on MSDN Clarius T4 Editor
[email protected] http://hestia.typepad.com/flatla
nder
[email protected]://www.mindscape.co.nz