<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Musings of a Trained Monkey: Code Generation STILL in Action</title>
    <link>http://www.stevelongdo.com/articles/2007/02/17/code-generation-still-in-action</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Code Generation STILL in Action</title>
      <description>&lt;p&gt;&lt;strong&gt;&lt;del&gt;&amp;#8212;&lt;/del&gt; The Past &lt;del&gt;&amp;#8212;&lt;/del&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;Jack Herrington wrote a book &lt;a href="http://www.manning.com/herrington/"&gt;Code Generation in Action&lt;/a&gt; way back in 2003.  It took advantage of the little programming language that could, &lt;a href="http://ruby-lang.org"&gt;Ruby&lt;/a&gt;.  I remember having a discussion with a colleague back then about the value of generated code.  We were of the opinion then that it would only apply to simple repetitive cases and wouldn&amp;#8217;t make much of an impact.&lt;/p&gt;


	&lt;p&gt;If only I could go back in time and slap both myself and my colleague in the face!   We missed out on being early adopters of time saving technology.  In fact almost everyone using Java was already taking advantage of code generation whether they realized it or not , Eclipse would generate getters and setters and had its refactoring capabilities, &lt;a href="http://springframework.org"&gt;Spring&lt;/a&gt; was beginning to handle externalizing dependencies, and the then fledgling &lt;a href="http://hibernate.org"&gt;Hibernate Framework&lt;/a&gt; was manipulating bytecode to enhance  Java methods.&lt;/p&gt;


	&lt;p&gt;At the same time my colleague and I were hammering out code with the tried and true &lt;em&gt;cut-n-rape&lt;/em&gt; technique that had been popular since before we were born.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;del&gt;&amp;#8212;&lt;/del&gt; Modern Day &lt;del&gt;&amp;#8212;&lt;/del&gt;&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;I have the &lt;strong&gt;&amp;#8220;opportunity&amp;#8221;&lt;/strong&gt; to work on porting some old JSPs which, in true 20&lt;sup&gt;th&lt;/sup&gt; century Model 1 style, link directly to each other and the database via scriptlets, to a more modern Java &lt;span class="caps"&gt;MVC&lt;/span&gt; framework.  Rather than just wade in blindly, manually translating &lt;span class="caps"&gt;JSP&lt;/span&gt; scriptlet page to Java &lt;span class="caps"&gt;MVC&lt;/span&gt; framework code, I decided to make the project interesting and have been writing a &lt;a href="http://ruby-lang.org"&gt;Ruby&lt;/a&gt; JSP parser/code generator. It can identify scriptlet code and extract it for me. I have been enhancing the parser to handle generation of &lt;a href="http://springframework.org"&gt;Spring &lt;span class="caps"&gt;MVC&lt;/span&gt;&lt;/a&gt; code and am working on having it generate &lt;a href="http://www.springframework.org/webflow"&gt;Spring Web Flow&lt;/a&gt; flows from reading the form action attributes in the JSPs to model application flows.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://video.google.com/videoplay?docid=1541014406319673545&amp;#38;hl=en"&gt;Here is a 2006 appearance by Jack Herrington at Google on the subject of Code Generation that is worth a watch.&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 17 Feb 2007 15:30:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5b9cec95-f18e-46d9-8296-2c26cfdc6210</guid>
      <author>Steve Longdo</author>
      <link>http://www.stevelongdo.com/articles/2007/02/17/code-generation-still-in-action</link>
      <category>java</category>
      <category>ruby</category>
      <category>code</category>
      <category>spring</category>
    </item>
  </channel>
</rss>
