<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Peter Friese</title>
	
	<link>http://www.peterfriese.de</link>
	<description>Xtext, DSLs, MDSD, Eclipse</description>
	<lastBuildDate>Mon, 08 Mar 2010 19:46:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/FormFollowsFunction" /><feedburner:info uri="formfollowsfunction" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Running AppleScript from Java</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/Eh3s0AGgAqw/</link>
		<comments>http://www.peterfriese.de/running-applescript-from-java/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:42:38 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[AppleScript]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=387</guid>
		<description><![CDATA[In my current project, I need to launch an external application and maybe execute some additional commands on this external application. Due to the very nature of the project, the whole system will always be run on Mac OS X. So I thought, "why not use AppleScript"?
Turns out using AppleScript to launch applications is fairly ]]></description>
			<content:encoded><![CDATA[<p>In my current project, I need to launch an external application and maybe execute some additional commands on this external application. Due to the very nature of the project, the whole system will always be run on Mac OS X. So I thought, "why not use AppleScript"?</p>
<p>Turns out using AppleScript to launch applications is fairly easy, all you have to do is </p>
<pre>tell application "name of your app" to launch</pre>
<p>If you want to try this from the command line, <em>osascript</em> comes in handy:</p>
<pre>osascript -e 'tell app "iTunes" to launch'</pre>
<p>So far so good. Should be easy to do this from Java, shouldn't it? Turns out it's not so easy at all. Let's try this:</p>
<pre>
  String launchCmd = "osascript -e 'tell application \"iTunes\" to play'";
  process = Runtime.getRuntime().exec(launchCmd);

  BufferedReader bufferedReader = new BufferedReader(
    new InputStreamReader(process.getErrorStream()));
  while ((lsString = bufferedReader.readLine()) != null) {
    System.out.println(lsString);
  }
</pre>
<p>I'm not sure why, but it results in a nasty "<em>0:1: syntax error: A unknown token can't go here. (-2740)</em>" error message.</p>
<p>But there is another signature for Runtime.exec:</p>
<pre>
  String[] cmd = { "osascript", "-e",	"tell app \"iPhone Simulator\" to launch" };
  process = Runtime.getRuntime().exec(cmd);

  BufferedReader bufferedReader = new BufferedReader(
    new InputStreamReader(process.getErrorStream()));
  while ((lsString = bufferedReader.readLine()) != null) {
    System.out.println(lsString);
  }
</pre>
<p>... and this works out just fine!
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=Eh3s0AGgAqw:_G1dWXcCBuY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=Eh3s0AGgAqw:_G1dWXcCBuY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=Eh3s0AGgAqw:_G1dWXcCBuY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=Eh3s0AGgAqw:_G1dWXcCBuY:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/Eh3s0AGgAqw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/running-applescript-from-java/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/running-applescript-from-java/</feedburner:origLink></item>
		<item>
		<title>140 x 365 = 2659</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/ynY0GFtJjnw/</link>
		<comments>http://www.peterfriese.de/140-x-365-2659/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 20:56:11 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=382</guid>
		<description><![CDATA[It's exactly one year since I posted my first tweet on Twitter - time for a review.
Before I give some reasons why I use Twitter, let's have a look at some stats.
I sent out roughly 2660 tweets, on average 8.4 per day:

Looking at my tweet density, I hardly seem to be getting any sleep, which ]]></description>
			<content:encoded><![CDATA[<p>It's exactly one year since I posted <a href="http://twitter.com/peterfriese/status/1164566213">my first tweet</a> on Twitter - time for a review.</p>
<p>Before I give some reasons why I use Twitter, let's have a look at some stats.</p>
<p>I sent out roughly 2660 tweets, on average 8.4 per day:</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/81029262@N00/4316305253" title="View 'TweetStats :: for peterfriese' on Flickr.com"><img border="0" width="602" alt="TweetStats :: for peterfriese" src="http://farm3.static.flickr.com/2703/4316305253_ec08e825af_o.jpg" height="289"/></a></div>
<p>Looking at my tweet density, I hardly seem to be getting any sleep, which is not entirely true <img src='http://www.peterfriese.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/81029262@N00/4316315167" title="View 'TweetStats :: for peterfriese' on Flickr.com"><img border="0" width="594" alt="TweetStats :: for peterfriese" src="http://farm5.static.flickr.com/4012/4316315167_c157b5410f_o.jpg" height="284"/></a></div>
<p>Over the last year, I tried quite a few twitter clients, but I like Tweetie the most (yes, I'm using a Mac):</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/81029262@N00/4317057428" title="View 'TweetStats :: for peterfriese' on Flickr.com"><img border="0" width="352" alt="TweetStats :: for peterfriese" src="http://farm3.static.flickr.com/2684/4317057428_3b5487fdab_o.jpg" height="224"/></a></div>
<h3>Why I use Twitter</h3>
<ul>
<li>Twitter helps me to keep informed about topics I am interested in, while at the same time giving me the chance to get in touch with the sources of that information and give feedback.</li>
<li>Many vendors and dev teams have Twitter accounts and use them to twitter about what they're currently doing / developing, again helping me to keep up-to-date about current developments</li>
<li>Twitter helps me to "hear" what others are saying about the tools I and my teammates develop. Twitter clients like TweetDeck and Nambu allow you to define custom searches. E.g., I've got a search defined for "Xtext OR DSLs" so I will be informed each time someone tweets about either Xtext or DSLs. This allows me to give instant feedback to users needing help or ranting about <a href="http://twitter.com/xtext">Xtext</a> (actually, most users praise Xtext, so I'm mostly using this search to retweet that praise)</li>
<li>Twitter is like a big room in which everybody can hear what you're saying. You can use this fact to use Twitter as a marketing channel, and that's what we do with <a href="http://www.xtext.org">Xtext</a>, too. We get the word out on Xtext, e.g. by announcing cool new features or talks we're giving at upcoming conferences.</li>
<li>I also use Twitter to get / keep in touch with co-workers, friend and also clients. More often than not when meeting new clients, I hear people say "nice to meet you in person after we have been talking on Twitter". Sometimes, I use Twitter instead of my phone to ping people ("give me a call when you are available") - works great!</li>
<li>By using Twitter, you will actually feel much closer to your peers ("<a href="http://www.urbandictionary.com/define.php?term=tweep">tweeps</a>") than you did before. This holds true especially for the Eclipse crowd. Many of us follow each other on Twitter and thus know what we do in our day to day job (and in our spare time, too) better than before.</li>
</ul>
<h3>Some recommendations</h3>
<p>Whether you're new to Twitter or have been using it for years, here is my list of recommendations for Twitter. May it be inspirational for you:</p>
<ul>
<li>Find a decent client. The web interface is O.K., but in order to use all the power of Twitter, you need to use a real client. My main work horse is <a href="http://www.atebits.com/tweetie-mac/">Tweetie</a> (on the Mac), mostly because it allows me to view conversations in a really neat manner. <a href="http://www.tweetdeck.com/iphone/">On the iPhone I recommend TweetDeck</a> - you can easily define additional columns to display custom searches, DMs, tweets nearby and so on. <a href="http://www.nambu.com/">Nambu</a> also is very nice - and native! <a href="http://www.tweetdeck.com/">TweetDeck on the Mac</a> is also great, but eats a lot of resources, which is why I rarely use it any more. If you want to issue tweets without losing context, give <a href="http://code.google.com/p/qsb-mac/">Google Quick Search Bar</a> a try - <a href="http://code.google.com/p/qsb-mac/wiki/GettingStarted#How_do_I_tweet_with_Twitter">there's a plug-in that allows you</a> to tweet from QSB.</li>
<li>Do NOT protect your updates. After all, you want to get in touch with other people. So there really is no point in protecting your updates.</li>
<li>If you're new to Twitter, make sure to post some tweets before starting to follow other people. You want to make sure other people are following you too, but why should they follow you if you've got nothing to say?</li>
<li>We're not interested in disgusting details about you, your family or your friends, <a href="http://theoatmeal.com/comics/facebook_suck">so keep them for you</a>.</li>
<li>I follow people mostly for professional reasons. Tweeting personal stuff is perfectly OK and can add that grain of salt which makes you human, but you should try to keep a balance.</li>
</ul>
<h3>Summing up</h3>
<p>Summing up all things, using Twitter has helped me to get in touch with a huge amount of people I wouldn't have interacted with if I hadn't been using Twitter. </p>
<p>If you read all this, let me lift the secret about the obviously wrong mathematical equation in the title of this post: it's the number of characters you may use for one tweet (140), the number of days since I started using Twitter and the total number of tweets I sent out (2659). Actually, as I am using <a href="http://alexking.org/projects/wordpress">Twitter Tools for Wordpress</a>, this blog post will automatically be announced on Twitter and thus be <a href="http://twitter.com/peterfriese/status/8465879177">tweet number 2660</a>.
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ynY0GFtJjnw:exZLHHTlX4A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ynY0GFtJjnw:exZLHHTlX4A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ynY0GFtJjnw:exZLHHTlX4A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ynY0GFtJjnw:exZLHHTlX4A:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/ynY0GFtJjnw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/140-x-365-2659/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/140-x-365-2659/</feedburner:origLink></item>
		<item>
		<title>Eclipse DemoCamp Hamburg 11/2009</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/pEyKiGYdFmA/</link>
		<comments>http://www.peterfriese.de/eclipse-democamp-hamburg-112009/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 23:15:29 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[democamp]]></category>
		<category><![CDATA[hamburg]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=361</guid>
		<description><![CDATA[The Eclipse DemoCamp in Hamburg was a huge success - more than 110 people signed up and most of them actually showed up at the event:

The program was packed with interesting talks and we were lucky to be able to present some very well known speakers:

Tom Schindl: E4 - A short overview
Jan Köhnlein: Combining graphics ]]></description>
			<content:encoded><![CDATA[<p>The Eclipse <a href="http://wiki.eclipse.org/Eclipse_DemoCamps_November_2009/Hamburg">DemoCamp in Hamburg</a> was a huge success - more than 110 people signed up and most of them actually showed up at the event:</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163775996/in/set-72157622946379026" title="'About 110 Attendees at the DemoCamp' on Flickr.com"><img border="0" width="500" alt="About 110 Attendees at the DemoCamp" src="http://farm3.static.flickr.com/2595/4163775996_5cff50538a.jpg" height="332"/></a></div>
<p>The program was packed with interesting talks and we were lucky to be able to present some very well known speakers:</p>
<ol>
<li>Tom Schindl: E4 - A short overview</li>
<li>Jan Köhnlein: Combining graphics and text in model editors</li>
<li>Jochen Krause: RAP</li>
<li>Nils Hartmann, Gerd Wütherich: Fifty ways to build your bundle...</li>
<li>ekke (Ekkehard Gentz):redView - dynamic views for business applications</li>
</ol>
<p>If you were not lucky enough to attend the DemoCamp, here is a short summary of the sessions:</p>
<h3>e4 - modeling meets runtime (Jochen Krause on behalf of Tom Schindl)</h3>
<p>Tom Schindl couldn't attend the DemoCamp due to heavy snow in Innsbruck (the airport was short of planes to fly out, actually). After a short vcon with Tom, Jochen Krause held the e4 demo on Tom's behalf.</p>
<table align="center" border="0">
<tr>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163772608/in/set-72157622946379026/" title="'A short video conf with Tom Schindl' on Flickr.com"><img border="0" width="240" alt="A short video conf with Tom Schindl" src="http://farm3.static.flickr.com/2593/4163772608_5148246c1e_m.jpg" height="159"/></a></div>
</td>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163011953/sizes/m/in/set-72157622946379026/" title="'Jochen Krause (for Tom Schindl) - e4' on Flickr.com"><img border="0" width="240" alt="Jochen Krause (for Tom Schindl) - e4" src="http://farm3.static.flickr.com/2685/4163011953_9bbbd9ce5d_m.jpg" height="159"/></a></div>
</td>
</tr>
</table>
<p>e4 has three principal aims: </p>
<ol>
<li>simplifying the Eclipse programming model</li>
<li>enabling the platform for use on emerging web-based runtime technologies</li>
<li>and broadening participation in development of the platform</li>
</ol>
<p>One of the measures to make programming Eclipse easier is to define a list of core services and make sure they have a really decent API. This list of services is called "The 20 Things" (see the Eclipse wiki for <a href="http://wiki.eclipse.org/E4/Eclipse_Application_Services">more information</a>).</p>
<p>You might have heard that EMF is playing an important role in e4 and I think it is one of the most amazing things about e4 that the entire workbench is modeled, of course using EMF. Actually, you can change the workbench at runtime by just modifying the underlying model at runtime. I think it is very exciting to see modeling and runtime technologies converge in this project.</p>
<p>e4 also makes massive use of dependency injection, which allows for a flat object model (Instead of providing a subclass for every special feature, you can just inject other classes providing that particular feature). We had a discussion about dependency injection. Jochen showed that several methods in e4 use String-based dependency injection, which of course leads to several problems. Sven pointed out that this is not a DI problem per se and suggested to use interfaces to alleviate the situation. </p>
<p><a href="http://twitter.com/HBehrens">Heiko</a> raised the question of whether we should have a dedicated session on dependency injection at one of the next democamps:</p>
<div style="text-align:center;"><a href="http://twitter.com/HBehrens/status/6344196851" title="View '@HBehrens asks "Do we need a DI session at the next DemoCamp?"' on Twitter"><img border="0" width="515" alt="@HBehrens asks "Do we need a DI session at the next DemoCamp?"" src="http://farm3.static.flickr.com/2559/4165228359_168886eee6_o.jpg" height="81"/></a></div>
<p>Jochen continued his session, explaining how the e4 UI is being rendered by a presentation engine which can be configured using various renderers, each one providing an individual look and feel.</p>
<p>e4 is the future of Eclipse, and Jochen concluded his talk by pointing out that in order to ensure e4 has a sustainable future, companies and individuals should participate in the development of e4. This can be done by:</p>
<ul>
<li>Playing around with e4 and providing feedback</li>
<li>Participating in the development process (see the <a href="http://www.eclipse.org/projects/project_summary.php?projectid=eclipse.e4">e4 project homepage</a> for more info)</li>
<li>Paying existing committers (see <a href="http://tomsondev.bestsolution.at/2009/12/04/e4-some-random-thoughts-2nd-iteration/">Tom's blog posting</a> to learn how to buy one and get one free)</li>
</ul>
<p>More info on e4 can be found <a href="http://wiki.eclipse.org/E4">on the Eclipse wiki</a>.</p>
<p>After the talk, we had a short break to set up the next presenter, enjoy some refreshments and, of course, socialize:</p>
<table align="center" border="0">
<tr>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163774122/in/set-72157622946379026/" title="View 'A short coffee break' on Flickr.com"><img border="0" width="240" alt="A short coffee break" src="http://farm3.static.flickr.com/2677/4163774122_deb8824525_m.jpg" height="159"/></a></div>
</td>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163774270/in/set-72157622946379026/" title="View 'A short coffee break' on Flickr.com"><img border="0" width="240" alt="A short coffee break" src="http://farm3.static.flickr.com/2629/4163774270_994158865a_m.jpg" height="159"/></a></div>
</td>
</tr>
</table>
<h3>Combining graphics and text in model editors (Jan Köhnlein)</h3>
<p>After the break, Jan Köhnlein took stage and told the audience that graphics and text and no different, but really are just two views on the same thing:</p>
<table align="center" border="0">
<tr>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163773536/in/set-72157622946379026/" title="'Jan Köhnlein - Combining graphics and text in model editors' on Flickr.com"><img border="0" width="240" alt="Jan Köhnlein - Combining graphics and text in model editors" src="http://farm3.static.flickr.com/2658/4163773416_d0ed0d2dc2_m.jpg" height="159"/></a></div>
</td>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163773536/in/set-72157622946379026/" title="'Jan Köhnlein - Combining graphics and text in model editors' on Flickr.com"><img border="0" width="240" alt="Jan Köhnlein - Combining graphics and text in model editors" src="http://farm3.static.flickr.com/2577/4163773536_22c3bcdab4_m.jpg" height="159"/></a></div>
</td>
</tr>
</table>
<p>Jan pointed out that both text and graphics have their relative virtues:</p>
<p><strong>Text...</strong></p>
<ul>
<li>provides a detailed view on things</li>
<li>can have a very formal syntax</li>
<li>can be typed using  standard text editors</li>
<li>can be managed using standard versioning mechanisms (merge / diff) </li>
<li>can be typed fast</li>
</ul>
<p><strong>Graphical representations on the other hand...</strong></p>
<ul>
<li>provides high-level views and a good overview</li>
<li>suggests non-formalism</li>
<li>requires custom editors for your graphical notation (i.e., you <em>need</em> to write them)</li>
<li>has no good support for merging / diffing</li>
<li>requires the user to use a mouse a lot, and thus is slower than a text editor</li>
</ul>
<p>Apparently, both have advantages, so why not use both?</p>
<p>In the following 5 minutes, Jan gave an ultra-quick introduction in how Xtext (as a representative of a textual modeling toolkit) and GMF (as a representative for a graphical modeling toolkit) work. The bottom line is both use Ecore metamodels, so we <em>should</em> be able to combine both.</p>
<p>It turns out, however, that Xtext and GMF metamodels are slightly different and you need to take some precautious steps in order to make them interoperable.</p>
<p>After this excursion into the theory behind the convergence of graphical and textual editors, Jan showed two editors, one graphical and one textual that synced live. Changing the model in one editor and saving it effected an immediate update in the other editor - really neat.</p>
<p>Jan pointed out that this is all very fine, but sometimes you really want to have a tight integration. As a proof of concept, he showed a GMF-based editor with an embedded Xtext editor: as soon as he pressed <em>F2</em> to edit a field in the graphical editor, an inline Xtext editor would pop up, featuring syntax highlighting, code completion and error markers - really awesome!</p>
<p>More information on <a href="http://www.xtext.org">Xtext</a> and <a href="http://www.eclipse.org/modeling/gmf/">GMF</a> can be found on their respective homepages. Jan works for <a href="http://www.itemis.com">itemis</a> and provides consulting and training for these technologies.</p>
<p>All these exciting things must have made people gasp for air, because the oxygen level in the room was very low at the end of the session, so we had another break. As always with gathering like this, hallway talks very equally important as the sessions, and people made good use of the break:</p>
<table align="center" border="0">
<tr>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163774372/in/set-72157622946379026/" title="'Another short coffee break' on Flickr.com"><img border="0" width="240" alt="Another short coffee break" src="http://farm5.static.flickr.com/4003/4163774372_191055b0d5.jpg" height="159"/></a></div>
</td>
<td>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163013089/in/set-72157622946379026/" title="View 'A short coffee break' on Flickr.com"><img border="0" width="240" alt="A short coffee break" src="http://farm3.static.flickr.com/2720/4163013089_038142a6ca_m.jpg" height="159"/></a></div>
</td>
</tr>
</table>
<h3>RAP (Jochen Krause)</h3>
<p>Jochen's presented his talk on RAP without a single slide - "in the tradition of the Karlsruhe DemoCamps", as he pointed out.</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163774844/in/set-72157622946379026/" title="'Jochen Krause - RAP' on Flickr.com"><img border="0" width="500" alt="Jochen Krause - RAP" src="http://farm3.static.flickr.com/2714/4163774844_0fa2daf90d.jpg" height="332"/></a></div>
<p>No technical session without some history and some theory, so Jochen first explained that RAP implements the <a href="http://javadesktop.org/articles/canoo/">Half Object Pattern</a> and demoed the very first version of RAP. While running an Eclipse UI in the browser is all very exciting, feedback from initial users wasn't too positive: "please spare us this look'n'feel in the browser!"</p>
<p>So the good people at innoopract (now EclipseSource) spent some time to implement custom styling for RAP UIs, which Jochen showed in his second demo, which he called "The Enterprise Look'n'Feel" due to it's feasibility for enterprise applications.</p>
<p>The third demo featured "rounded corners" (see <a href="http://www.eclipse.org/rap/noteworthy/news_13M1.php">RAP New & Noteworthy</a>). While this might seem like little gained, Jochen explained that implementing rounded corners was both important on an acceptance level and challenging on the implementation level. Would you have thought that rounded corners are implemented using CSS on FireFox and VML on Internet Explorer?</p>
<p>Of course, RAP is implemented as an Open Source project at Eclipse, welcoming any contribution from users worldwide. Jochen demonstrated how great the Open Source model works by showing off a ribbon-style command bar for RAP which is available on Google Code (see the <a href="http://code.google.com/p/rapit/">rapit project home page</a>)</p>
<p>In the next demo, Jochen showed how he integrated EMF and RAP. His goal was to RAPify the EMF tree editor for EMF models. It turned out that basically it is very simple to convert the EMF editor (or any other Eclipse plug-in for that matter) into a RAP application - only very little adjustments were needed. However, as web applications are multi-user applications by definition, additional care has to be taken when converting editors. As Eclipse is a single-user application, editors are not prepared to be executed in a multi-user environment. Jochen explained how he tried to use CDO to store the edited models on a remote server, but failed due to the complexities of CDO. He succeeded by using <a href="http://couchdb.apache.org/">CouchDB</a>, a database written in Erlang and with an HTTP interface (look ma - no JDBC driver needed!).</p>
<p>Jochen concluded his session with a few notes on features they've just completed (Drag'n'Drop) or which are not available (yet) like GC.paint.</p>
<p>After that, he took some of the audience's questions, e.g. "How many users can a RAP server take?". Of course, it depends, but you can roughly count 1MB per user and workbench.</p>
<p>Jochen thought it would be OK to continue without a break, but Martin decided we should rather have a short break to let in some air.</p>
<p>More information on RAP can be found on the <a href="http://wiki.eclipse.org/RAP">Eclipse wiki</a> and on the <a href="http://eclipse.org/rap/">project homepage</a>. Jochen's company <a href="http://eclipsesource.com/">EclipseSource</a> provides professional services, training and resources around RAP, so have a look at their website.</p>
<h3>50 ways to build your bundle (Gerd Wütherich & Nils Hartmann)</h3>
<p>After the "short" break, Gerd Wütherich and Nils Hartmann presented their view on build management: "Fifty Ways to Buid Your Bundle":</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163014129/in/set-72157622946379026/" title="'Gerd Wütherich and Nils Hartmann"><img border="0" width="500" alt="Gerd Wütherich and Nils Hartmann" src="http://farm3.static.flickr.com/2699/4163014129_8b53cf8923.jpg" height="332"/></a></div>
<p>Facing the fact that nobody seems to be too excited about build management these days, they decided to arrest people's attention by adapting the well-known story "<a href="http://en.wikipedia.org/wiki/A_Christmas_Carol">A Christmas Carol</a>" by <a href="http://en.wikipedia.org/wiki/Charles_Dickens">Charles Dickens</a>. A brilliant idea, which really made people laugh at various points throughout the presentation.</p>
<p>The presentation was subdivided in three parts:</p>
<p><strong>The Ghost of Build Past</strong><br />
Gerd and Nils explained how in the past, people have been building bundes using PDE build, using a <em>Manifest-First</em>-approach. Building bundles with PDE build is rather cumbersome: you have to setup map files in order to help PDE build to derive ANT build files which will then be executed by the AntRunner inside Eclipse. While this ensures the build process sees exactly what Eclipse sees when you develop your bundles in the workspace, this basically makes debugging your build process very complicated.</p>
<p><strong>The Ghost of Build Today</strong><br />
Today, we've got bundles everywhere and OSGi is being used not only for Eclipse plug-ins, but also for conventional applications. As good programers obeying the <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a> <a href="http://c2.com/cgi/wiki?DontRepeatYourself">principle</a>, we want to have a redundancy-free description of our build artifacts, i.e. derive build dependencies by looking at <em>MANIFEST.MF</em>. In the enterprise, things can get really nasty, as we often need to integrate various very different build systems: you might have to build an EJB client JAR (maybe using Maven) which then need to be integrated in an Eclipse RCP client application, which again needs to be built using PDE build.</p>
<p>Nils and Gerd showed a slide which listed all major build tools for bundles, among them:</p>
<ul>
<li>Springsource Tool Suite</li>
<li>PDE</li>
<li>Athena</li>
<li>PluginBuilder</li>
<li>Buckminster</li>
<li>Tycho</li>
<li>Maven</li>
<li>b3</li>
<li>Ant4Eclipse</li>
<li>PDE build</li>
<li>bnd</li>
<li>Ivy</li>
<li>Buildr</li>
<li>IDEA</li>
<li>Sigil</li>
<li>buildr4osgi</li>
<li>OsgiPlugin</li>
<li>ANT</li>
<li>Bundlr</li>
</ul>
<p>After which they showed three exemplary setups how to actually build bundles:</p>
<ol>
<li>ANT4Eclipse</li>
<li>Maven Tycho</li>
<li>Buckminster</li>
</ol>
<p>Please refer to their slide deck, slides 14 - 16 for detailed diagrams on these three setups:<br />
<center><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fiftywaystobuildyourbundle-091205030107-phpapp02&rel=0&stripped_title=fifty-ways-to-build-your-bundle" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fiftywaystobuildyourbundle-091205030107-phpapp02&rel=0&stripped_title=fifty-ways-to-build-your-bundle" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></center><br />
<!--<br />
4 exemplary samples:<br />
1) ant4eclipse<br />
- write plain ant file<br />
- there is a task that can access eclipse artifacts such as manifest and plugin.xml<br />
- macros, e.g. buildbundle (does it all)<br />
- planned: support for p2 to provision target platform<br />
2) maven tycho<br />
- works on Eclipse artifacts<br />
- does not use traditional maven project layout<br />
- instead, uses Eclipse layout, looks at plugin.xml and manifest.mf to find your stuff<br />
3) buckminster<br />
- kind of "meta-maven"<br />
- can use various repositories at the same time<br />
- uses cqueries (component queries) to search for components and materialize them on local build workspace<br />
- materialized components will then be converted into required form<br />
- has gui<br />
- also support headless build<br />
--></p>
<p><strong>Ghost of Build Future</strong><br />
As things get more complicated, build management will also most likely become more complicated. Gerd and Nils pointed out that build management might be an unthankful job, but it must not be assigned to "people that aren't good at programming". Instead, they advocated making build management a first class citizen in computer sciences education.</p>
<p>More information on the tools and techniques presented are available at their respective home pages. In addition, you can contact <a href="http://www.nilshartmann.net/">Nils</a> and <a href="http://drupal.wuetherich.com/">Gerd</a> and bug them with your questions. They're consultants, so they can be hired.</p>
<h3>redView - dynamic views for business applications</h3>
<p>The final session was held by Ekkehard Gentz, better known as <em>ekke</em>. He showed a smart combination of Eclipse technologies: Riena, EMF, openArchitectureWare (Xpand, Xtend, MWE) and Xtext. Of course, being an Open Source advocate, Ekke and his team mate Florian provide this stack as an <a href="http://code.google.com/p/redview/">Open Source project on Google Code</a>.</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163014969/in/set-72157622946379026/" title="ekke (Ekkehard Gentz) - redView - dynamic views for business applications"><img border="0" width="500" alt="ekke (Ekkehard Gentz) - redView - dynamic views for business applications" src="http://farm3.static.flickr.com/2681/4163014969_3199649714.jpg" height="332"/></a></div>
<p>redView is <em>a declarative framework based on the Eclipse Modeling Framework (EMF), for creating RCP Views enriched with Riena Ridgets</em>. It uses EMF to describe the application with a model. An Xpand-based code generator will then transform the model into code for the application. Ekke states that their goal is not to limit developers' creativity, but instead relieve them from the burden of having to write all the boilerplate code.</p>
<p>redView supports the most important UI elements, including some Nebula widgets. One thing I fond very impressive was their UI editor. Ekke gave a demo in which he hosted the UI model on a CDO (which seems to be Eclipse's wunderkind) server on a virtual machine. He started a second virtual machine, running an instance of the application. Upon changing the UI model in the UI designer on one machine, the UI was updated immediately on the second machine. Ekke pointed out that this usage pattern is especially useful in prototyping scenarios: the developer changes the model on his PC in his office and the customer can immediately see the changes on his machine, hundreds of kilometers away.</p>
<p>More information on redView can be obtained from their <a href="http://redview.org">project homepage</a>. Ekkehard is a freelance consultant, so <a href="http://www.ekkehard.org/">you can hire him</a> if you've got any questions regarding the technologies presented.</p>
<h3>Gimmicks</h3>
<p>After the demos, we raffled off 20 Eclipse Keybinding Mugs (see <a href="http://relengofthenerds.blogspot.com/2009/11/good-eclipse-swag.html">Kim Moir's blog post</a> for a 360° shot of the mug) - congratulations to all winners! it-agile also provided a fine selection of agile swag: retrospective mugs, team calendars, post-its and what have you:</p>
<div style="text-align:center;"><a href="http://www.flickr.com/photos/nossipova/4163771282/in/set-72157622946379026/" title="Agile swag"><img border="0" width="500" alt="Agile swag" src="http://farm3.static.flickr.com/2709/4163771282_53db8e31f1.jpg" height="332"/></a></div>
<p>Despite the fact Ralph Müller couldn't attend the event, we eventually headed to the EAST bar for some frosty beverages.</p>
<p>All in all, it has been a very enjoyable event and from what I gathered, most attendees seem to have enjoyed the DemoCamp as well.</p>
<p>Thanks everyone for attending! Also, thank you to all speakers. Last but not least a big thank you to <a href="http://twitter.com/nossipova">Natalia</a> for taking pictures of the event!</p>
<p>Hope to see you again at the next DemoCamp in Summer 2010!</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=pEyKiGYdFmA:N_xZ2vwyrvY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=pEyKiGYdFmA:N_xZ2vwyrvY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=pEyKiGYdFmA:N_xZ2vwyrvY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=pEyKiGYdFmA:N_xZ2vwyrvY:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/pEyKiGYdFmA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/eclipse-democamp-hamburg-112009/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/eclipse-democamp-hamburg-112009/</feedburner:origLink></item>
		<item>
		<title>Xtext Tricks #1: Enhancing Completion Proposals</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/xSA8LbAAhL0/</link>
		<comments>http://www.peterfriese.de/xtext-tricks-1-enhancing-completion-proposals/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 14:55:43 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[MDSD]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=337</guid>
		<description><![CDATA[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 ]]></description>
			<content:encoded><![CDATA[<p>Those of you who <a href="htp://twitter.com/peterfriese">follow me on Twitter</a> might have noticed <a href="http://twitter.com/peterfriese/status/4889552469">I am working on an Xtext based DSL</a> for <a href="http://en.wikipedia.org/wiki/Behavior_driven_development">Behaviour Driven Development</a>. 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.</p>
<p><a href="http://www.flickr.com/photos/81029262@N00/4029808851" title="View 'XtextProposalProviderBefore' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2581/4029808851_22fd514946.jpg" alt="XtextProposalProviderBefore" border="0" width="459" height="339" /></div>
<p></a></p>
<p>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:</p>
<pre>
public class StoryDslProposalProvider extends AbstractStoryDslProposalProvider {
  @Override
  protected ICompletionProposal createCompletionProposal(EObject element, String proposal, String displayString, ContentAssistContext contentAssistContext)
  {
    if (element instanceof Verb) {
      Verb verb = (Verb) element;
      Subject owner = ((Subject)verb.eContainer());
      String myDisplayString = verb.getName() + ": " + owner.getName();
      return super.createCompletionProposal(element, proposal, myDisplayString, contentAssistContext);
    }
    return super.createCompletionProposal(element, proposal,  displayString, contentAssistContext);
  }
}
</pre>
<p>With this piece of code in place, the content assist proposals for verbs will now display the name of the "owner" to the right of the replacement text:</p>
<p><a href="http://www.flickr.com/photos/81029262@N00/4030575068" title="View 'XtextContentAssistAfter' on Flickr.com">
<div style="text-align:center;"><img src="http://farm4.static.flickr.com/3526/4030575068_2358208f22.jpg" alt="XtextContentAssistAfter" border="0" width="456" height="329" /></div>
<p></a></p>
<p><a href="http://zarnekow.blogspot.com/">Sebastian</a> pointed out that there is a <code>getDisplayString()</code> in <code>AbstractContentProposalProvider</code> that you should override in order to create a custom display string. It turned out, however, that this method will not be called as expected. I <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293380">filed a bug</a>, so expect to see a fix in one of the next milestones of the Xtext 0.8.0 stream.</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xSA8LbAAhL0:K4i4GOEy0d0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xSA8LbAAhL0:K4i4GOEy0d0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xSA8LbAAhL0:K4i4GOEy0d0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xSA8LbAAhL0:K4i4GOEy0d0:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/xSA8LbAAhL0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/xtext-tricks-1-enhancing-completion-proposals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/xtext-tricks-1-enhancing-completion-proposals/</feedburner:origLink></item>
		<item>
		<title>Everything You Always Wanted To Know About Modeling (But Were Afraid To Ask)</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/nMqN-vUV6wc/</link>
		<comments>http://www.peterfriese.de/everything-you-always-wanted-to-know-about-modeling-but-were-afraid-to-ask/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 20:18:52 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Canada]]></category>
		<category><![CDATA[DSLs]]></category>
		<category><![CDATA[EMF]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[MDSD]]></category>
		<category><![CDATA[USA]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=333</guid>
		<description><![CDATA[
Does Model Driven Software Development actually work?
Are some developers more productive than others?
What happens during code generation?
Do diagrams and text go together well?
What happens during model transformation?
What are DSLs? And can I create them with Eclipse?
Does modeling scale in the enterprise?

You guessed it, these are not the questions from a well-know Woody Allen movie, but ]]></description>
			<content:encoded><![CDATA[<ol>
<li>Does Model Driven Software Development actually work?</li>
<li>Are some developers more productive than others?</li>
<li>What happens during code generation?</li>
<li>Do diagrams and text go together well?</li>
<li>What happens during model transformation?</li>
<li>What are DSLs? And can I create them with Eclipse?</li>
<li>Does modeling scale in the enterprise?</li>
</ol>
<p>You guessed it, these are not the questions from a <a href="http://en.wikipedia.org/wiki/Everything_You_Always_Wanted_to_Know_About_Sex*_(*But_Were_Afraid_to_Ask)">well-know Woody Allen movie</a>, but questions that will be answered at the <a href="http://wiki.eclipse.org/Eclipse_Modeling_Day">Eclipse Modeling Days</a> which will be held in <a href="http://wiki.eclipse.org/Eclipse_Modeling_Day#New_York_City">New York</a> and <a href="http://wiki.eclipse.org/Eclipse_Modeling_Day#Toronto">Toronto</a> in November.</p>
<p>So if you are wondering why everybody in Europe is so thrilled about Modeling, attend to one of these events - you'll get the answers there. </p>
<p>For your convenience, here is a list of some of the talks:</p>
<ul>
<li>Case Study: Model Transformations - Richard Woods, Credit Suisse</li>
<li>Building DSLs with Xtext - Heiko Behrens, itemis</li>
<li>Modeling on an enterprise scale - Eike Stepper, Eclipse Modeling Project</li>
<li>Query, Transaction and Validation - Bernd Kolb & Boris Gruschko, both SAP</li>
<li>Agent-Based Computer Simulation for Operational Risk Analysis - Ed MacKerrow, Los Alamos Labs</li>
<li>Papyrus: Advent of an Open Source IME - Kenn Hussey, Zeligsoft</li>
<li>B3: A Model for Unbreakable Builds</li>
<li>There's a Modeling Solution for That - Bruce Trask, MDE Systems & Angel Roman, MDE Systems</li>
</ul>
<p>If you ask me, this is a pretty decent line-up, both content-wise and people-wise. Not being one of the big conferences, the Modeling Days will actually give you the chance to talk to the experts and other end-users. Remember, networking is key.</p>
<p>So go ahead and register by adding your name to <a href="http://wiki.eclipse.org/Eclipse_Modeling_Day">this wiki page</a>. Registration is free, but you need to register in order to help the organizers to plan the catering. If you don't have an account for editing the wiki page or don't want to create one, just send mail to <a href="mailto:eclipse_modeling_nyc@eclipse.org">eclipse_modeling_nyc@eclipse.org</a> or <a href="mailto:eclipse_modeling_toronto@eclipse.org">eclipse_modeling_toronto@eclipse.org</a></p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=nMqN-vUV6wc:5YfM8MMsVzI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=nMqN-vUV6wc:5YfM8MMsVzI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=nMqN-vUV6wc:5YfM8MMsVzI:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=nMqN-vUV6wc:5YfM8MMsVzI:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/nMqN-vUV6wc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/everything-you-always-wanted-to-know-about-modeling-but-were-afraid-to-ask/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/everything-you-always-wanted-to-know-about-modeling-but-were-afraid-to-ask/</feedburner:origLink></item>
		<item>
		<title>Fun with Regular Expressions: ANT-style variable replacing in strings</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/ubuIoB3EUtQ/</link>
		<comments>http://www.peterfriese.de/fun-with-regular-expressions-ant-style-variable-replacing-in-strings/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 09:19:02 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=319</guid>
		<description><![CDATA[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?
Using Regex Tester, I came up ]]></description>
			<content:encoded><![CDATA[<p>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:</p>
<pre>
propertyA=SomeValue
propertyB=${propertyA}.SomeOtherValue
listofThings=${propertyA}, ${propertyB}, constantValue
</pre>
<p>Let's further assume you want to read property <em>listofThings</em>, and resolve the variables. Isn't that a perfect job for regular expressions?</p>
<p>Using <a href="http://www.myregextester.com/index.php">Regex Tester</a>, I came up with the following regular expression to find occurrence of <code>${<em>variable</em>}</code>:</p>
<pre>
\$\{(.+?)\}
</pre>
<p>Using <code>java.util.regex.Pattern</code> and <code>java.util.regex.Matcher</code> to find all occurrences is rather trivial:</p>
<pre>
Pattern re = Pattern.compile("\\$\\{(.+?)\\}");
Matcher m = re.matcher(sourcestring);
while (m.find()) {
  String variable = m.group(1);
  System.out.println(variable);
}
</pre>
<p>Replacing the variables with their concrete values is not so trivial. You might be tempted to use String.substring():</p>
<pre>
value = sourcestring.substring(0, m.start()) + replacement + (sourcestring.substring(m.end()));
</pre>
<p>But this will modify the source string, basically throwing the matcher out of the curve.</p>
<p>Looking at the matcher API, I found <code>java.util.regex.Matcher.appendReplacement(StringBuffer, String)</code> and <code>java.util.regex.Matcher.appendTail(StringBuffer)</code>. These two little gems to the trick:</p>
<pre>
private String resolve(String sourcestring, Properties props) {
  Pattern re = Pattern.compile("\\$\\{(.+?)\\}");
  Matcher m = re.matcher(sourcestring);
  StringBuffer result = new StringBuffer();
  while (m.find()) {
    String variable = m.group(1);
    String resolved = resolve(props.getProperty(variable), props);
    m.appendReplacement(result, resolved);
  }
  m.appendTail(result);
  return result.toString();
}
</pre>
<p>Regular Expressions <strong>do</strong> save the day!</p>
<p><a href="http://xkcd.com/208/"><img width="75%" style="margin-left:auto; margin-right: auto; display: block" src="http://imgs.xkcd.com/comics/regular_expressions.png" alt=""Regular Expression Comic from xkcd.com/></a></p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ubuIoB3EUtQ:y6FsyHtx_g4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ubuIoB3EUtQ:y6FsyHtx_g4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=ubuIoB3EUtQ:y6FsyHtx_g4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=ubuIoB3EUtQ:y6FsyHtx_g4:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/ubuIoB3EUtQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/fun-with-regular-expressions-ant-style-variable-replacing-in-strings/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/fun-with-regular-expressions-ant-style-variable-replacing-in-strings/</feedburner:origLink></item>
		<item>
		<title>Xtext @ Google</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/EBuyE-SPymc/</link>
		<comments>http://www.peterfriese.de/xtext-google/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 12:46:02 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[MDSD]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=307</guid>
		<description><![CDATA[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 ]]></description>
			<content:encoded><![CDATA[<p>Last week I had the chance to speak at the <a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009">EclipseDay at the GooglePlex</a> in <a href="http://maps.google.com/?q=Google+Inc.%4037.423156,-122.084917&amp;hl=en&amp;ie=UTF8&amp;ll=37.42216,-122.085764&amp;spn=0.005283,0.011362&amp;t=h&amp;z=17">Mountain View, CA</a>, an event organized by the <a href="http://www.eclipse.org">Eclipse Foundation</a> and hosted by <a href="http://code.google.com/opensource/">Google's Open Source Programs Office</a>.  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 <a href="http://konigsberg.blogspot.com/">Robert Konigsberg</a> who was kind enough to host me for that day.  The organizers put together a great agenda with lots of interesting talks. <a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts">Looking at the agenda</a>, you will see that there actually are three major topics, <strong>Eclipse in the Enterprise</strong>, <strong>Modeling</strong> and <strong>Runtime</strong>:  The talks</p>
<ul>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Eclipse_in_the_Enterprise:_Lessons_from_Google">Eclipse in the Enterprise: Lessons from Google</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Distributed_OSGi_in_the_Eclipse_Runtime_Project">Distributed OSGi</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Deploying_Successful_Enterprise_Tools">Deploying Successful Enterprise Tools</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Build_and_Provision:_Two_Sides_of_the_Coin_We_Love_to_Hate">Build and Provision</a></li>
</ul>
<p>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.  The talks</p>
<ul>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Developing_DSLs_with_Eclipse">Developing DSLs with Eclipse</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Eclipse_in_NASA_Mission_Control">Eclipse in NASA Mission Control</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Build_and_Provision:_Two_Sides_of_the_Coin_We_Love_to_Hate">Build and Provision</a></li>
</ul>
<p>either directly had modeling as their topic or used modeling technology to solve their problems. I especially liked the NASA talk which featured a number of computer animated videos of recent or future missions. The NASA mission control software is heavily based on Eclipse and technology form the Eclipse Modeling Project.  Finally, there were some talk on runtime technology:</p>
<ul>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#OSGi_for_Eclipse_Developers">OSGi for Eclipse Developers</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Developing_for_Android_with_Eclipse">Developing for Android with Eclipse</a></li>
<li><a href="http://wiki.eclipse.org/Eclipse_Day_At_Googleplex_2009/Session_Abstacts#Google_Plugin_for_Eclipse:_Not_Just_for_Newbies_Any_More">Google Plugin for Eclipse: Not Just for Newbies Any More</a></li>
</ul>
<p>Attending great talks of course is one of the major benefits of going to a conference like this. To me, meeting other people and connecting has become even more important than attending great talks. Of course, this is nothing new to event organizers and so there were many chances to grab a drink and chat with the other attendees. With more than 170 people attending, it was hard to have a chat with everyone, but nevertheless I managed to talk to a number of people, many of which already are Xtext users or are now planing to have a detailed look at it. Even Google is using Xtext, but ssshh!  Overall, I really enjoyed my two days at Google and look forward to more events like this. Speaking of which, <a href="http://www.eclipsecon.org/summiteurope2009/">Eclipse Summit Europe is approaching fast</a>, so make sure you register on time. Also, if you're interested in Modeling and DSLs, we're organizing a Modeling / DSL Day in North America this coming fall - see <a href="http://www.peterfriese.de/eclipse-modeling-day-in-north-america/">my previous post</a> for more info.  And finally, here are the slides and the video of my talk:</p>
<div><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=buildingdslswitheclipseslideshare-key-090827153422-phpapp02&amp;stripped_title=building-dsls-with-eclipse-1916333" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="480" height="385" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=buildingdslswitheclipseslideshare-key-090827153422-phpapp02&amp;stripped_title=building-dsls-with-eclipse-1916333" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube-nocookie.com/v/bhdGNTm4PzI&amp;hl=en&amp;fs=1&amp;color1=0x234900&amp;color2=0x4e9e00" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube-nocookie.com/v/bhdGNTm4PzI&amp;hl=en&amp;fs=1&amp;color1=0x234900&amp;color2=0x4e9e00" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=EBuyE-SPymc:k6SmJtuzm8U:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=EBuyE-SPymc:k6SmJtuzm8U:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=EBuyE-SPymc:k6SmJtuzm8U:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=EBuyE-SPymc:k6SmJtuzm8U:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/EBuyE-SPymc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/xtext-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/xtext-google/</feedburner:origLink></item>
		<item>
		<title>Eclipse Modeling Day in North America</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/xqCB9-BGMYA/</link>
		<comments>http://www.peterfriese.de/eclipse-modeling-day-in-north-america/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 17:22:41 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[MDSD]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=302</guid>
		<description><![CDATA[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&#38;formkey=dF ZQcGh3RDhrUUdyNTAtMXlVU2pKQ1E6MA..
Our goal is to ]]></description>
			<content:encoded><![CDATA[<p><span class="MsgBodyText">We (i.e. the Eclipse Foundation, <a href="http://www.itemis.com">itemis</a> 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:</span></p>
<p><a href="http://spreadsheets.google.com/viewform?hl=en&amp;formkey=dFZQcGh3RDhrUUdyNTAtMXlVU2pKQ1E6MA.." target="_blank"> http://spreadsheets.google.com/viewform?hl=en&amp;formkey=dF ZQcGh3RDhrUUdyNTAtMXlVU2pKQ1E6MA..</a></p>
<p>Our goal is to organize an event especially for people new to modeling or who are curious what this modeling fuss is all about and how it can help them. So, this will not be an experts meeting, but you can meet experts talking about their topics. We also are interested in case studies, so ideally you will get first-hand experience from people who use modeling in real life to meet real challenges.</p>
<p>We welcome any feedback, so please fill out our little poll.
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xqCB9-BGMYA:le3WFh113KI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xqCB9-BGMYA:le3WFh113KI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=xqCB9-BGMYA:le3WFh113KI:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=xqCB9-BGMYA:le3WFh113KI:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/xqCB9-BGMYA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/eclipse-modeling-day-in-north-america/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/eclipse-modeling-day-in-north-america/</feedburner:origLink></item>
		<item>
		<title>Getting started with Xtext, part 2</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/I2gynz6Ek5E/</link>
		<comments>http://www.peterfriese.de/getting-started-with-xtext-part-2/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 20:48:56 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=298</guid>
		<description><![CDATA[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 ]]></description>
			<content:encoded><![CDATA[<p>Last week, <a href="http://www.peterfriese.de/getting-started-with-xtext/">I showed you how easy</a> it is to create a DSL with <a href="http://www.xtext.org">Xtext</a>. In this installment, we will have a look at how to leverage the models created with the DSL.</p>
<h3>Goal</h3>
<p>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.</p>
<p>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.</p>
<p>So, we're going to create a set of code templates for a code generator that can then read our DSL models and create persistence code for us.</p>
<h3>Prepare</h3>
<p>In order to draw any benefit from this post, you need to have a running version of the DSL we created last time round. If you're new to this series, please go back one week and follow along the steps outlined in last week's article. It shouldn't take you longer than 30 minutes, and I promise we'll wait here for you.</p>
<h3>Create a main template</h3>
<p>As we're probably going to create more than one kind of class (we'll have Entity beans, DAOs and maybe some interfaces), it is a wise idea to separate all those templates into separate files. The code generator then needs to invoke all those template files in order to generate our application. To make things more maintainable, every code generator should have a main entry point, so let's create a main template file which serves as this main entry point.</p>
<p>First, please <em>delete</em> everything in <em>org.xtext.example.entity.generator/templates</em>. Then, create a new <em>Xpand</em> template in this directory by selecting <em>File -> New -> Other ... -> Xpand Template</em>. This is going to be our main template, so let's call it <em>Main.xpt</em>. An empty editor will open.</p>
<p>Insert the following line:</p>
<pre>«IMPORT entity»</pre>
<p>In case you wonder how to insert the special quotation marks, use code completion (press <em>CTRL + Space</em>, or <em>CMD + Space</em> on a Mac) to insert them. Upon activating code completion, a dialog will appear, asking you whether to add the <em>Xpand</em> nature to the project. Please confirm this dialog.</p>
<p>The <em>IMPORT</em> statement imports the metamodel of your DSL, thereby making it known to Xpand, which will enable us to use the metamodel in our templates.</p>
<p>Next, add the following lines:</p>
<pre>
«DEFINE main FOR Model»
  «EXPAND Entity::entity FOREACH this.types.typeSelect(Entity)»
«ENDDEFINE»
</pre>
<p>This will add a new template called <em>main</em> to your template file. By specifying <em>FOR Model</em>, we specify that this template will later be bound to a variable representing your model. The <em>EXPAND...FOREACH</em> statement will invoke a template called <em>entity</em> in a template file called <em>Entity</em> for all elements of the collection <em>types</em> in your model. Remember, your model contains a number of entities and type definitions. These are stored in the collection <em>types</em>. The <em>typeSelect(Entity)</em> statement makes sure the generator only considers elements which are of type <em>Entity</em> (we do not want to create Java beans for the plain data types).</p>
<h3>Create a template for Java beans</h3>
<p>Every data-oriented application needs a bunch of classes to hold the data. Usually referred to as <em>entities</em>, these classes are POJOs in our case. So, let's now create a template which helps us to create POJOs from our model.</p>
<p>Please add another <em>Xpand template</em> to your project by selecting <em>File -> New -> Other ... -> Xpand Template</em>. Name the new file <em>Entity.xpt</em>, making sure to save it to the same folder as <em>Main.xpt</em>.</p>
<p>Again, start the file by importing the meta model:</p>
<pre>
«IMPORT entity»
</pre>
<p>Next, add the following lines:</p>
<pre>
«DEFINE entity FOR entity::Entity»
  «FILE this.name + ".java"»
    public class «this.name» {
      «EXPAND attribute FOREACH this.attributes»
    }
  «ENDFILE»
«ENDDEFINE»
</pre>
<p>This template will create a new Java file for each entity instance it is invoked for. This is achieved by the <em>FILE</em> statement, which takes the name of the output file as it's first parameter.</p>
<p>As you can guess, we also need a template to create the attributes, so please add the following lines:</p>
<pre>
«DEFINE attribute FOR Attribute»
  private «this.type.name» «this.name»;

  public void set«this.name.toFirstUpper()»(«this.type.name» «this.name») {
    this.«this.name» = «this.name»;
  }

  public «this.type.name» get«this.name.toFirstUpper()»() {
    return this.«this.name»;
  }
«ENDDEFINE»
</pre>
<p>This template will create a private field, a setter and a getter for each attribute it is invoked for.</p>
<h3>Create a template for a DAO</h3>
<p>To load entities from a database and save them back, we will need to write some entities, but again, this is something the generator can do for us, so let's write a template:</p>
<p>Create a template <em>DAO.xpt</em> and insert this text:</p>
<pre>
«IMPORT entity»

«DEFINE dao FOR entity::Entity»
  «FILE this.name + "DAO.java"»
    import java.util.Collection;
    import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
    public class «this.name»DAO
      extends HibernateDaoSupport {
      «EXPAND crud FOR this»
    }
  «ENDFILE»
«ENDDEFINE»

«DEFINE crud FOR Entity»
  public «this.name» load(Long id) {
    return («this.name»)getHibernateTemplate().get(«this.name».class, id);
  }

  @SuppressWarnings("unchecked")
  public Collection<«this.name»> loadAll() {
    return getHibernateTemplate().loadAll(«this.name».class);
  }  

  public «this.name» create(«this.name» entity) {
    return («this.name») getHibernateTemplate().save(entity);
  }

  public void update(«this.name» entity) {
    getHibernateTemplate().update(entity);
  }

  public void remove(«this.name» entity) {
    getHibernateTemplate().delete(entity);
  }
«ENDDEFINE»
</pre>
<p>Do not forget to invoke this template from the master template file <em>Main.xpt</em>:</p>
<pre>
«IMPORT entity»

«DEFINE main FOR Model»
	«EXPAND Entity::entity FOREACH this.types.typeSelect(Entity)»
	«EXPAND DAO::dao FOREACH this.types.typeSelect(Entity)»
«ENDDEFINE»
</pre>
<h3>Create a model</h3>
<p>In your workspace, open <em>org.xtext.example.entity.generator/src/model/MyModel.entity</em>, making sure it contains the following model:</p>
<pre>
typedef String
typedef Integer
typedef Double
typedef Date mapsto java.util.Date

entity Customer {
  String firstName
  String lastName
  String email
  Address shippingAddress
  Order* orders
}

entity Address {
  String line1
  String line2
  String city
  String postcode
  String state
  String country
}

entity Product {
  String description
  Double price
}

entity Book extends Product {
  String ISBN
  String author
}

entity Order {
  Date orderDate
  OrderLine* orderLines
}

entity OrderLine {
  Product item
  Integer amount
}
</pre>
<h3>Setting up the generator</h3>
<p>Before we can actually start the generator and transform our model, we need to adjust some aspects of the generator project.</p>
<p>First, please open the generator workflow in <em>/org.xtext.example.entity.generator/src/workflow/EntityGenerator.mwe</em>. We need to change the name of the root template so it matches the name of the root template we chose. We also would like the generator to format the output properly, so we're going to add an output beautifier.</p>
<p>Change the generator component in the workflow file to match the following:</p>
<pre>
  &lt;component class="org.eclipse.xpand2.Generator"&gt;
    &lt;metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/&gt;
    &lt;fileEncoding value="MacRoman"/&gt;
    &lt;expand value="templates::Main::main FOR model"/&gt;
    &lt;genPath value="src-gen"/&gt;
    &lt;beautifier class="org.eclipse.xpand2.output.JavaBeautifier"/&gt;
  &lt;/component&gt;
</pre>
<p><strong>Note:</strong> you need to leave the <em>fileEncoding</em> attribute as-is. The above fragment is valid only on a Mac.</p>
<p>As the formatter is based on the Eclipse java formatter (see also <a href="http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/">this post on the Eclipse code formatter</a> which I wrote some years ago and which still drives 200 reader/day to my blog), we have to add some bundle dependencies to the generator project.</p>
<p>Do to so, please open <em>/org.xtext.example.entity.generator/META-INF/MANIFEST.MF</em>, go to the <em>Dependencies</em> and add the following bundles:</p>
<ul>
<li>org.eclipse.jface.text</li>
<li>org.eclipse.core.runtime</li>
<li>org.eclipse.jdt.core</li>
<li>org.eclipse.xtext.log4j</li>
<li>com.ibm.icu</li>
</ul>
<h3>Running the generator</h3>
<p>To run the generator, simply select the workflow file <em>/org.xtext.example.entity.generator/src/workflow/EntityGenerator.mwe</em> and choose <em>Run as... -> MWE Workflow</em> from the context menu. You'll see a bunch of log messages in the console view, and after a few seconds, you'll find a bunch of just generated files in <em>/org.xtext.example.entity.generator/src-gen</em>.</p>
<h3>Using the DSL to drive the generator</h3>
<p>In the above sample, we wrote the DSL model by hand (well, you probably just copied it from this post), but this certainly is not the normal usage pattern. So, how can you use the DSL editor to create models that are then being read by the generator?</p>
<p>Actually, it is very easy if you follow these steps:</p>
<ol>
<li>Start the DSL in a runtime workbench (refer to the last installment to see how)</li>
<li>In the runtime workspace, create a new <em>Eclipse Plug-in Project</em>. Choose any name you like, e.g. <em>org.xtext.example.entity.mymodel</em>. Make sure you deselect <em>Generate an activator...</em> on the second page of the wizard - we don't need one.</li>
<li>Add all of the following dependencies to the newly created project's manifest file:
<ul>
<li>org.xtext.example.entity</li>
<li>org.eclipse.xpand</li>
<li>org.eclipse.xtend</li>
<li>org.eclipse.xtext</li>
<li>org.eclipse.emf.mwe.core</li>
<li>org.eclipse.emf.mwe.utils</li>
<li>org.eclipse.xtend.typesystem.emf</li>
<li>org.eclipse.jface.text</li>
<li>org.eclipse.core.runtime</li>
<li>org.eclipse.jdt.core</li>
<li>org.eclipse.xtext.log4j</li>
<li>com.ibm.icu</li>
<li>org.xtext.example.entity.generator</li>
</ul>
</li>
<li>Create a new workflow file in <em>/org.xtext.example.entity.mymodel/src/workflow/EntityGenerator.mwe</em> and insert the following text:
<pre>
&lt;workflow>
  &lt;cartridge file="workflow/EntityGenerator.mwe" model="classpath:/model/MyModel.entity"/&gt;
&lt;/workflow&gt;
		</pre>
</li>
<li>Patch the workflow file in the generator: Go back to the original workspace and change the line containing <em>&lt;component class="org.eclipse.xtext.MweReader" uri="...</em> to <em>&lt;component class="org.eclipse.xtext.MweReader" uri="${model}"&gt;</em>
	</li>
<li>Go back to the runtime workspace and create a new file <em>MyModel.entity</em> in <em>/org.xtext.example.entity.mymodel/src/model/MyModel.entity</em>.
</ol>
<p>You can now use the DSL editor to create your model. The generator can be started by running the generator workflow file <em>EntityGenerator.mwe</em> in your newly created model project <em>/org.xtext.example.entity.mymodel</em> in the runtime workspace.</p>
<h3>Conclusion</h3>
<p>I hope the last section didn't bother you too much. The good news is that we're going to provide a wizard which will help you setting up DSL model projects - see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281214">bug 281214</a>.</p>
<p>Due to space limitations, this example is not complete in a sense that you can generate a fully functional CRUD application from it. You should, however be able to see what's possible with textual DSLs and code generation.</p>
<p>If you're interested in seeing the whole generator, drop me a line (peter dot friese [at] itemis dot de) or DM me on Twitter (my Twitter ID is @peterfriese).</p>
<h3>Download the code</h3>
<p><a href="http://code.google.com/p/peterfriese/source/browse/xtext_getting_started/tags/xtext_getting_started_2/">Download the code</a> from my SVN repository.
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=I2gynz6Ek5E:1wOwPtU2Lno:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=I2gynz6Ek5E:1wOwPtU2Lno:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=I2gynz6Ek5E:1wOwPtU2Lno:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=I2gynz6Ek5E:1wOwPtU2Lno:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/I2gynz6Ek5E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/getting-started-with-xtext-part-2/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/getting-started-with-xtext-part-2/</feedburner:origLink></item>
		<item>
		<title>Getting Started with Xtext</title>
		<link>http://feedproxy.google.com/~r/FormFollowsFunction/~3/gyutnkU_gww/</link>
		<comments>http://www.peterfriese.de/getting-started-with-xtext/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 22:17:56 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[DSLs]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://www.peterfriese.de/?p=284</guid>
		<description><![CDATA[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 ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.xtext.org">Xtext</a> has been released as a part of the Eclipse Galileo release train on June 24th, 2009. Xtext is a framework for building DLSs (<b>d</b>omain <b>s</b>pecific <b>l</b>anguages). In fact, it can be seen as a DSL for defining DSLs. </p>
<p>In this article, we will develop a small DSL for defining entities. </p>
<h2>Download and Install</h2>
<p>Hop over to <a href="http://xtext.itemis.com">http://xtext.itemis.com</a> 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.</p>
<p>To install, unzip the distribution file to a directory of your liking. </p>
<p><b>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.</b></p>
<h2>Create a new project</h2>
<p>After launching Eclipse and creating a new workspace (or using an existing one), create a new Xtext project by selecting <em>File -> New... Project... -> Xtext Project</em>. In this article, we're creating a DSL for describing entities, so let's go with the following settings:</p>
<ul>
<li>Main project name: <em>org.xtext.example.entity</em></li>
<li>Language name: <em>org.xtext.example.Entity</em></li>
<li>DSL-File extension: <em>entity</em></li>
<li>Create generator project: <em>yes</em></li>
</ul>
<p>Click <em>Finish</em> to let Xtext create the three projects that make up your DSL:</p>
<ul>
<li>org.xtext.example.entity - this project contains the DSL itself, including all back end infrastructure like the parser and the meta model.</li>
<li>org.xtext.example.entity.ui - as the name implies, this project contains all UI centric code of the DSL: the editor, the outline, content assist and so forth</li>
<li>org.xtext.example.entity.generator - this project contains a code generator which will transform the DSL scripts (aka models) you write in your DSL into something useful. In our example, we will create some POJOs and DAOs from our models.</li>
</ul>
<p>Upon finishing creating these three projects, Xtext opens a file <em>Entity.xtext</em>, which contains a sample grammar, which we will change in a second.</p>
<h2>Define the grammar for your DSL</h2>
<p>Next up, we need to define the grammar for our DSL. To make things easier for us, let's first write down a sample model. Please open <em>org.xtext.example.entity.generator/src/model/MyModel.entity</em> and key in the following text:</p>
<pre>
typedef String
typedef Integer
typedef Date mapsto java.util.Date

entity Person {
  String name
  String surName
  Date birthDay
  Address home
  Address work
}

entity Boss extends Person {
  Person* employees
}

entity Address {
  String street
  String number
  String city
  String ZIP
}
</pre>
<p>Most of this model should be pretty obvious, but there are two things worth noting:</p>
<ul>
<li>We define our own list of data types to gain a certain degree of flexibilty, i.e. to map them to different types in the host language, as can be seen for the <em>Date</em> data type, which gets mapped to <em>java.util.Date</em> (we might also decide to map it to <em>java.sql.Date</em>)</li>
<li>The star (*) denotes multiplicity. We might also have chosen square brackets (<em>Person[] employees</em>) or something completely different - it's largely a matter of taste.</li>
</ul>
<p>Let's derive the grammar for this model. Open <em>org.xtext.example.entity/src/org/xtext/example/Entity.xtext</em>, erase its entire contents and enter the following:</p>
<pre>
grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals
generate entity "http://www.xtext.org/example/Entity"
</pre>
<p>The first line indicates we want the new grammar to be derived from the (built-in) grammar <em>Terminals</em>, which defines some basic terminal rules (like STRING, ID and so forth). If you're interested, <em>CTRL+Click</em> on the language name to navigate to its definition.</p>
<p>The second line defines the name and namespace URI for our own grammar.</p>
<p>Let's now define that our DSL supports types. Add the following lines:</p>
<pre>
Model:
  (types+=Type)*;

Type:
  TypeDef | Entity;
</pre>
<p>This tells Xtext that our <em>Model</em> contains any number (i.e. <em>0..N</em>, as declared by the <em>*</em>) of <em>Type</em>s. What exactly a <em>Type</em> is needs to be specified. Apparently, a <em>Type</em> can be either a <em>TypeDef</em> or an <em>Entity</em>:</p>
<pre>
TypeDef:
  "typedef" name=ID ("mapsto" mappedType=JAVAID)?;
</pre>
<p>A <em>TypeDef</em> starts with the keyword <em>typedef</em>, followed by an <em>ID</em> making up its name. Following the name, we can optionally (hence the question mark at the end) add a <em>mapsto</em> clause. The fragment <em>mappedType=JAVAID</em> specifies that the <em>TypeDef</em> will later have an attribute named <em>mappedType</em> of type JAVAID. As JAVAID is not yet defined, we need to do so:</p>
<pre>
JAVAID:
  name=ID("." ID)*;
</pre>
<p>So, a <em>JAVAID</em> is a sequence of <em>ID</em>s and dots, making up a qualified Java type name, such as <em>java.util.Date</em>.</p>
<p>Next, let's define how to model entities:</p>
<pre>
Entity:
  "entity" name=ID ("extends" superEntity=[Entity])?
  "{"
    (attributes+=Attribute)*
  "}";
</pre>
<p>As you might have guessed, <em>Entity</em>s start with the keyword <em>entity</em>, followed by an <em>ID</em> as their name. They may optionally extends another entity. Surrounding a rule call with square brackets means "this is a cross reference", i.e. a reference to an already existing element.</p>
<p><em>Entity</em>s do have <em>Attribute</em>s (any number, to be precise), thus we have to define how <em>Attribute</em>s look like:</p>
<pre>
Attribute:
  type=[Type] (many?="*")? name=ID;
</pre>
<p>By now, you should be able to read this rule: an <em>Attribute</em> has a <em>type</em> which is a cross reference to a <em>Type</em> (which is either a <em>TypeDef</em> or an <em>Entity</em>), it has an optional multiplicity indicator (the star) and - of course - if has a name.</p>
<p>Your grammar should look like this by now:</p>
<pre>
grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals

generate entity "http://www.xtext.org/example/Entity"

Model:
  (types+=Type)*;

Type:
  TypeDef | Entity;

TypeDef:
  "typedef" name=ID ("mapsto" mappedType=JAVAID)?;

JAVAID:
  name=ID("." ID)*;

Entity:
  "entity" name=ID ("extends" superEntity=[Entity])?
  "{"
    (attributes+=Attribute)*
  "}";

Attribute:
  type=[Type] (many?="*")? name=ID;
</pre>
<h2>Compiling the DSL</h2>
<p>Now it is time to see the fruits of our labor. But first, we need to compile our grammar. Xtext will create:</p>
<ul>
<li>a parser</li>
<li>a serializer</em>
<li>an Ecore meta model</li>
<li>a full blown Eclipse editor</li>
</ul>
<p>from this grammar. To make this happen, please select <em>org.xtext.example.entity/src/org/xtext/example/GenerateEntity.mwe</em> and select <em>Run As -> MWE Workflow</em> from the context menu. Xtext will now generate the entire infrastructure for your DSL and after a few seconds you should have a shiny new DSL including a great editor.</p>
<h2>Taking it for a spin</h2>
<p>Seeing is believing, so let's take the DSL editor for a test drive. Select the DSL project <em>org.xtext.example.entity</em> and, from the context menu, select <em>Run As -> Eclipse Application</em>. A second instance of Eclipse will be started.</p>
<p>In this new instance, create a new, empty project (<em>File -> New -> Project... -> General -> Project</em>. Create a new file <em>Sample.entity</em> in the new project.</p>
<p>You can now insert the model we designed above or enter a new model:<br />
<a href="http://www.flickr.com/photos/81029262@N00/3673405506" title="View 'Getting Started With Xtext' on Flickr.com">
<div style="text-align:center;"><img src="http://farm3.static.flickr.com/2574/3673405506_09fed234e1.jpg" alt="Getting Started With Xtext" border="0" width="500" height="411" /></div>
<p></a></p>
<h2>Leveraging the model</h2>
<p>Now that we've got a fancy editor for our DSL, we want to transform the models we can create with this editor into something meaningful. This, however, will be the topic of the next installment.</p>
<h2>More info</h2>
<p>Feel free to discuss this article in the comments section of <a href="http://www.peterfriese.de">my blog</a>. Should you have any technical questions regarding Xtext, we've got an <a href="http://www.eclipse.org/newsportal/thread.php?group=eclipse.modeling.tmf">excellent newsgroup</a> where the committers answer your questions. We (itemis) also offer <a href="http://xtext.itemis.com/xtext/language=en/23946/professional-services">professional (commercial) support</a>, i.e. customized trainings to get your team up to speed. Just <a href="mailto:peter.friese@itemis.de">drop us a note</a>, we're happy to discuss the details with you.</p>
<h2>Download the code</h2>
<p>You can check out the code from <a href="http://code.google.com/p/peterfriese/source/browse/xtext_getting_started/tags/xtext_getting_started_1/">this SVN repository location</a>.
</p>
<p>
Thanks for reading this post. You should follow me on twitter <a href="http://twitter.com/peterfriese">here</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=gyutnkU_gww:70FTAaLiG3o:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=gyutnkU_gww:70FTAaLiG3o:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?i=gyutnkU_gww:70FTAaLiG3o:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/FormFollowsFunction?a=gyutnkU_gww:70FTAaLiG3o:6stttfHX83w"><img src="http://feeds.feedburner.com/~ff/FormFollowsFunction?d=6stttfHX83w" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FormFollowsFunction/~4/gyutnkU_gww" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.peterfriese.de/getting-started-with-xtext/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://www.peterfriese.de/getting-started-with-xtext/</feedburner:origLink></item>
	</channel>
</rss>
