1 / 18

Build Your Own Designer An Introduction to Visual Studio DSL Tools

Ivan Towlson Mindscape. Build Your Own Designer An Introduction to Visual Studio DSL Tools. 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.

rane
Download Presentation

Build Your Own Designer An Introduction to Visual Studio DSL Tools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ivan Towlson Mindscape Build Your Own DesignerAn Introduction to Visual Studio DSL Tools

  2. 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

  3. 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!

  4. 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)

  5. “I was researching implementation techniques for graphical DSLs in vertical domains”

  6. 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

  7. Visual Studio DSL Tools • A kit for hosting graphical DSLs within Visual Studio

  8. 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

  9. 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

  10. public class Contribution : Entity<int> { private string _title; public string Title { get { return _title; } set { Set(ref _title, value, "Title"); } } }

  11. public class Contribution: Entity<int> { private string _title; public string Title { get { return _title; } set { Set(ref _title, value, "Title"); } } }

  12. Enough talk! Show me code!

  13. Using the Model • At compile time – code generation • At runtime – as just another object

  14. Code Generation Options

  15. 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

  16. 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

  17. Visual Studio Extensibility homepage: http://msdn.microsoft.com/en-us/vsx/default.aspx

  18. 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 ivan@mindscape.co.nz http://www.mindscape.co.nz ivan@hestia.cc http://hestia.typepad.com/flatlander

More Related