Skip to content

Posts by Peter Friese

27
Oct

Xtext Tricks #1: Enhancing Completion Proposals

Those of you who follow me on Twitter might have noticed I am working on an Xtext based DSL for Behaviour Driven Development. Part of the DSL allows the DSL user to define actors and the verbs these actors can execute. Actors can have a hierarchy (much like a class hierarchy), meaning an actor will inherit all verbs of it's super actors. As the list of verbs can grow quite a bit, the content assist drop down menu becomes a bit overwhelming.

XtextProposalProviderBefore

To alleviate  this situation, I decided to display the "owner" of a verb along with the name of the verb in the content assist drop down box. Here is my first try:
Read moreRead more

13
Oct

Everything You Always Wanted To Know About Modeling (But Were Afraid To Ask)

  1. Does Model Driven Software Development actually work?
  2. Are some developers more productive than others?
  3. What happens during code generation?
  4. Do diagrams and text go together well?
  5. What happens during model transformation?
  6. What are DSLs? And can I create them with Eclipse?
  7. Does modeling scale in the enterprise?

You guessed it, these are not the questions from a well-know Woody Allen movie, but questions that will be answered at the Eclipse Modeling Days which will be held in New York and Toronto in November.
Read moreRead more

11
Sep

Fun with Regular Expressions: ANT-style variable replacing in strings

I recently felt the need to write a piece of code that resolves ANT-style variables in a string. Suppose you have a property file similar to this one:

propertyA=SomeValue
propertyB=${propertyA}.SomeOtherValue
listofThings=${propertyA}, ${propertyB}, constantValue

Let's further assume you want to read property listofThings, and resolve the variables. Isn't that a perfect job for regular expressions?
Read moreRead more

4
Sep

Xtext @ Google

Last week I had the chance to speak at the EclipseDay at the GooglePlex in Mountain View, CA, an event organized by the Eclipse Foundation and hosted by Google's Open Source Programs Office. Google is a truly amazing company and the GooglePlex is a very exciting place to be at. As I was one day early and needed a creative place to put finishing touches on my slides, I took the chance to visit Robert Konigsberg who was kind enough to host me for that day. The organizers put together a great agenda with lots of interesting talks. Looking at the agenda, you will see that there actually are three major topics, Eclipse in the Enterprise, Modeling and Runtime: The talks

all dealt with how Eclipse can be used in the Enterprise or which challenges you will face if you start using Eclipse in large-scale scenarios.
Read moreRead more

9
Aug

Eclipse Modeling Day in North America

We (i.e. the Eclipse Foundation, itemis and Cloudsmith) are looking into arranging one more Eclipse Modeling Day in North America this fall and would like to gather feedback from folks interested in attending. Please use this poll to help us tailor a location and program to suit your particular interests:

http://spreadsheets.google.com/viewform?hl=en&formkey=dF ZQcGh3RDhrUUdyNTAtMXlVU2pKQ1E6MA..
Read moreRead more

11
Jul

Getting started with Xtext, part 2

Last week, I showed you how easy it is to create a DSL with Xtext. In this installment, we will have a look at how to leverage the models created with the DSL.

Goal

Let's imagine we want to create an application for orders. People can sign in to the system, place orders for various items, check out and have them sent to their address. Very simple, but we can show a lot of things here.

As we expect to be writing more than one application of this type and as we also would like to be able to express the structure of the application on a business level (one of the major drivers for DSLs and MDSD for that matter), we come up with the idea of using a DSL to describe what the application does. Defining the DSL is what we did last week. This week, we need to map the concepts of the DSL to some code and some APIs we're going to program against.
Read moreRead more

30
Jun

Getting Started with Xtext

Xtext has been released as a part of the Eclipse Galileo release train on June 24th, 2009. Xtext is a framework for building DLSs (domain specific languages). In fact, it can be seen as a DSL for defining DSLs.

In this article, we will develop a small DSL for defining entities.

Download and Install

Hop over to http://xtext.itemis.com and download an Xtext distribution matching your platform. We've got all major platforms: Windows, Mac OSX Carbon, Mac OSX Cocoa 64, Mac OSX Cocoa 32, Linux Gtk 64, Linux Gtk 32.

To install, unzip the distribution file to a directory of your liking.

Windows users, please make sure you unzip to a directory near to your filesystem root! Eclipse contains files and folders with long names that might be hard to handle for Windows.
Read moreRead more

25
Jun

Xtext does London

Marking the end of this years series of DemoCamps, Neil Bartlett and SkillsMatter are organizing the final DemoCamp in London on Monday 29th, 2009. Yes, that's next monday!

Neil was kind enough to invite someone from the "modeling/oAW folk", so Heiko Behrens will be giving an Xtext demo.

If you haven't had the chance to attend Code Generation 2009 or if you're curious what all this DSL talk is all about, I urge you to sign up for the DemoCamp now - it is free of charge.

I was fortunate enough to hear Heiko speak at the DemoCamp in Hamburg. Not only is Heiko a very good speaker (with a very convincing, deep voice), but also did he manage to come up with some very good examples of what a DSL is and why you should consider using them in your projects.

By the way, if you want to play around with Xtext before the DemoCamp, you can get a fresh copy from our download site at http://xtext.itemis.com.

12
Jun

Noisy DSLs

I recently came across some DSLs which had some defects. Let's look at a sample I quickly hacked together with Xtext:

Resource - Demo/demo.mydsl - Eclipse SDK

Here are two recommendations I'd like to give when designing a textual DSL:

  1. Don't use uppercase letters in the keywords of your DSL, unless you either really like them. In the sample DSL, the keywords (Element, EndElement, Child, Endchild all start with an uppercase letter, which makes it cumbersome to edit the DSL script (you need to press the shift key a lot). Back in the days when we didn't have syntax highlighting, UPPERCASE keywords made a lot of sense as they helped to draw a better distinction between the keywords, the variables and the constants (strings and numbers) of a program. Nowadays, it is hard to find an IDE which does not offer syntax highlighting, so this argument does not hold any more.
  2. Do not use noisy begin...end syntax constructions. They do not increase readability of your DSL script and they add to the amount of code to be typed.

Here is an improved version of the DSL script:

Resource - Demo/demo.mydsl1 - Eclipse SDK

By removing the Endelement and Endchild keywords, we have improved readability a lot. Using lowercase keywords has lowered the effort you need to invest to key in the DSL script. And - honestly - don't we all like to be lazy at times? After all, one of the goals of DSLs is to make your work easier and more efficient.

That being said, have a great weekend!

By the way, if you need help designing a DSL with Xtext - I and the entire Xtext team are happy to assist you. Just drop me a line (peter at itemis dot com) or hop on to our professional support site

8
Jun

Following Eclipse Milestones

With the Galileo Release coming up, you might find yourself having a hard time updating to the latest milestones AND keeping your favorite plug-ins up-to-date.

Did you know that you can migrate your additional plug-ins from one Eclipse install to another one? This can be a huge time-saver, especially for people who like to live on the bleeding edge.

Here's how:

  1. Install a fresh copy of Eclipse. Let's assume you install Eclipse 3.5 RC4 Cocoa 64bit (you're feeling lucky)
  2. Let's further assume you've got an existing install of Eclipse 3.5 RC3 Cocoa 32bit with some additional plug-ins, like FindBugs, WindowBuilder Pro, etc.
  3. After installing, start your newly installed instance of Eclipse
  4. Select Help -> Install New Software...
  5. In the Install dialog, click the Add... button to add a new update site:
    Eclipse Install Dialog

  6. In the next dialog, click on Local... to add a local update site:
    Eclipse: Add Site

  7. using the file chooser, browse to <path_to_your_OLD_eclipse_instance>/eclipse/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile/ and click Choose to select that directory.
  8. Click OK to add the update site:
    Eclipse: Add Local Update Site

  9. The Install dialog will now list all plug-ins installed in the old location (i.e. your old Eclipse instance), clearly highlighting the ones that are not already installed in the new instance:
    Eclipse: Install from existing Eclipse install

  10. Check all features that you want to transport to the new location and continue the installation by clicking Next>.
  11. After confirming the license terms and clicking Finish, Eclipse will install the selected features from the old location into the new location. After the obligatory workbench restart you're good to go.

The only thing that I am wondering about is: why is there no first-class UI action (e.g. an import wizard) to do this?