<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://andersnoras.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Anders Norås' Blog</title><link>http://andersnoras.com/blogs/anoras/default.aspx</link><description>Software Design, Agile and Stuff</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>WTF: Build Failed: No Failed Tests Found</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/16/wtf-build-failed-no-failed-tests-found.aspx</link><pubDate>Wed, 16 Apr 2008 20:47:02 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:556</guid><dc:creator>andersnoras</dc:creator><slash:comments>0</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/556.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=556</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=556</wfw:comment><description>&lt;p&gt;The guys at &lt;a href="http://www.codehaus.org"&gt;Codehaus&lt;/a&gt; are moving the continuous integration servers. I must say that I had a WTF-moment when this build failure notification dropped in my inbox: &lt;img src="http://andersnoras.com/blogs/anoras/2008-04-16_bamboo_wtf.png" alt="Bamboo wtf" title=""&gt; I find it amusing that the build failed because &amp;#8220;all the tests passed&amp;#8221;. The real reason was that it was unable to find Maven on the build server&amp;#8230;&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=556" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Musings/default.aspx">Musings</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category></item><item><title>Reminder: Quick and Dirty Fixes Are Expensive</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/15/reminder-quick-and-dirty-fixes-are-expensive.aspx</link><pubDate>Tue, 15 Apr 2008 21:35:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:549</guid><dc:creator>andersnoras</dc:creator><slash:comments>0</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/549.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=549</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=549</wfw:comment><description>&lt;p&gt;&lt;a href="http://andersnoras.com/blogs/anoras/archive/2008/04/09/reminder-getting-bduf-wrong-is-expensive.aspx"&gt;Last week I wrote a short anecdote about getting big, upfront design wrong&lt;/a&gt;. The next chapter is on quick and dirty fixes. You know, those hacks we do to &amp;#8220;make something work&amp;#8221;. These often come about after frenetic debugging session, where we debug a system into existence. Smacking a piece of drywall on top of the existing drywall is a real-world example.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-04-15_dscf8125.jpg" alt="Dscf8125" title=""&gt;&lt;/p&gt;

&lt;p&gt;Quick and dirty fixes often have side-effects and so does this. Notice that a drawer is missing? Its because it won&amp;#8217;t fit when the wall is 1 centimeter, or about half an inch, thicker.&lt;/p&gt;

&lt;p&gt;Fixes like these need to be done over, taking (almost) twice as long as doing it right the first time around.&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=549" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Musings/default.aspx">Musings</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Agile/default.aspx">Agile</category></item><item><title>I'm on Twitter</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/14/i-m-on-twitter.aspx</link><pubDate>Tue, 15 Apr 2008 13:58:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:548</guid><dc:creator>andersnoras</dc:creator><slash:comments>2</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/548.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=548</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=548</wfw:comment><description>&lt;p&gt;OK, I know I'm late to the party here, but I've started to upgrade from Web 1.0 to Web 2.0. I've even got myself a Twitter profile. You guys can keep an eye on what I'm wasting time on at &lt;a href="http://twitter.com/anoras"&gt;http://twitter.com/anoras.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=548" width="1" height="1"&gt;</description></item><item><title>CodeDomProviders and Compiler Magic</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/13/codedomproviders-and-compiler-magic.aspx</link><pubDate>Mon, 14 Apr 2008 12:05:34 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:543</guid><dc:creator>andersnoras</dc:creator><slash:comments>2</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/543.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=543</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=543</wfw:comment><description>&lt;p&gt;Before .NET 3.5 was released the choice of whether you should choose Visual Basic or C# as your programming language was more or less a matter of taste. With the first incarnations of these languages, you could do virtually the same things with both. Visual Basic 9.0 introduced quite a few new interesting features, and the support for XML literals is my favorite. For those unfamiliar with Visual Basic, XML literals allows you to work with XML DOMs using the all so familiar markup syntax. For instance you this code will build a DOM.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Dim myDOM = &amp;lt;SomeElement&amp;gt; _
                &amp;lt;SomeOtherElement withAnAttribute="42"&amp;gt; _
                    The time is &amp;lt;%= DateTime.Now %&amp;gt; _
                &amp;lt;/SomeOtherElement&amp;gt; _
            &amp;lt;/SomeElement&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notice that you can have inline code similar to what you&amp;#8217;re familiar with from ASP.NET. You can also use XML literals as a replacement for DOM methods to reference elements within the DOM.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Dim someDocument = XDocument.Load("somedocument.xml")
XElement someOtherElement = someDocument.&amp;lt;SomeElement&amp;gt;.&amp;lt;SomeOtherElement&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;XML literals can be used in combination with LINQ and other Visual Basic features, and is a powerful tool when working with XML.&lt;/p&gt;

&lt;p&gt;A couple of weeks ago I had a discussion with a team who were planning to use IBM&amp;#8217;s Process Server and ESB to produce direct marketing campaigns from Excel documents with assorted information like customer names, addresses, key account managers and so forth. Their idea was to write an adapter for the ESB to be able to consume Excel spreadsheets as data sources, convert these into Service Data Objects and use the Process Server&amp;#8217;s mapping abilities to transform the Excel documents into XML that can be passed on to our document production service.
Can you imagine how loud my &amp;#8220;YANGI&amp;#8221;-scream was? This was the perfect moment to exploit Visual Basic&amp;#8217;s XML literals to fight enterpriceyness, so I decided to spend a few hours to build a light-weight solution for this. The application accepts an Excel spreadsheet and row template, and produces an XML document with the result. The row template is written using Visual Basic&amp;#8217;s XML literals and looks similar to this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;Letter&amp;gt;
    &amp;lt;FirstName&amp;gt;&amp;lt;%= row("First Name") %&amp;gt;&amp;lt;/FirstName&amp;gt;
    &amp;lt;LastName&amp;gt;&amp;lt;%= row("Last Name") %&amp;gt;&amp;lt;/LastName&amp;gt;
    &amp;lt;HasSameLastNameAsSpouse&amp;gt;
        &amp;lt;=% IIf (row("Last Name") = row("Spouse's Last Name"),"Yes","No") %&amp;gt;
    &amp;lt;/HasSameLastNameAsSpouse&amp;gt;&amp;lt;
    &amp;lt;!-- And so on... --&amp;gt;
&amp;lt;/Letter&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I took me about 45 minutes to write the application, but there was one small problem. The row templates wouldn&amp;#8217;t compile using Visual Basic&amp;#8217;s CodeDomProvider - even if the generated code built perfectly using the Visual Basic compiler.
It turned out that the reason for this was that even when using .NET 3.5, the CodeDomProviders default to using version 2.0 of the compilers. If you&amp;#8217;re targeting Visual Basic 9.0, you&amp;#8217;ll have to specify this when you create a new CodeDomProvider. The MSDN documentation does not mention this at all, and the many ways of getting hold of a CodeDomProvider makes this even more confusing.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CodeDomProvider vbProvider = CodeDomProvider.CreateProvider("vb");
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When you use the factory, you can only specify which language you&amp;#8217;re targeting, so we&amp;#8217;ll have to instantiate the provider via its constructor. The constructors for the VBCodeProvider and the CSCodeProvider accept an undocumented IDictionary as its argument. It turns out that you can pass configuration options in this dictionary. So to create a .NET 3.5 VBCodeProvider you&amp;#8217;ll need to this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CodeDomProvider provider = new VBCodeProvider(
    new Dictionary&amp;lt;string, string&amp;gt;{{"CompilerVersion","v3.5"}});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is also the case if you&amp;#8217;re looking to use the CodeDOM with C# 3.0 code. The only difference is that you&amp;#8217;ll need to create a CSCodeProvider rather than the Visual Basic one. Below is the complete code for my super simple &amp;#8220;template engine&amp;#8221;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;var className = Guid.NewGuid().ToString("n");
var src = GetTemplate(className);            
CodeDomProvider provider = new VBCodeProvider(
    new Dictionary&amp;lt;string, string&amp;gt;{{"CompilerVersion","v3.5"}});
    var compilerParameters=new CompilerParameters {GenerateInMemory = true};
    var compilerResults = provider.CompileAssemblyFromSource(compilerParameters, src);
    if (compilerResults.Errors.HasErrors)
    {
        throw new CompilationException(compilerResults, src);
    }
return Activator.CreateInstance(compilerResults.CompiledAssembly.GetType(className));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Even if it is confusing, it&amp;#8217;s still very easy to compile code using these new language features. Just remember that you&amp;#8217;ll need to specify some magic strings to get the compiler to apply it&amp;#8217;s magic. &lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=543" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Visual+Basic/default.aspx">Visual Basic</category></item><item><title>Reminder: Getting BDUF Wrong Is Expensive</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/09/reminder-getting-bduf-wrong-is-expensive.aspx</link><pubDate>Wed, 09 Apr 2008 22:39:40 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:541</guid><dc:creator>andersnoras</dc:creator><slash:comments>1</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/541.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=541</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=541</wfw:comment><description>&lt;p&gt;Last November my family and I move into a brand new apartment. Since we&amp;#8217;ve moved in, we&amp;#8217;ve had builders coming in to fix things over and over again. Today they started to &amp;#8220;refactor&amp;#8221; the wiring in our kitchen. Maybe I should get this picture framed as a reminder of not to trust Big Design Upfront (which is the way they build stuff). &lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-04-10_dscf8106.jpg" alt="Dscf8106" title=""&gt;&lt;/p&gt;

&lt;p&gt;The carpenter has a rather agile aporach to his work, and he&amp;#8217;ll be tearing down parts of the kitchen to replace the entire wall tomorrow. Luckily, I&amp;#8217;m not paying for this.&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=541" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Musings/default.aspx">Musings</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Agile/default.aspx">Agile</category></item><item><title>More on generics and Inversion of Control</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/06/more-on-generics-and-inversion-of-control.aspx</link><pubDate>Mon, 07 Apr 2008 13:29:54 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:539</guid><dc:creator>andersnoras</dc:creator><slash:comments>2</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/539.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=539</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=539</wfw:comment><description>&lt;p&gt;My last post on &lt;a href="http://andersnoras.com/blogs/anoras/archive/2008/04/03/generics-inversion-of-control-and-repository-t.aspx"&gt;Java generics and the Repository pattern&lt;/a&gt; got a bit of interest. Judging from the feedback I got, I feel the need to elaborate on the Inversion of Control part of this. As some readers pointed out, Google&amp;#8217;s &lt;a href="http://code.google.com/p/google-guice/"&gt;Guice container&lt;/a&gt; employes super type tokens to support generics to some extent. The IoC example I gave in my previous post can be implemented with Guice by binding a TypeLiteral of the interface to a concrete implementation of that interface.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public class RepositoriesModule implements Module {
   public void configure(Binder binder) {
       binder.bind(new TypeLiteral&amp;lt;Repository&amp;lt;Product&amp;gt;&amp;gt;() {}).to(ProductRepository.class);
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can resolve an implementation of a Repository by asking the injector for an instance of the same TypeLiteral that instance is bound to.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Injector injector = Guice.createInjector(new RepositoriesModule());
Repository&amp;lt;Product&amp;gt; repository = injector.getInstance(Key.get(new TypeLiteral&amp;lt;Repository&amp;lt;Product&amp;gt;&amp;gt;() {}));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However, this does provide a solution similar to how we can inject generic repositories using something like &lt;a href="http://www.castleproject.org"&gt;the Windsor container&lt;/a&gt; for .NET. With Windsor, you can bind a generic interface, say IRepository, to a generic implementation of that interface such as ConcreteRepository : IRepository.
This allows us to resolve a useable repository instance like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;WindsorContainer container = new WindsorContainer();
IRepository&amp;lt;Product&amp;gt; repository = container.Resolve&amp;lt;IRepository&amp;lt;Product&amp;gt;&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One thing to note here is that there is no need to have concrete implementations for every domain object (Product, Order, Customer and similar), a generic implementation of the ConcreteRepository is sufficient because .NET has bona fide generics implemented in the Common Language Runtime (CLR) and the CLR will create a new bound type of the generic class at runtime. This is even the case if we use reflection to create the instance.&lt;/p&gt;

&lt;p&gt;The Guice container allows us to specify providers to which the creation of a dependency will be delegated. However, this provider is bound to the type arguments for the TypeLiteral and wild card type arguments cannot be used because the compiler is unable to infer the runtime type of such an argument. As a result we would need to bind all the TypeLiterals to different concrete implementations or different providers to support this pattern with Guice. This is a show stopper because it takes away the pattern&amp;#8217;s flexibility.
To exemplify the concept, I changed my naïve IoC container from my previous post to support this pattern using Guice&amp;#8217;s TypeLiterals. Here is an example of binding the Repository interface to a provider which will create the typed instances via the RepositoryFactory shown in my previous post. (If you haven&amp;#8217;t read that post, &lt;a href="http://andersnoras.com/blogs/anoras/archive/2008/04/03/generics-inversion-of-control-and-repository-t.aspx"&gt;now is a good time&lt;/a&gt;.) &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@Test
public void canRegisterAnOpenGenericInterfaceAndResolveItsImplementationViaABoundInterface()
{
    // Register the open generic interface and bind it to a provider.
    IoC.register(new TypeLiteral&amp;lt;Repository&amp;gt;() {},new Provider&amp;lt;Repository&amp;gt;() {
        @SuppressWarnings({"unchecked"})
        public Repository get(TypeLiteral&amp;lt;? extends Repository&amp;gt; type) {
            ParameterizedType pt = (ParameterizedType) type.getType();
            return RepositoryFactory.create((Class&amp;lt;?&amp;gt;) pt.getActualTypeArguments()[0]);
        }
    });
    // Resolve an instance of a bound interface.
    Repository&amp;lt;Order&amp;gt; repository = IoC.resolve(new TypeLiteral&amp;lt;Repository&amp;lt;Order&amp;gt;&amp;gt;() {});
    Assert.assertTrue(repository instanceof AbstractRepository);
    Assert.assertSame(Order.class,repository.getEntityClass());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this example we first register the open generic interface, akin to IRepository&amp;lt;&gt; in .NET, to a provider for that interface. The provider implementation has to perform some unchecked operations to allow this to work, but this is not really something to worry about. When we resolve the instance, we pass a fully bound TypeLiteral to the container. The provider is passed this TypeLiteral as an argument, and the type argument is extracted from it. In this example this will be a TypeLiteral&gt;. Since the provider is bound to the open generic type Repository, the extracted type argument will be Order. This provides us with enough type information to create a strongly type instance of the AbstractRepository via the RepositoryFactory class.&lt;/p&gt;

&lt;p&gt;We also need to be able to distinguish between generic implementations and concrete ones. So lets bring in the ProductRepository class from my previous post.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@Test
public void boundServicesHavePrecedenceOverOpenGenericServices()
{
    IoC.register(new TypeLiteral&amp;lt;Repository&amp;gt;() {},new Provider&amp;lt;Repository&amp;gt;() {
        @SuppressWarnings({"unchecked"})
        public Repository get(TypeLiteral&amp;lt;? extends Repository&amp;gt; type) {
            ParameterizedType pt = (ParameterizedType) type.getType();
            return RepositoryFactory.create((Class&amp;lt;?&amp;gt;) pt.getActualTypeArguments()[0]);
        }
    });
    IoC.register(new TypeLiteral&amp;lt;Repository&amp;lt;Product&amp;gt;&amp;gt;() {},ProductRepository.class);

    Repository&amp;lt;Product&amp;gt; repository = IoC.resolve(new TypeLiteral&amp;lt;Repository&amp;lt;Product&amp;gt;&amp;gt;() {});
    Assert.assertTrue(repository instanceof ProductRepository);
    Assert.assertSame(Product.class, repository.getEntityClass());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is basically the same test case over, but with one important difference. In this example two services are registered in the container. First the provider for the open generic Repository interface is registered, and then the concrete implementation for the bound Repository is registered. When we resolve the service for TypeLiteral&gt; we expect to get an instance of ProductRepository back, rather than a runtime generated instance of the AbstractRepository.&lt;/p&gt;

&lt;p&gt;Below is the entire implementation of the &amp;#8220;container&amp;#8221; used in these tests.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public class IoC {
    static Map&amp;lt;TypeLiteral, Provider&amp;gt; registry = new HashMap&amp;lt;TypeLiteral, Provider&amp;gt;();
    public static &amp;lt;T&amp;gt; void register(TypeLiteral&amp;lt;T&amp;gt; service, Provider&amp;lt;T&amp;gt; provider) {
        registry.put(service, provider);
    }
    public static &amp;lt;T&amp;gt; void register(TypeLiteral&amp;lt;T&amp;gt; service, Class&amp;lt;? extends T&amp;gt; impl) {
        registry.put(service, new ConcreteProvider(impl));
    }
    @SuppressWarnings({"unchecked"})
    public static &amp;lt;T&amp;gt; T resolve(TypeLiteral&amp;lt;T&amp;gt; type) {
        if (registry.containsKey(type)) {
            return (T) registry.get(type).get(type);
        } else {
            Type c = type.getRawType();
            while (c != Object.class) {
                ManualTypeLiteral&amp;lt;T&amp;gt; manualTypeLiteral = new ManualTypeLiteral&amp;lt;T&amp;gt;(c);
                if (registry.containsKey(manualTypeLiteral)) {
                    return (T) registry.get(manualTypeLiteral).get(type);
                }
                c = c.getClass().getSuperclass();
            }
            throw new RuntimeException("Not found");
        }
    }
    private static class ManualTypeLiteral&amp;lt;T&amp;gt; extends TypeLiteral&amp;lt;T&amp;gt; {
        private ManualTypeLiteral(Type type) {
            super(type);
        }
    }
    private static class ConcreteProvider&amp;lt;T&amp;gt; implements Provider {
        private final Class&amp;lt;? extends T&amp;gt; impl;
        public ConcreteProvider(Class&amp;lt;? extends T&amp;gt; impl) {
            this.impl = impl;
        }
        public T get(TypeLiteral type) {
            try {
                return impl.getConstructor().newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The implementation of the container has been simplified to make the example more clear, and is by no means a real container ready for production use. However, I think it should be fairly easy to add this kind of behavior to Guice, and I also believe that it should be well worth while because this kind of flexiblity opens the doors for a whole lot of usage patterns that we are just starting to understand the power of within the .NET community.&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=539" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/DDD/default.aspx">DDD</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Generics, Inversion of Control and Repository&lt;T&gt;</title><link>http://andersnoras.com/blogs/anoras/archive/2008/04/03/generics-inversion-of-control-and-repository-t.aspx</link><pubDate>Thu, 03 Apr 2008 23:32:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:533</guid><dc:creator>andersnoras</dc:creator><slash:comments>4</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/533.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=533</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=533</wfw:comment><description>&lt;p&gt;Whenever I stray off the beaten path of Java generics, I instantly miss C#’s generics implementation. Earlier today, Java’s type erasure erased a few good hours of productivity whilst I was doing a spike on bringing the &lt;a href="http://www.ayende.com/Blog/archive/9431.aspx"&gt;IRepository&amp;lt;T&amp;gt;&lt;/a&gt; experience to Java. In C# you can get the class of any generic type argument in a straight forward manner.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;public void DoStuff(T thing) &lt;br&gt;{    &lt;br&gt;    Type thingsType = typeof(T);&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Because of Java’s type erasure, things aren’t as simple. The Java equivalent of this C# example won’t compile.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;public &amp;lt;T&amp;gt; void doStuff(T thing) {&lt;br&gt;    Class thingsType = T.class;&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Still, all is not lost. Even if you’ve been told otherwise, some information about generic type arguments is available at runtime. While the JVM doesn’t track the type arguments for an instance of a generic class, it actually does this for subclasses of that generic class. To work around this limitation you can add the required behavior to infer a class’ type arguments to an abstract base class. &lt;a href="http://www.artima.com/weblogs/index.jsp?blogger=ianr"&gt;Ian Robertson&lt;/a&gt; has &lt;a href="http://www.artima.com/weblogs/viewpost.jsp?thread=208860"&gt;a good write up about this&lt;/a&gt; at &lt;a href="http://www,artima.com"&gt;Artima&lt;/a&gt;.Since many of the features of any repository are common, regardless of its final implementation, my initial design already had an abstract repository class and a repository interface, so using the “extend and infer” technique described in Ian’s post was OK. Basically, this allows you to do this:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;public abstract class AbstractRepository&amp;lt;T&amp;gt; implements Repository&amp;lt;T&amp;gt; {&lt;br&gt;    private Class entityClass;&lt;br&gt;    public final Class getEntityClass() {&lt;br&gt;        if (entityClass == null) {&lt;br&gt;            ReflectionHelper reflectionHelper = new ReflectionHelper();&lt;br&gt;            entityClass = reflectionHelper.getTypeArguments(&lt;br&gt;                            AbstractRepository.class,getClass()&lt;br&gt;                          ).get(0);&lt;br&gt;        }&lt;br&gt;        return entityClass;&lt;br&gt;    }&lt;br&gt;    void setEntityClass(Class entityClass) {&lt;br&gt;        this.entityClass = entityClass;&lt;br&gt;    }&lt;br&gt;    // Implementations of common repository features like&lt;br&gt;    // load, save, delete and so on go here...&lt;br&gt;}&lt;br&gt;&lt;br&gt;public class ProductRepository extends AbstractRepository&amp;lt;Product&amp;gt; {}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Since ProductRepository specifically extends the AbstractRepository, the type information will be available at runtime and the following test will pass.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Repository&amp;lt;Product&amp;gt; repository = new ProductRepository();&lt;br&gt;Class inferredEntityClass = repository.getEntityClass();&lt;br&gt;Assert.assertSame(Product.class,inferredEntityClass);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But apart form implementing an abstract class, the ProductRepository serves no real purpose. In a real-life scenario, you would probably add some operations specific to Product entities to the repository, but there is no need to do this. So, I’d really like to have a way to create instances of a repository for any entity without creating a separate implementation of the repository for each entity class.Because of the trick we’re using to infer type arguments, we cannot turn the AbstractRepository into a concrete class, but we can extend it with a concrete generic class.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;public class ConcreteRepository&amp;lt;T&amp;gt; extends AbstractRepository&amp;lt;T&amp;gt; {  }&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href="http://andersnoras.com/controlpanel/blogs/http;/www.ayende.com/blog"&gt;Ayende&lt;/a&gt; uses this approach to support different object relational mappers in &lt;a href="http://sourceforge.net/projects/rhino-tools/"&gt;his implementation of this pattern for .NET.&lt;/a&gt; However, if we try to use this approach with Java, type erasure comes in and screw things up again.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Repository&amp;lt;Product&amp;gt; repository = new ConcreteRepository&amp;lt;Product&amp;gt;();&lt;br&gt;Class inferredEntityClass = repository.getEntityClass();&lt;br&gt;// This assertion fails because the type argument (Product) has been&lt;br&gt;// erased and replaced with java.lang.Object...&lt;br&gt;Assert.assertSame(Product.class,inferredEntityClass);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To work around this, we can stick with our abstract repository and employ &lt;a href="http://gafter.blogspot.com/2006/12/super-type-tokens.html"&gt;Neil Gafter’s “gadget” aka Super Type Tokens&lt;/a&gt;.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Repository&amp;lt;Product&amp;gt; repository = new AbstractRepository&amp;lt;Product&amp;gt;() {};&lt;br&gt;// Did you notice this method in the AbstractRepository&amp;lt;T&amp;gt; class?&lt;br&gt;repository.setEntityClass(Product.class);&lt;br&gt;Class inferredEntityClass = repository.getEntityClass();&lt;br&gt;Assert.assertSame(Product.class,inferredEntityClass);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This works, but it makes the client code ugly. So you probably should cover the ugliness with some factory “makeup”.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;public static &amp;lt;T&amp;gt; Repository&amp;lt;T&amp;gt; create(Class&amp;lt;? extends T&amp;gt; entityClass) {&lt;br&gt;    AbstractRepository&amp;lt;T&amp;gt; repository = new AbstractRepository&amp;lt;T&amp;gt;() {};&lt;br&gt;    repository.setEntityClass(entityClass);&lt;br&gt;    return repository;&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now we can instantiate generic repositories this way…&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Repository&amp;lt;Product&amp;gt; repository = RepositoryFactory.create(Product.class);&lt;br&gt;Class inferredEntityClass = repository.getEntityClass();&lt;br&gt;Assert.assertSame(Product.class,inferredEntityClass);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;…and IMHO, that looks quite alright.&lt;/p&gt;&lt;p&gt;Having a good implementation of a generic repository in place opens the doors to creating adaptive domain models using the patterns and design techniques &lt;a href="http://www.ayende.com/blog"&gt;Ayende&lt;/a&gt; and &lt;a href="http://udidahan.weblogs.us/"&gt;Udi&lt;/a&gt; have &lt;a href="http://udidahan.weblogs.us/2007/09/16/fetching-strategy-nhibernate-implementation-available/"&gt;been&lt;/a&gt; &lt;a href="http://www.ayende.com/Blog/archive/2008/03/27/Adaptive-Domain-Models-with-Rhino-Commons.aspx"&gt;writing&lt;/a&gt; &lt;a href="http://udidahan.weblogs.us/2008/03/20/qcon-london-2008-recap/"&gt;quite&lt;/a&gt; &lt;a href="http://www.ayende.com/Blog/archive/9042.aspx"&gt;a lot&lt;/a&gt; &lt;a href="http://udidahan.weblogs.us/2007/03/06/better-domain-driven-design-implementation/"&gt;about&lt;/a&gt; &lt;a href="http://www.ayende.com/Blog/archive/2008/03/25/Non-Invasive-API-take-2.aspx"&gt;lately&lt;/a&gt;. The missing piece to the puzzle is better generics support from the dependency injection containers available for Java. I’m a bit surprised that there aren’t (AFIK) any containers available that support generics in a similar fashion to what &lt;a href="http://www.springframework.net"&gt;Spring.NET &lt;/a&gt; or &lt;a href="http://www.castleproject.org"&gt;Windsor&lt;/a&gt; do. To get this piece in place, I actually started something I promised myself that I’d never do again - I started to build my own inversion of control framework. Nothing is ready to be made public yet, but I’ll provide you with some examples of its &lt;i&gt;very&lt;/i&gt; limited features.You can register components by specifying its interface and implementation like this (No XML configuration for me, baby!)…&lt;/p&gt;&lt;pre&gt;&lt;code&gt;IoC.register(Repository.class, ProductRepository.class);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;…and you can resolve a dependency at a later stage by specifying the interface and its generic type argument(s).&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Repository&amp;lt;Product&amp;gt; repository = IoC.resolve(Repository.class,Product.class);&lt;br&gt;Assert.assertTrue(repository instanceof ProductRepository);&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Before you start screaming about the static methods, I’ll inform you that the IoC class is just an accessor that makes the IoC framework readily available. This is an approach I’ve been using for quite some time, and I recommend trying it for yourself. Its &lt;i&gt;very&lt;/i&gt; convenient.&lt;/p&gt;&lt;p&gt;So what do you guys think? Do we need another dependency injection framework? (No worries, I’m just doing this to support some demo code I’m writing and I have no intentions making it a fully fledged framework at the time being.)&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=533" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/DDD/default.aspx">DDD</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Reinventing+the+wheel/default.aspx">Reinventing the wheel</category></item><item><title>A framework for cross platform DSL development</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/31/a-framework-for-cross-platform-dsl-development.aspx</link><pubDate>Tue, 01 Apr 2008 10:42:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:526</guid><dc:creator>andersnoras</dc:creator><slash:comments>6</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/526.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=526</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=526</wfw:comment><description>

&lt;p class="MsoNormal"&gt;&lt;span&gt;One of the
challenges I have experienced when giving talks or blogging about domain
specific languages is that developers are a little reluctant to writing code in
languages they are unfamiliar with. This holds true even if the DSL in question
is an external DSL based on commonly available languages such as Boo, Ruby,
Groovy or Scala.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;Since I
also develop using both .NET and Java, another common challenge is that these
languages aren’t generally available on all platforms. This is a concern
because you can easily lock your self to a platform based on how you choose to
implement your DSLs. After having many discussions around this topic with
luminaries in both the Java and .NET communities, I have concluded that unless
we can address the challenges with making our DSLs true cross platform tools,
we are introducing more complexity than we’re doing good.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;One of the
reasons I’ve been a bit quite for the last few weeks is that I’ve started a new
project which will be available under the Apache 2.0 license to address these
issues and I’m very glad to introduce the Adaptive Platform Runtime for Interoperable
DSLs – April!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;To enable
true interoperability and at the same time make it easy to understand for all
developers April is based on familiar XML concepts. Below is an example of one
of the business rule example from my recent talks on external DSLs expressed
with April.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;code&gt;
&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br&gt;&amp;lt;script&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;statement&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;when&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;lhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/customtypes/customer&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;customer&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/primitivetypes/number&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;age&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/lhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;op&amp;gt;&amp;amp;lt;&amp;lt;/op&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;rhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;constant&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/primitivetypes/number&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;with_value&amp;gt;25&amp;lt;/with_value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/constant&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/rhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/when&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;then&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;statement&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;increase&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/customtypes/policy&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;policy&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/primitivetypes/number&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;premium&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;by&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;statement&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;eval&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;lhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/customtypes/policy&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/instance&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;policy&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/primitivetypes/number&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/property&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;named&amp;gt;premium&amp;lt;/named&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/to&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/reference&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/lhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;op&amp;gt;%&amp;lt;/op&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;rhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;constant&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;http://andersnoras.com/primitivetypes/number&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/of_type&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;with_value&amp;gt;25&amp;lt;/with_value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/value&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/constant&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/rhs&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/eval&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/statement&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/by&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/increase&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/statement&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/then&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/statement&amp;gt;&lt;br&gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;One key
thing to notice is that April uses its own XSD based type system. This allows
us to achieve platform portability and interoperability by abstracting away the
individual languages own type systems. To allow customized DSLs, April also
lets you redefine and extend the language using common XML representations.
This is how the “When” keyword has been introduced into the language used
above:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;o:p&gt;&lt;code&gt;&amp;nbsp;&amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;name&amp;gt;when&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;is_alias_for&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;urn:apl/core/language/keywords/conditional/if&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/is_alias_for&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;semantics&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ast&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;when&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;consisting_of&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parts&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;order&amp;gt;0&amp;lt;/order&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;allow_any&amp;gt;true&amp;lt;/allow_any&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;order&amp;gt;1&amp;lt;/order&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;operators&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;urn:apl/core/language/operator/equals&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;urn:apl/core/language/operator/greater_than&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xmlns&amp;gt;urn:apl/core/language/operator/less_than&amp;lt;/xmlns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/operator&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/operators&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;order&amp;gt;2&amp;lt;/order&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;allow_any&amp;gt;true&amp;lt;/allow_any&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/part&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/parts&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/consisting_of&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/expression&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;then&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- Eluded for brevety --&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ast&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/semantics&amp;gt;&lt;br&gt;&amp;lt;/keyword&amp;gt; &lt;br&gt;&lt;/code&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;Since
everything is XML based you can use your experiences from writing everything
form web.config files to Spring configurations to extend, customize and develop
using April.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;April’s
core audience is the domain experts who’ll use the DSLs you develop to
customize the business rules of any April enabled application. To reduce the probability
of bugs occurring within these DSLs, you can easily turn of language features
in the DSL context configuration.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;code&gt;&lt;/code&gt;&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;o:p&gt;&amp;nbsp;&amp;lt;dsl_context&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;language_features&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;new&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;print&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;keyword&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;for&amp;lt;/name&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/keyword&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/language_features&amp;gt;&lt;br&gt;&amp;lt;/dsl_context&amp;gt;&lt;br&gt;&lt;br&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;Because of
its simplicity and the use of common XML knowledge, my vision is that April
will be the killer app that will enable developers to DSL enabling their
applications today.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span&gt;The source
code will be made available at The Codehaus later today. I encourage everyone
interested in DSLs to start playing around with it, provide feedback or join
the project. Let the DSL revolution begin!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=526" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/DSL/default.aspx">DSL</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Open+Source/default.aspx">Open Source</category></item><item><title>Vibrant Ink for IDEA</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/25/vibrant-ink-for-idea.aspx</link><pubDate>Tue, 25 Mar 2008 20:50:24 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:517</guid><dc:creator>andersnoras</dc:creator><slash:comments>6</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/517.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=517</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=517</wfw:comment><description>&lt;p&gt;I&amp;#8217;m not sure if its because Java developers have a flurry of good IDEs to choose from, but IDE pimping is a rare hobby among Java developers. However, since I&amp;#8217;m a polyglot developing stuff in a range of languages I enjoy having a familiar, nice look and feel across all the tools I use. When I swapped my Windows for a Mac, I instantly fell in love with TextMate&amp;#8217;s celebrated &lt;a href="http://alternateidea.com/blog/articles/2006/1/3/textmate-vibrant-ink-theme-and-prototype-bundle"&gt;Vibrant Ink theme&lt;/a&gt;. (Fun fact: This blog post is written in TextMate, using Vibrant Ink). I use &lt;a href="http://www.iunknown.com/"&gt;John Lam&lt;/a&gt;&amp;#8217;s &lt;a href="http://www.iunknown.com/2007/06/vibrant_ink_vis.html"&gt;port of the theme&lt;/a&gt; with Visual Studio, but whenever I wrote Java code I was left out in the cold with IntelliJ IDEAs plain old black, blue, red and green on white theme. As you can imagine, this was unbearable for someone used to using tricked out OSes and development tools, so I had to create a port myself.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-25_virbant_1.png" alt="Virbant 1" title=""&gt;&lt;/p&gt;

&lt;p&gt;Volia! Here is the Vibrant Ink theme for IDEA in glorious technicolor. The above screenshot showcases the various features, and (luckily) regular code seldom gets this colorful. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-25_vibrant_2.png" alt="Vibrant 2" title=""&gt;&lt;/p&gt;

&lt;p&gt;If you fancy pimping your IDEA with a touch of cool, you can grab a jar file with my color scheme from &lt;a href="http://idehotornot.ning.com/index.php/index/show?id=37587491"&gt;&amp;#8220;Is your IDE Hot or Not?&amp;#8221;&lt;/a&gt; or directly from &lt;a href="http://andersnoras.com/files/folders/code/entry514.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Gansta! Yo&amp;#8217;ve gots ta git this themizzle, it tha real shiznits.&lt;br /&gt;
  Snoop Doggy Dog&lt;/p&gt;
&lt;/blockquote&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=517" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category></item><item><title>English as a DSL</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/13/english-as-a-dsl.aspx</link><pubDate>Thu, 13 Mar 2008 22:25:10 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:496</guid><dc:creator>andersnoras</dc:creator><slash:comments>5</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/496.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=496</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=496</wfw:comment><description>&lt;blockquote&gt;
  &lt;p&gt;&amp;#8220;Programming is best regarded as the process of creating works of literature, which are meant to be read&amp;#8230; so we ought to address them to people, not to machines.&amp;#8221;  &lt;/p&gt;
&lt;/blockquote&gt;&lt;br /&gt;
-Donald Knuth, Literate Programming


&lt;p&gt;The last few days there has been a vibrant discussion on which computer science books that deserve its place on the top 10 bookshelf over &lt;a href="http://www.java.no"&gt;at The Norwegian JUG&lt;/a&gt;. A title that quickly sprung to mind was &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FPragmatic-Programmer-Journeyman-Master%2Fdp%2F020161622X%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1205445996%26sr%3D8-1&amp;amp;tag=andersnorasbl-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;Pragmatic Programmer: From Journeyman to Master&lt;/a&gt; by &lt;a href="http://pragdave.blogs.pragprog.com/"&gt;Dave Thomas&lt;/a&gt; and Andy Hunt. This is one of the few books that you can read from cover to cover, over and over again and pick up new things every time. Because I love this book, it feels a little scary to pick a discussion with one of the authors, but Dave&amp;#8217;s latest blog &lt;a href="http://pragdave.blogs.pragprog.com/pragdave/2008/03/the-language-in.html"&gt;post on domains specific languages&lt;/a&gt; provoked me to do this.&lt;/p&gt;

&lt;p&gt;In his blog post, Dave makes the point that something isn&amp;#8217;t necessarily a DSL just because it reads like English. I agree with him on this, but this does not imply that English can&amp;#8217;t be used to describe business rules. In my talk on developing domain specific languages with .NET, I used an example from the insurance industry as a foundation for the alternative approaches for implementing a DSL. Insurance is a business I know well since I work for one of the largest insurance companies in the Nordic region. Just like Dave points out, our domain specialists have a common understanding of the meaning of the different terms in their jargon. In &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FDomain-Driven-Design-Tackling-Complexity-Software%2Fdp%2F0321125215%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1205446065%26sr%3D1-1&amp;amp;tag=andersnorasbl-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;Domain Driven Design&lt;/a&gt;, Eric Evans describes this as the &lt;a href="http://domaindrivendesign.org/discussion/messageboardarchive/UbiquitousLanguage.html"&gt;ubiquitous language&lt;/a&gt;. In my experience, having a shared understanding of the jargon between business and technical team members and using this jargon to model the software is crucial before on can introduce domain specific languages into the development process.&lt;/p&gt;

&lt;p&gt;My example is a very narrow slice of the business rules for adjusting the risk of a car insurance quote. Still it is very representative for this kind of application. We begin our tale with a simple user story;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-13_userstory019.png" alt="Userstory.019" title=""&gt;&lt;/p&gt;

&lt;p&gt;If we write our requirements in this manner, a natural progression is to write our functional tests in a behavior driven style. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Scenario(“Customer is an inexperienced driver”);
    Given(“The policy’s premium is”, 1000, delegate(double premium)
    {
        policy = new Policy();
        policy.Premium = premium; 
    });
    Given(“The customer’s age is”, 24, delegate(int age)
    {
        policy.Holder = new Customer();
        policy.Holder.Age = age; 
    });
    When(“A quote for an insurance is issued”, delegate()
    {
        quote = policy.IssueQuote();
    });
    Then(“The policy’s premium should be increased by percentage”, 5, delegate(double percentage)
    {
        Assert.AreEqual(policy.Premium *= 1 + (5 / 100), quote.Premium);
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This code is written using &lt;a href="http://agilejoe.com/"&gt;Joe Oscampo&lt;/a&gt;&amp;#8217;s &lt;a href="http://code.google.com/p/nunitbehave/"&gt;NUnit.Behave&lt;/a&gt; which I claim is an internal DSL, written in C#, for functional testing. Spec frameworks like NUnit.Behave is one of the things Dave &amp;#8220;picks on&amp;#8221; in his post with a valid argument that the domain experts using this DSL are programmers and that writing a specification using the such a framework is programming. This is true, but I think Dave misses a key value of using this approach; even if the specification is littered with C# enforced dots, brackets and parenthesis it is very similar to the free-form user story the spec is derived from. This helps us follow a thread through from the user story through to the specification. If the framework didn&amp;#8217;t enforce a grammatical structure, this would be much harder to achieve. 
Another thing with Dave&amp;#8217;s problem with the host language shining through and hindering him in writing straight forward sentences can be turned into a benefit for fluent interfaces. &lt;a href="http://obiefernandez.com/"&gt;Obie Fernadez&lt;/a&gt; once used the Starbucks jargon to show how to write an internal DSL with Ruby. I&amp;#8217;ve used his example to show how one can implement a fluent interface with C#. This example is a variety of the &lt;a href="http://en.wikipedia.org/wiki/Specification_pattern"&gt;specification pattern&lt;/a&gt;, and it is very helpful for object creation.
Imagine that you have a number of different coffee drinks such as espresso, latte and capuchino which all extend a common base class. There are different ways to prepare each of these drinks and hence you need to know what to put into them when you make them. Using traditional object oriented programming, you would first have to figure out which drinks are available by looking up the classes extending the Drink base class, and then you would need to identify the specific options for each drink by looking at its constructor overloads.
When using an internal DSL to create Drink instance, we can use the language to show the developer which options are available and since almost every IDE has some form of IntelliSense, these options will be very visible to the developer.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-13_fluentinterface.png" alt="Fluentinterface" title=""&gt;&lt;/p&gt;

&lt;p&gt;The value of using this approach is that it is much more readable than regular code and it gives the users (who are developers) an expressive API. Another thing Dave complains about is the use of noise words, like articles, in such DSLs. In this one I&amp;#8217;m using the indefinite article &amp;#8220;a&amp;#8221;. The only reason this is there is that it serves as a starting point for out sentence, and I agree with Dave that there is no real reason to allow users to insert words like &amp;#8220;a&amp;#8221; or &amp;#8220;the&amp;#8221; in the middle of a &amp;#8220;sentence&amp;#8221; to make it feel more like proper English. Still I&amp;#8217;m obsessed with aesthetics and if an definite article was the only thing missing before an API look perfect, I&amp;#8217;d probably add it just to make it look better. &lt;/p&gt;

&lt;p&gt;Allowing noise words in the language brings us to the extreme variety the DSL implementations I show during the talk - the plain English business rule. When use use user stories for our requirements and behavior driven development for testing, why can&amp;#8217;t we just state our business rules like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;When the policy holder's age is less than 25, increase the policy's premium by 5%.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is code and it is compiled using Microsoft&amp;#8217;s Dynamic Language Runtime and runs on the CLR. On thing to note is that this language is very specific, and has a limited set of operations. There is no way you can write &amp;#8220;Hello World&amp;#8221; with this language. Mandating a strict, limited grammar is a way to work around the ambiguities of natural language. Of course we can&amp;#8217;t be too strict, so we&amp;#8217;ll also have to allow things like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;When the policy's exposure has a burglar alarm, decrease the policy's selfrisk by 200.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If we translate this to plain old C#, we&amp;#8217;ll end up with this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;// First example...
if (policy.holder.age &amp;lt; 25)
{
    policy.premium *= 1.05;
}

// Second...
if (policy.exposure.has("a burglar alarm"))
{
    policy.selfrisk -= 200;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#8220;When&amp;#8221; is a keyword, &amp;#8220;the policy holder&amp;#8217;s age&amp;#8221; is a reference, &amp;#8220;is less than&amp;#8221; is an operator, &amp;#8220;25&amp;#8221; is a constant and so forth. All that is required is to parse it, emit and AST for the DLR and run it. Nothing is different from how general purpose languages work, which isn&amp;#8217;t strange because even if these are true English sentences, writing them is programming.&lt;/p&gt;

&lt;p&gt;The great thing about having things that are as readable as these code snippets is that it makes it easier to sit down with domain experts and use actual, running code as the basis for discussion. That said, I&amp;#8217;m fully agree that the use of English doesn&amp;#8217;t make things a DSL. Focusing on the domain model and developing a language that only takes into account the problems within that domain however does. If it makes sense to model your language around English language constructs, do it! This will make it easier for both developers and business people to understand business related code.
It takes a lot of effort to roll your own language as shown above, so from an economical perspective, you are better of piggybacking on another language. The Boo based variety of the same example looks like this.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;when policy.holder.age &amp;lt; 25:
    increasePremiumByPercentage 5
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It might be broken English, but it serves its purpose and it is most definitely a DSL.&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=496" width="1" height="1"&gt;</description></item><item><title>Videos from Heroes happen {here}</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/12/videos-from-heroes-happen-here.aspx</link><pubDate>Wed, 12 Mar 2008 19:57:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:491</guid><dc:creator>andersnoras</dc:creator><slash:comments>2</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/491.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=491</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=491</wfw:comment><description>&lt;p&gt;Last week &lt;a href="http://andersnoras.com/blogs/anoras/archive/2008/03/09/hero-happend-there.aspx"&gt;I was awarded the MSDN Guru&lt;/a&gt; award at the&lt;a href="http://www.microsoft.com/norge/campaigns/heroeshappenhere/"&gt; Heroes happen {here}&lt;/a&gt; event in Oslo. The &lt;a href="http://andersnoras.com/controlpanel/blogs/null"&gt;videos&lt;/a&gt; from the show have been posted and you can watch me accepting the award, giving the obligatory thank you speech and getting interview below. If you can’t understand what’s being said, it’s because its in Norwegian…&lt;/p&gt;&lt;p&gt;&lt;embed width="432" height="364" type="application/x-shockwave-flash" src="http://www.videout.no/videoplayer.swf?ooid=0f0cff3bf22b67410cfb505476fc4b85"&gt; &lt;/p&gt;&lt;p&gt;Expect for the interview, which is a little embarrassing to watch, it turned out quite alright IMHO.&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=491" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Notebook Fetish</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/10/notebook-fetish.aspx</link><pubDate>Mon, 10 Mar 2008 22:22:00 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:483</guid><dc:creator>andersnoras</dc:creator><slash:comments>6</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/483.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=483</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=483</wfw:comment><description>&lt;p&gt;After giving &lt;a href="http://andersnoras.com/blogs/anoras/archive/2008/02/22/next-week-s-speaking-schedule.aspx"&gt;my talk on language oriented development with .NET&lt;/a&gt; for the Oslo chapter of the &lt;a href="http://www.nnug.no"&gt;Norwegian .NET User Group&lt;/a&gt; I was approached by one of the attendants who pointed out that I had excellent taste in notebooks. Most people though he was referring to my shiny MacBook Pro, but he had this slide in mind…&lt;/p&gt;&lt;p&gt;&lt;img alt="Moleskine" title="" src="http://andersnoras.com/blogs/anoras/2008-03-10_moleskine.png"&gt;&lt;/p&gt;&lt;p&gt;The notebook is an &lt;a href="http://www.moleskine.com/index_eng.php"&gt;Moleskine&lt;/a&gt; notebook, the kind used by great artists like Ernest Hemmingway, Pablo Picasso and computer programmer Anders Norås. I always carry one of these in my pocket and I constantly jot down various thoughts, ideas and similar. Some pearls from the last few days;&lt;/p&gt;&lt;blockquote&gt;  &lt;p&gt;I ride the bus to work every day, but I’m not reusing the bus - I’m &lt;i&gt;using&lt;/i&gt; it!  However, whenever I tip the bus over and set fire to it to build a barricade to keep the IBM sales force at bay, I’m reusing the bus.  -&lt;a href="http://www.brodwall.com/johannes/blog/"&gt;Johannes Brodwall&lt;/a&gt; during a discussion we had on the myths of “reuse”.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;I’ve also got a magic quadrant with the axes Good &amp;lt;-&amp;gt; Evil &amp;amp; Pretty &amp;lt;-&amp;gt; Ugly which I drew while discussing folklore with a friend who works in marketing on the way to work. This one will find its way into one of my talks, because it fits so nicely with the whole behavior driven development story. Wait and see…&lt;/p&gt;&lt;p&gt;The thing is that an old fashioned, analogue notebook is one of the best tools you can carry around. I’ve chosen this make because the quality is unprecedented. There are lots of people with strong feelings for Moleskines. There are &lt;a href="http://wiki.43folders.com/index.php/Moleskine_Hacks"&gt;numerous&lt;/a&gt; &lt;a href="http://www.bbc.co.uk/dna/h2g2/alabaster/A1113346"&gt;hacks&lt;/a&gt; &lt;a href="http://www.43folders.com/2004/11/18/more-moleskine-hacks"&gt;for&lt;/a&gt; &lt;a href="http://loosewire.typepad.com/blog/2005/01/the_moleskine_m.html"&gt;them&lt;/a&gt; &lt;a href="http://www.jerrybrito.com/2004/11/22/moleskine-gtd-tabs-hack/"&gt;on&lt;/a&gt; &lt;a href="http://pigpog.com/node/1303"&gt;the&lt;/a&gt; &lt;a href="http://www.organizeit.co.uk/2007/05/14/collection-of-moleskine-hacks/"&gt;web&lt;/a&gt;, the books have their &lt;a href="http://detour.moleskinecity.com/index.php/2008/01/15/the-first-annual-moleskinerie-exhibit/"&gt;own annual exhibition&lt;/a&gt; and there are even &lt;a href="http://www.moleskinerie.com/"&gt;blogs dedicated to them&lt;/a&gt;.The thing is that there is nothing that can compare with the expressive power of a good notebook. Look at these beautiful notes about agile methodologies by ThoughtWorker &lt;a href="http://josh.ev9.org/weblog/"&gt;Josh Evnin&lt;/a&gt;:&lt;/p&gt;&lt;p&gt;&lt;img alt="2273254160 e 82996a 385" title="" src="http://andersnoras.com/blogs/anoras/2008-03-10_2273254160_e_82996a_385.jpg"&gt;&lt;/p&gt;&lt;p&gt;&lt;img alt="2272460781 8c 5b 436487" title="" src="http://andersnoras.com/blogs/anoras/2008-03-10_2272460781_8c_5b_436487.jpg"&gt;&lt;/p&gt;&lt;p&gt;For more &lt;a href="http://josh.ev9.org/weblog/archives/565"&gt;visit his blog.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Tag you’re it! How do you make notes?&lt;/p&gt;&lt;p&gt;&lt;a href="http://kjellsj.blogspot.com/"&gt;Kjell-Sverre Jerijærvi&lt;/a&gt;&lt;a href="http://stephan.reposita.org/"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://stephan.reposita.org/"&gt;Jermemy Miller&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.brodwall.com/johannes/blog/"&gt;Johannes Brodwall&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://stephan.reposita.org/"&gt;Stephan Scmidt&lt;/a&gt;&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=483" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Musings/default.aspx">Musings</category></item><item><title>Babysteps in Scala</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/10/babysteps-in-scala.aspx</link><pubDate>Mon, 10 Mar 2008 21:11:09 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:480</guid><dc:creator>andersnoras</dc:creator><slash:comments>4</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/480.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=480</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=480</wfw:comment><description>&lt;p&gt;There are always some Java developers who attend whenever I give my .NET DSL talk. This is super cool, and at it makes for some new challenges. The most common one is &amp;#8220;How can we do these things with Java&amp;#8221;. Since the JavaZone guys have introduced an emerging languages track and extended their call for papers deadline to next month, I figured &amp;#8220;porting&amp;#8221; the talk to the Java platform would be cool. The downside* is that, until somebody writes &amp;#8220;Boo4J&amp;#8221;, I have to learn some more &amp;#8220;Java&amp;#8221; languages to explore the possibilities. I&amp;#8217;ve spent a couple of evenings with Scala, and I&amp;#8217;m really pleased with what I&amp;#8217;ve got so far&amp;#8230;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-10_scala_dsl.png" alt="Scala dsl" title=""&gt;&lt;/p&gt;

&lt;p&gt;Being used to mainly using imperative languages, I had to learn a couple of new tricks to get this thing running. The first was how one can pass a first-class function as a by-name parameter. This is used for the predicates. The other was how to use currying to make the &lt;em&gt;when&lt;/em&gt; function look like a keyword. The cool thing was that this was super duper simple. All in all, less than 20 (!) lines of code was required. Looks like I&amp;#8217;m catching the Scala bug too&amp;#8230;&lt;/p&gt;

&lt;p&gt;*Well, learning new languages isn&amp;#8217;t really a downside&amp;#8230; &lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=480" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Java/default.aspx">Java</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/DSL/default.aspx">DSL</category><category domain="http://andersnoras.com/blogs/anoras/archive/tags/Scala/default.aspx">Scala</category></item><item><title>Hero happend {there}</title><link>http://andersnoras.com/blogs/anoras/archive/2008/03/09/hero-happend-there.aspx</link><pubDate>Sun, 09 Mar 2008 22:26:49 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:479</guid><dc:creator>andersnoras</dc:creator><slash:comments>1</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/479.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=479</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=479</wfw:comment><description>&lt;p&gt;&lt;img src="http://andersnoras.com/blogs/anoras/2008-03-09_herobeer.jpg" height="150" alt="HeroBeer" align="left" title=""&gt; On Thursday I was award the &amp;#8220;MSDN Guru&amp;#8221; award during the Norwegian Heroes Happen {here} launch event. This was fun, and I just want to thank the people who nominated me for the award. I feel very humble to be the winner among the other nominees, they where all great candidates.
By the way, the picture shows a bottle of the specially brewed Heros happen {here} beer. Just too bad Microsoft run out of it early. Still it was a good party! Thanks!&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=479" width="1" height="1"&gt;</description><category domain="http://andersnoras.com/blogs/anoras/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Thank you Google!</title><link>http://andersnoras.com/blogs/anoras/archive/2008/02/28/thank-you-google.aspx</link><pubDate>Fri, 29 Feb 2008 07:39:03 GMT</pubDate><guid isPermaLink="false">719912c1-f1f1-4ca9-83e8-cfd07bb165d8:473</guid><dc:creator>andersnoras</dc:creator><slash:comments>2</slash:comments><comments>http://andersnoras.com/blogs/anoras/comments/473.aspx</comments><wfw:commentRss>http://andersnoras.com/blogs/anoras/commentrss.aspx?PostID=473</wfw:commentRss><wfw:comment>http://andersnoras.com/blogs/anoras/rsscomments.aspx?PostID=473</wfw:comment><description>&lt;p&gt;I got these blog recommendations in Google Reader this morning&amp;#8230;
&lt;img src="http://andersnoras.com/blogs/anoras/2008-02-29_greader_suggestions.png" alt="GReader Suggestions" title=""&gt;&lt;/p&gt;

&lt;p&gt;&amp;#8230;if you recommend this blog to someone who isn&amp;#8217;t writing it, that would be even better!&lt;/p&gt;&lt;img src="http://andersnoras.com/aggbug.aspx?PostID=473" width="1" height="1"&gt;</description></item></channel></rss>