December 19, 2014dsl ruby thoughts
Why do we use domain specific languages? My first reaction to them when I started programming in the real world was to scorn them with the attitude that they introduce unnecessary complication for both the developer and the computer. What good could they possibly do?
Like any programmer thrown into a stack, I faithfully used the established patterns, knowing that any divergence from the standard usually has a much worse effect than dealing with it.
Over time, I grew to like DSLs. Why? Why would a rational developer like myself grow to like something so senseless? As Sandy Metz said once in a talk she gave at Pivotal Labs, trust your gut. Much of your high level thought as a developer, you may not be able to verbalize immediately.
So I trusted myself, and continued using DSLs. Until one day it came to me while I was pairing. The value of a DSL is that it forces the human brain to switch contexts. This makes it much easier to move throughout the code without mashing up context from one problem with another, it’s like namespacing for the brain.