Review of the second edition of Implementing Domain-Specific Languages with Xtext and Xtend

I am a proud owner of the first version of this book and I intended to buy a copy of the second edition at some point. So when I was contacted by the publisher to write a review of the second edition I was very happy to accept the offer. Thank you to the author, Lorenzo Bettini, for listing me as a possible reviewer of his work!

What I was happy to find in the book

In a few words: precise answers to advanced questions. A new chapters named Advanced topics is what I wanted to see, sure, but I am also very happy to have clear explanations on using the index or how to check for duplicate across files. The specific chapters on testing and continuos integration are also great to have in this book, in my opinion.

I think this book is enough to go from knowing nothing about Xtext to build reasonably complex projects.

The best way to use this book

I think that the best way to use this book for a newbie is to complement it with other books about language design or specifically on DSLs. You may want to check the list I wrote here.

For the most advanced users you will have unfortunately to learn much more about EMF. You may have to read on of the most boring books ever written: The Eclipse Modeling Framework. The thing is that you can start and write a few Xtext projects without understanding much about EClasses and EResources but eventually you will find some problem for which you will need to learn about the foundations on which Xtext is built, and that means learning EMF.

The things I did not like

The things I do not like have nothing to do with the book per se, which is very well written, clear and amazingly helpful for the poor soul fighting with Xtext. There are things I do not like because I do not like them in Xtext.

One of these things is Xtend: I do not like to have to deal with yet another “improved Java”. Of all of them I would just pick Kotlin and use it all over the places. I understand that Xtend was a good idea when it was started but now Kotlin seems a better idea. I am perfectly aware that this is just my personal taste and nothing objective or decisive. It is just that Kotlin seems to me a better language and a language with more support. The chapter on Xtend has just the fault of reminding me the existence of Xtend. On a more objective note you will need to at least understand Xtend if not being enthusiastic about its existence, so it makes sense for that chapter to be part of the book.

What I would like to see… in the next edition

For newbies I would love to see a couple of extra chapters on language design. For me and for many others Xtext was the “gateway drug” to Language Engineering. By adding some guidance for the young language engineers out there this book could be a rich and complete introduction to Language Engineering. It could give them all they need to be introduced to DSLs and building something real. Without those chapters they have all the technology stuff they need to get started but they are missing a few pieces like “when should I build a DSL”, “what I should use a DSL for”, “what kind of execution models can I consider”, etc.

People who instead have experience with Xtext could like to hear a lot more about the new targets: IntelliJ IDEA and the web. I am sure the Xtext contributors have done an incredible job making almost transparent to target Eclipse, IntelliJ or the web but I have the suspicion that there are the occassional differences here and there. I would be happy to read more lessons learned on using these new targets of Xtext.

I own the first version, should I buy the second one?

This is a very difficult question to answer. It would probably require an in-deep comparison of the two books, so I will give a very approximate answer instead: if you are a professional using Xtext as part of your job you should definitely buy the second edition. Xtext evolved significantly and getting the updated examples is worthy spending a few tens of euros/dollars. Also, if you are like me you would have worn off your first copy so it makes sense to upgrade 🙂

If you are a casual user of Xtext instead, well, you can try not being stingy and buy the second edition anyway. After all it will save you from the occasional headache of trying to make an example work with an API that is slightly changed in the meantime.

The second edition contains circa 70 pages more and a couple of extra chapters: Advanced topics and Conclusions.

Conclusions

When I started using Xtext I hit a wall: there was very poor documentation and an unfriendly community. My questions on forums went unanswered, my bug reports ignored and I was left puzzled. I had to learn the hard way and I could not see any alternative to do. Over time some more tutorials come up, for example from Lars Vogel, there was a huge work on improving the documentation (my eternal gratitude to the people who spent their energy on that!). There was still a missing piece and it was the first edition of this book. I think it is making a difference to have it and the second edition is very welcome. I hope the Language Engineering community will follow the example of Lorenzo and provide more books like this one.

Download the guide with 68 resources on Creating Programming Languages

68resources

Receive the guide to your inbox to read it on all your devices when you have time

Powered by ConvertKit
1 reply

Trackbacks & Pingbacks

  1. […] This year the second editor of the book on Xtext from Lorenzo Bettini came out: you can read my review. […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply