<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>EclipseSource Blog &#187; gradle</title>
	<atom:link href="http://eclipsesource.com/blogs/tag/gradle/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:54:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Beyond XML: The Future of Extensible Metaformats</title>
		<link>http://eclipsesource.com/blogs/2009/08/11/beyond-xml-the-future-of-extensible-metaformats/</link>
		<comments>http://eclipsesource.com/blogs/2009/08/11/beyond-xml-the-future-of-extensible-metaformats/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 15:56:09 +0000</pubDate>
		<dc:creator>Manuel Woelker</dc:creator>
				<category><![CDATA[syndicate]]></category>
		<category><![CDATA[gant]]></category>
		<category><![CDATA[gradle]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=2666</guid>
		<description><![CDATA[Yesterday I discussed some of the issues with XML. Today I'll be taking a look at three of the potential alternatives that may improve on the current situation.]]></description>
			<content:encoded><![CDATA[<p>Yesterday I discussed <a title="XML: Still No Silver Bullet" href="http://eclipsesource.com/blogs/2009/08/10/xml-still-no-silver-bullet/">some of the issues with XML</a>. Today I&#8217;ll be taking a look at three of the potential alternatives that may improve on the current situation.</p>
<h4>YAML</h4>
<p><a title="The Official YAML Website" href="http://www.yaml.org/">YAML Ain&#8217;t Markup Language</a>. To quote the <a title="YAML Ain’t Markup Language (YAML™) Version 1.2 " href="http://www.yaml.org/spec/1.2/spec.html">spec</a>, it is a &#8220;human-friendly, cross language, Unicode based data serialization         language&#8221;. While mainly designed with so-called agile languages in mind, it can also be used with more traditional languages. The format is more data-centric than document-driven. Even so, one of its primary design goals is good readability. It was heavily influenced by <a title="Internet Message Format" href="http://www.rfc-editor.org/rfc/rfc2822.txt">RFC 2822 (Internet Message Format)</a>. That means it looks a lot like mail headers. It features built-in support for lists, hashes (i.e. dictionaries or<strong> </strong>associative array), and common data types. It also allows elements to have multiple parents, which also allows cross-references. There are some more minor features that make working with the format easier. Here&#8217;s a small example of a YAML document lifted from the spec:</p>
<pre>invoice: 34843
date   : 2001-01-23
bill-to: &amp;id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
product:
    - sku         : BL394D
      quantity    : 4
      description : Basketball
      price       : 450.00
    - sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
tax  : 251.42
total: 4443.52
comments:
    Late afternoon is best.
    Backup contact is Nancy
    Billsmer @ 338-4338.</pre>
<p>While YAML seems like a solid solution with implementations written for many languages, there are some issues, like the surprising lack of momentum in the software development community and the controversial use of significant whitespace.</p>
<h4>JSON</h4>
<p>The <a title="The JSON Website" href="http://www.json.org/">JavaScript Object Notation</a> is basically a subset of JavaScript used to statically describe data. With the release of YAML 1.2 it is also a subset of YAML, which means every JSON document is a YAML file. Its focus is primarily simplicity and readability. While it is trivial to parse JSON in a JavaScript environment, its simplicity makes it also quite easy parse in other languages. Parsers for most popular modern development platforms exist. Being so easily accessible in browsers has earned it quite some support and momentum in modern web development, already often completely replacing XML in the AJAX stack. Here&#8217;s a small snippet lifted from the JSON Wikipedia page:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
     <span style="color: #3366CC;">&quot;firstName&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;John&quot;</span><span style="color: #339933;">,</span>
     <span style="color: #3366CC;">&quot;lastName&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Smith&quot;</span><span style="color: #339933;">,</span>
     <span style="color: #3366CC;">&quot;address&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #3366CC;">&quot;streetAddress&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;21 2nd Street&quot;</span><span style="color: #339933;">,</span>
         <span style="color: #3366CC;">&quot;city&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;New York&quot;</span><span style="color: #339933;">,</span>
         <span style="color: #3366CC;">&quot;state&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;NY&quot;</span><span style="color: #339933;">,</span>
         <span style="color: #3366CC;">&quot;postalCode&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">10021</span>
     <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
     <span style="color: #3366CC;">&quot;phoneNumbers&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #3366CC;">&quot;home&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;212 555-1234&quot;</span><span style="color: #339933;">,</span>
         <span style="color: #3366CC;">&quot;fax&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;646 555-4567&quot;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>JSON is currently quite popular, though it may in certain cases be hampered by its simpleness. Maybe YAML forward compatibility can provide an convenient upgrade path, should a more sophisiticated format be necessary.</p>
<h4>Groovy</h4>
<p>Most of you may know <a title="The Groovy Website" href="http://groovy.codehaus.org/">Groovy</a> as a JVM scripting language. I have also already blogged about <a title="Groovy, Eclipse Commands and Expressions" href="http://eclipsesource.com/blogs/2009/07/14/groovy-expressions-proof-of-concept/">using Groovy to replace especially painful parts of XML</a>.</p>
<p>Groovy features a MarkupBuilder that let&#8217;s you create what is basically an XML DOM tree in memory using a slightly more fluent syntax. Have a look:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">  car<span style="color: #66cc66;">&#40;</span>name:<span style="color: #ff0000;">'HSV Maloo'</span>, make:<span style="color: #ff0000;">'Holden'</span>, year:<span style="color: #cc66cc;">2006</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    country<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Australia'</span><span style="color: #66cc66;">&#41;</span>
    record<span style="color: #66cc66;">&#40;</span>type:<span style="color: #ff0000;">'speed'</span>, <span style="color: #ff0000;">'Production Pickup Truck with speed of 271kph'</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Some might consider this just syntactic sugar but it really goes a long way.</p>
<p>But I think Groovy can also be used as a first class configuration language. There are already several projects out there that use groovy scripts for tasks that have traditionally been in the firm grip of XML. One such example is <a title="The gant website" href="http://gant.codehaus.org/">gant</a>, which is basically just a thin wrapper to write ant files. Of course nowadays, everyone is using maven instead, but there&#8217;s also a neat tool for that: <a title="The Gradle website" href="http://www.gradle.org/">Gradle</a> is build system configured using a Groovy <a title="Domain-specific language" href="http://en.wikipedia.org/wiki/Domain-specific_language">DSL</a>, while employing Apache ivy and maven under the hood. Take a look at this example from the official gradle documentation:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">usePlugin <span style="color: #ff0000;">'java'</span>
&nbsp;
sourceCompatibility <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1.5</span>
version <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'1.0'</span>
manifest.<span style="color: #006600;">mainAttributes</span><span style="color: #66cc66;">&#40;</span>
    <span style="color: #ff0000;">'Implementation-Title'</span>: <span style="color: #ff0000;">'Gradle Quickstart'</span>,
    <span style="color: #ff0000;">'Implementation-Version'</span>: version
<span style="color: #66cc66;">&#41;</span>
&nbsp;
repositories <span style="color: #66cc66;">&#123;</span>
    mavenCentral<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
dependencies <span style="color: #66cc66;">&#123;</span>
    compile group: <span style="color: #ff0000;">'commons-collections'</span>, name: <span style="color: #ff0000;">'commons-collections'</span>, version: <span style="color: #ff0000;">'3.2'</span>
    testCompile group: <span style="color: #ff0000;">'junit'</span>, name: <span style="color: #ff0000;">'junit'</span>, version: <span style="color: #ff0000;">'4.+'</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
test <span style="color: #66cc66;">&#123;</span>
    options.<span style="color: #006600;">systemProperties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'property'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'value'</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
uploadArchives <span style="color: #66cc66;">&#123;</span>
    repositories <span style="color: #66cc66;">&#123;</span>
       flatDir<span style="color: #66cc66;">&#40;</span>dirs: file<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'repos'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>A lot easier on the eyes, while still providing interoperability with &#8220;legacy&#8221; systems like maven.</p>
<p>The power and expressiveness of groovy make it really easy to create domain-specific languages like these. Such a special purpose language might not always be desirable, especially when interoperability is a key concern. But for certain applications these DSLs might be a better solution than any general purpose format.</p>
<p>On the whole, these are interesting times we live in and I&#8217;m curious to see what the future holds in store. As I said before, XML is probably gonna be here for quite a while, but there are some compelling alternatives out there. What are your thoughts on the legacy of XML?</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2009/08/11/beyond-xml-the-future-of-extensible-metaformats/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

