This Monday the Eclipse DemoCamp took place in London at Skills Matter. You will find a comprehensive review at InfoQ by Alex Blewitt where you can read about NatTable (Dan Pollitt) and JQantLib/OSGi (Richard Gomes) as well as Xtext. And thanks to Eren Aykin you will find a video podcast of the latter, too!
This time I tried to spread the idea of DSLs with chess and different ways of expressing moves within the game. In the first part of my presentation I processed cryptic notations like “Rd2-c2″ or more natural equivalents such as “rook at d2 moves to c2″ to work with them as true Java objects and eventually visualized chess fields. Second, I tried to emphasize the value of DSLs in today’s software projects where we implemented another DSL live at the DemoCamp in the end. You will find my slides at SlideShare again.
It was quite informative to chat with the Eclipse folks in London afterwards. Most of them have a pragmatic view at modeling and tools in general. I really appreciate this! Thank you, Neil, for organizing this event and inviting via twitter.
Links
Source Code
Loading chess DSL text files as Java objects:
package org.xtext.example.chess;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.xtext.example.ChessStandaloneSetup;
public class JavaTest {
public static void main(String[] args) {
String filename = "some/path/MyModel.chess";
Game g = getGame(filename);
System.out.println(g.getWhitePlayer() + " vs. " + g.getBlackPlayer());
for (Move m : g.getMoves())
System.out.println(m.getSource() + " to " + m.getDest());
}
private static Game getGame(String filename) {
ChessStandaloneSetup.doSetup();
ResourceSet rs = new XtextResourceSet();
Resource res = rs.getResource(URI.createFileURI(filename), true);
return (Game) res.getContents().get(0);
}
}
is a programmer, author, and 





Thanks for the presentation! The use case (chess moves) was great, and actually, for the first time some of the text modelling made sense. Most other use cases (employees/locations/addresses etc.) really suggest leaning towards a database rather than a text-oriented format anyway, but the chess moves worked really well. I especially liked the generation of the chess boards afterwards; you should make that demo available on the Xtext site.
Cool that your presentation is also available as video. I also like the Chess example. Rd2-c2 without a given context first is a brilliant example to motivate textual DSLs! And as always you are a great presenter.
Thank you for your feedback, guys. I am planning to publish the chess example with a more sophisticated editor in the future, Alex.
[...] and frameworks and demonstrate its capabilities with a refined version of an example I presented in London last week. After that we discuss the versatile possibilities for extending and customizing the framework and [...]
Hi Heiko,
first of all, thanks again! As many others, I also think, that you have a gift with presenting the things, you know
Sorry for asking again, but do you know when you will be able to publish the Xtext code for the (meanwhile so famous:)) chess example?
Best
Özgün
Thank you for this complement, Özgün. As you might have seen by the stagnation of new blog posts I haven’t found much the time to write about new stuff recently. There are two more post in the pipeline (one about iPhone programming, one about Xtext in practice). After that, I will write about an extended version of this chess example accompanied by a screencast.
Please apologize the delay.
Hello !
first of all , thanks for your presentation, I like it !!
actually , i’m trying to use xtext in my project , so i need to see some examples first to get ready !
So , can you make the chess example available for us?
thank you for answering
Best regards
Thank you Adnane, I am planning to publish it before the EclipseCon since Bernhard Merkle will use it to compare different frameworks (including Xtext) against each other and I’d like to promote his talk
ok , I see
can’t waiting for that XD
thank you Mr.Heiko