DSLs in Boo
Domain Specific Languages in .NET
Oren Eini writing as Ayende Rahien
  • January 2010
  • ISBN 9781933988603
  • 352 pages
  • printed in black & white

A great gateway into Boo and Domain-Specific Languages.

Justin Chase, Microsoft

A general-purpose language like C# is designed to handle all programming tasks. By contrast, the structure and syntax of a Domain-Specific Language are designed to match a particular application's area. A DSL is designed for readability and easy programming of repeating problems. Using the innovative Boo language, it's a breeze to create a DSL for your application domain that works on .NET and does not sacrifice performance.

DSLs in Boo shows you how to design, extend, and evolve DSLs for .NET by focusing on approaches and patterns. You learn to define an app in terms that match the domain, and to use Boo to build DSLs that generate efficient executables. And you won't deal with the awkward XML-laden syntax many DSLs require. The book concentrates on writing internal (textual) DSLs that allow easy extensibility of the application and framework. And if you don't know Boo, don't worry—you'll learn right here all the techniques you need.

Table of Contents show full



about this book

about the author

about the cover illustration

1. What are domain-specific languages?

1.1. Striving for simplicity

1.2. Understanding domain-specific languages

1.3. Distinguishing between DSL types

1.4. Why write DSLs?

1.5. Boo’s DSL capabilities

1.6. Examining DSL examples

1.7. Summary

2. An overview of the Boo language

2.1. Why use Boo?

2.2. Exploring compiler extensibility

2.3. Basic Boo syntax

2.4. Boo’s built-in language-oriented features

2.5. Summary

3. The drive toward DSLs

3.1. Choosing the DSL type to build

3.2. Building different types of DSLs

3.3. Fleshing out the syntax

3.4. Choosing between imperative and declarative DSLs

3.5. Taking a DSL apart—what makes it tick?

3.6. Combining domain-driven design and DSLs

3.7. Implementing the Scheduling DSL

3.8. Running the Scheduling DSL

3.9. Summary

4. Building DSLs

4.1. Designing a system with DSLs

4.2. Creating the Message-Routing DSL

4.3. Creating the Authorization DSL

4.4. The "dark side" of using a DSL

4.5. The Quote-Generation DSL

4.6. Summary

5. Integrating DSLs into your applications

5.1. Exploring DSL integration

5.2. Naming conventions

5.3. Ordering the execution of scripts

5.4. Managing reuse and dependencies

5.5. Performance considerations when using a DSL

5.6. Segregating the DSL from the application

5.7. Handling DSL errors

5.8. Administrating DSL integration

5.9. Summary

6. Advanced complier extensibility approaches

6.1. The compiler pipeline

6.2. Meta-methods

6.3. Quasi-quotation

6.4. AST macros

6.5. AST attributes

6.6. Compiler steps

6.7. Summary

7. DSL infrastructure with Rhino DSL

7.1. Understanding a DSL infrastructure

7.2. The structure of Rhino DSL

7.3. Codifying DSL idioms

7.4. Batch compilation and compilation caches

7.5. Supplying external dependencies to our DSL

7.6. Summary

8. Testing DSLs

8.1. Building testable DSLs

8.2. Creating tests for a DSL

8.3. Testing the DSL scripts

8.4. Integrating with a testing framework

8.5. Taking testing further

8.6. Summary

9. Versioning DSLs

9.1. Starting from a stable origin

9.2. Planning a DSL versioning story

9.3. Building a regression test suite

9.4. Choosing a versioning strategy

9.5. Applying versioning strategies

9.6. DSL versioning in the real world

9.7. When to version

9.8. Summary

10. Creating a professional UI for a DSL

10.1. Creating an IDE for a DSL

10.2. Integrating an IDE with a DSL application

10.3. Creating a graphical representation for a textual DSL

10.4. DSL code generation

10.5. Handling errors and warnings

10.6. Summary

11. DSLs and documentation

11.1. Types of documentation

11.2. Writing the Getting Started Guide

11.3. Writing the User Guide

11.4. Creating the Developer Guide

11.5. Creating executable documentation

11.6. Summary

12. DSL implementation challenges

12.1. Scaling DSL usage

12.2. Deployment—strategies for editing DSL scripts in production

12.3. Ensuring system transparency

12.4. Changing runtime behavior based on AST information

12.5. Data mining your scripts

12.6. Creating DSLs that span multiple files

12.7. Creating DSLs that span multiple languages

12.8. Creating user-extensible languages

12.9. Summary

13. A real-world DSL implementation

13.1. Exploring the scenario

13.2. Designing the order-processing system

13.3. Thinking in tongues

13.4. Moving from an acceptable to an excellent language

13.5. Implementing the language

13.6. Using the language

13.7. Looking beyond the code

13.8. Going beyond the limits of the language

13.9. Summary

Appendix A: Boo basic reference

Appendix B: Boo language syntax


What's inside

  • Introduction to DSLs, including common patterns
  • A fast-paced Boo tutorial
  • Dozens of practical examples and tips
  • An entertaining, easy-to-follow style

About the author

A leader in the .NET community, Ayende Rahien, whose real name is Oren Eini, contributes to numerous open-source projects including NHibernate, Castle, and Rhino Mocks. He blogs and speaks on architecture, data access, testing, and other topics.

eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Useful, readable, and empowering-really captures the Boo spirit.

Avishay Lavie, Contributor to "The Boo Programming Language"

Goes Way beyond Boo particulars into universally applicable guidance.

Mark Seemann, Safewhere

...will erase any doubts you may have about writing your own DSL.

Garabde "Garo" Yeriazarian, Kajer Hughes, Inc.