Sunday, July 03, 2005

Language Workbench Sample Ported to Java

As I've blogged about recently, I'm updating my Building Domain Languages atop Java conference talk to incorporate information from Martin Fowler's article Language Workbenches: The Killer-App for Domain Specific Languages?. I wanted to show his example domain language sample in my talk but my talk is Java and his sample is in C#. So, as a public service to Java developers everywhere, I ported his sample to Java 5. This is mostly a straight port with a few differences:
  • I used generics in a few places to clean up type casting
  • The reflection stuff is different because that's where .NET and Java differ the most
  • I cheated and created simple classes with public fields rather than properties for the target classes to make the reflection code easier
It is a complete version of the sample (including all the supporting files to make it run + IntelliJ project file). Martin graciously gave me permission to post it on my website and in my blog. Language oriented programming looks to me like the next big revolution in programming paradigms, and I'm spending a lot of time playing with this right now.


gutzoft said...

Hey thats funny that you changed the properties to fields and made them public. When I created the c# example from Fowler's papers he didn't show any reflection. I had to add it my self and I changed properties to fields and made them public. Very Cool!

Madhu said...

The link is not accessible. Can you please check that.

Thanks in advance.

Neal Ford said...

Hi, Madhu -

Sorry, but this link has expired -- most of the information is very outdated now (this blog entry was after all from 2005!

If you are still interested in this subject, check out Martin Fowler's website ( and check out his DSL Work in Progress.