July 2013
Intermediate to advanced
370 pages
8h 27m
English
Context is one of the characteristics of a DSL. As humans, we rely heavily on context when we communicate. We’re efficient, and context provides for continuity in our conversations. The other day I heard my friend Neal holler, “Venti latte with two extra shots!” He was using the Starbucks DSL. Nowhere did he mention the word “coffee,” but he sure got one, at a high price. That’s context-driven.
Let’s look at Java code to order pizza. This code lacks context. The reference
joesPizza is used repeatedly:
| CreatingDSLs/OrderPizza.java | |
| | //Java code |
| | package com.agiledeveloper; |
| | |
| | public class OrderPizza { |
| | public static void main(String[] args) { |
| | PizzaShop joesPizza = new PizzaShop(); |
| | joesPizza.setSize(Size.LARGE); ... |
Read now
Unlock full access