Chapter 1. What are domain-specific languages?

In this chapter

  • Understanding domain-specific languages
  • Distinguishing between domain-specific language types
  • Why write a domain-specific language?
  • Why use Boo?
  • Examining domain-specific language examples

In the beginning, there was the bit. And the bit shifted left, and the bit shifted right, and there was the byte. The byte grew into a word, and then into a double word. And the developer saw the work, and it was good. And the evening and the morning were the first day. And on the next day, the developer came back to the work and spent the whole day trying to figure out what he had been thinking the day before.

If this story rings any bells, you’re familiar with one of the most fundamental problems in computer science. The computer does what it is told, not what the programmer meant to tell it. Often enough, what the programmer tells it to do is in direct contradiction to what the programmer meant it to do. And that’s a problem. I’ve experienced this myself many times, and I’m not particularly incompetent. How, then, did I reach that point?

1.1. Striving for simplicity

Take a look at this piece of code:

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