There are a number of things
going on in software development that's exciting me. I couldn?t say
that a year ago, but this time, its different.
This morning, I am
getting excited about DSL (probably because I was chatting about that before
I went to bed).
I think Domain Specific
Languages are going to play a major role in how we develop in the future.
I plan to spend more time on this topic later. But for now, my excitement is from
seeing the
Groovy example I will talk about here.
You sure have written
code to generate XML. You know how tedious and boring that is. If you have
used DOM
be given to
Now, take a look
at this Groovy code:
map = ['C++'
: 'Stroustrup', 'Java' : 'Gosling', 'C#' : 'Hejlsberg']
bldr = new groovy.xml.MarkupBuilder()
bldr.languages {
for(entry in map)
{
language {
name (entry.key)
author (entry.value)
}
}
}
<languages>
<language>
<name>C#</name>
<author>Hejlsberg</author>
</language>
<language>
<name>Java</name>
<author>Gosling</author>
</language>
<language>
<name>C++</name>
<author>Stroustrup</author>
</language>
</languages>
map = ['C++'
: 'Stroustrup', 'Java' : 'Gosling', 'C#' : 'Hejlsberg']
bldr = new groovy.xml.MarkupBuilder()
bldr.languages {
for(entry in map)
{
lang (name:entry.key) {
author (entry.value)
}
}
}
I get:
<languages>
<lang name='C#'>
<author>Hejlsberg</author>
</lang>
<lang name='Java'>
<author>Gosling</author>
</lang>
<lang name='C++'>
<author>Stroustrup</author>
</lang>
</languages>
Now, isn?t that cool. Groovy MarkupBuilders show me the light of DSLs.
Imagine writing code that speaks your domain. It is soon becoming a reality.
There are so many exciting tools for this.
Exploring DSL further is one of my tasks for December. I am planning on a new talk related to this.
More about this later.>