<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>let x=x &#187; framework</title>
	<atom:link href="http://www.crazymcphee.net/x/tag/framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Fri, 27 Jan 2012 09:36:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Spring, JPA/JTA, and multiple persistence units, with view transactions</title>
		<link>http://www.crazymcphee.net/x/2011/10/13/spring-jpajta-and-multiple-persistence-units-with-view-transactions/</link>
		<comments>http://www.crazymcphee.net/x/2011/10/13/spring-jpajta-and-multiple-persistence-units-with-view-transactions/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 13:31:32 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=655</guid>
		<description><![CDATA[I have grappled with this topic before. Tonight, after 13 hours of struggle, I finally got my web app perfected in this regard. It all started when I needed to start the Transaction out in the view, i.e. as soon as the resource is opened on the HTTP side (rather than when the database service [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://www.crazymcphee.net/x/2011/02/16/come-back-gavin-king-all-is-forgiven-spring-is-the-new-ejb-2-1/">grappled with this topic</a> before. Tonight, after 13 hours of struggle, I finally got my web app perfected in this regard.</p>
<p>It all started when I needed to start the Transaction out in the view, i.e. as soon as the resource is opened on the HTTP side (rather than when the database service layer is called). I&#8217;m using JPA for a number of reasons;</p>
<ol>
<li>I need to access multiple databases each with a different schema (this means different connections)</li>
<li>They need to have XA transactions.</li>
<li>I&#8217;d like the transactions managed by the container (JTA).</li>
</ol>
<p>JPA provides all these things easily without all the complex Hibernate.xbm.xml mapping files and what-have-you.</p>
<p>The trick to starting the transaction with the web session is to use spring&#8217;s <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">OpenEntityManagerInViewFilter</span>. Unfortunately I was using  <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">PersistenceAnnotationBeanPostProcessor</span> to manage my multiple persistence units. The filter wants to know what <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">EntityManagerFactory </span>it should bind to, and fair enough. But with my minimal configuration, there was no addressable EntityManagerFactory!</p>
<p>The solution was to stop the <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">PersistenceAnnotationBeanPostProcessor <span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; white-space: normal;">from doing the JNDI look ups and bind each PersistenceUnit into the Spring context with a manual JNDI lookup;</span></span></p>
<pre>  &lt;tx:annotation-driven /&gt;
  &lt;tx:jta-transaction-manager /&gt;

  &lt;bean id="pabpp" 
   class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;</pre>
<pre>
  &lt;jee:jndi-lookup id="onePU" jndi-name="persistence/onePU" /&gt;
  &lt;jee:jndi-lookup id="twoPU" jndi-name="persistence/twoPU" /&gt;
  &lt;jee:jndi-lookup id="threePU" jndi-name="persistence/threePU" /&gt;</pre>
<p>then, in the web.xml the ViewFilter could be bound explicitly to the required persistence unit, in this case &#8220;onePU&#8221;. A fuller explanation can be found on my spring source forum post here; <a href="http://forum.springsource.org/showthread.php?115844-OpenEntityManagerInViewFilter-with-JPA-PersistenceAnnotationBeanPostProcessor">http://forum.springsource.org/showthread.php?115844-OpenEntityManagerInViewFilter-with-JPA-PersistenceAnnotationBeanPostProcessor</a></p>
<p>Overall, this is now quite an elegant solution.</p>
<p><strong>UPDATE</strong>. More documentation of the solution and the various configurations at the Spring forum here: <a href="http://forum.springsource.org/showthread.php?115587-Example-for-using-two-databases-w-Spring-amp-JTA-transaction-manager&amp;p=383432#post383432">http://forum.springsource.org/showthread.php?115587-Example-for-using-two-databases-w-Spring-amp-JTA-transaction-manager&amp;p=383432#post383432</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2011/10/13/spring-jpajta-and-multiple-persistence-units-with-view-transactions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST-based architectural style, a big winner</title>
		<link>http://www.crazymcphee.net/x/2011/09/15/rest-based-architectural-style-a-big-winner/</link>
		<comments>http://www.crazymcphee.net/x/2011/09/15/rest-based-architectural-style-a-big-winner/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 09:45:09 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[emergent design]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[refactor]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=629</guid>
		<description><![CDATA[Recently been deeply stuck in building software (apart from starting my PhD part-time). A long time ago I wrote about dynamically loading Spring contexts and component discovery &#8211; this system I&#8217;ve been building is an evolution of that one. We decided to adopt an most REST-based style to integrate between our components. Now, &#8220;run-time&#8221; discovery [...]]]></description>
			<content:encoded><![CDATA[<p>Recently been deeply stuck in building software (apart from starting my <a href="http://monumentum.tumblr.com/">PhD</a> part-time). A long time ago I wrote about <a href="http://www.crazymcphee.net/x/2010/04/29/dynamically-loading-spring-contexts-from-the-classpath-at-runtime/">dynamically loading Spring contexts and component discovery</a> &#8211; this system I&#8217;ve been building is an evolution of that one. We decided to adopt an most REST-based style to integrate between our components. Now, &#8220;run-time&#8221; discovery and configuration is easy, a matter of scraping REST URLs for the resources they contain (or even, just assuming a resource URL will be available and finding out its capabilities, or even its unavailability. at run-time). We&#8217;re using this architecture in places where you&#8217;d otherwise be employing messaging-based systems or pure-Java database service layers. Now we just convert the payload to XML/JSON and POST/PUT/GET/DELETE etc to a http URL! You&#8217;d think that this would kill performance, but we&#8217;ve found the degradation to be minimal (it helps that our transactions tend to be infrequent, but large in data set size). This is a big saving on complexity for our system &#8211; the transaction boundaries nearly always relate to the http URL calls so no more heavy reliance on things like <a href="http://www.crazymcphee.net/x/2011/02/16/come-back-gavin-king-all-is-forgiven-spring-is-the-new-ejb-2-1/">XA transactions and JTA Transaction Managers</a>. We still have them, as we need them in a couple of places for the moment, but it&#8217;s no longer such a big freaking deal for us in every situation.</p>
<p>Our system has generic components which &#8220;pass off&#8221; specific knowledge of specific data sets to specific processing components, where there are not a fixed set of these specific components available to all the generic components. In classic OO design this is achieved with interfaces and many design patterns like the Visitor Pattern. In our design we&#8217;ve replaced much of the complexity of the interface with REST-based architecture. Our application has become far more modular (despite its run-time complexity). More importantly, we are at the the point where we can easily start delivering the advanced features that the business has now specified for us without introducing a massive bloat-o-burger one-size-fits-all set of &#8220;common data definitions&#8221; that are the union of all possible sub-system functionalities.  Each sub-system can have its specific features required for that data set and still satisfy the handful of generic actions it is required to support. Each of these specific features can be developed in isolation. It&#8217;s a big win for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2011/09/15/rest-based-architectural-style-a-big-winner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>REST and SOA and Agile and Waterfall</title>
		<link>http://www.crazymcphee.net/x/2010/12/21/rest-and-soa-and-agile-and-waterfall/</link>
		<comments>http://www.crazymcphee.net/x/2010/12/21/rest-and-soa-and-agile-and-waterfall/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 08:26:07 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[profession]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[soa]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=595</guid>
		<description><![CDATA[Recently I&#8217;ve been working on two projects. They are an exercise in contrasts. First the technologies and the development methodologies. So the first company uses a very Waterfall process and the integration platform is SOA. We&#8217;ve managed to build, in the middle of this, a small and focussed Java component that uses JMS in and [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working on two projects. They are an exercise in contrasts.</p>
<p>First the technologies and the development methodologies.</p>
<p>So the first company uses a very Waterfall process and the integration platform is SOA. We&#8217;ve managed to build, in the middle of this, a small and focussed Java component that uses JMS in and out to avoid building horrible <em>horrible</em> BPEL or BPMN etc. But at either end, there&#8217;s some SOA bits to manage the integration with the &#8220;legacy&#8221;. So we&#8217;ve got this great bit of software, does amazing things, delivers real value to the business, which they want to put into production asap, but at every turn we&#8217;re hampered by the organisation or the technology platform. Its not so much the technology platform but the waterfall process the company has put around it. I&#8217;ve been told an internal wiki article detailing all the JMS  configuration is not  acceptable and the detail had to be in a Word document attached to an email requesting a not-production server configuration change. Word documents attached to emails are apparently far more &#8220;controllable&#8221; than a wiki with strong authentication protocols and history details in this world-view. Naturally I cut and pasted my wiki configuration detail into a Word document, spent a morning formatting it, and even added a link to the wiki before attaching it to an email. Acceptable process; configuration delivered. SOA and waterfall go together to make software development hell.</p>
<p>The second project has its many issues but one thing it does not have (for the components I have designed at least) is any SOA. It is all REST all the way down. There are multiple server-side-only components that all communicate to each other with REST over HTTP. Some of the data passed between servers is (or soon will be) JSON. The user interface is about to be delivered in two parts &#8211; one through actual REST-inspired web page requests to get the HTML and the other, via JQuery running on the web pages to actual JSON over REST services. These services will also call the REST services on the other components of the system (no database at the UI level). In fact many of the same JSON documents will be used to communicate from server to server as from ui to server. We are using Jersey for the REST. The process is Agile. The organisation hasn&#8217;t delivered such a large project with Agile before, and while I&#8217;ve been away on the other project there&#8217;s been some loss of focus. But despite some critical moments we had last week there&#8217;s been a renewed commitment to improving the engineering and project processes to achieve high velocity and good success. Its not perfect but it feels like the senior managers want the agile process to succeed. So, REST and Agile go together to make developer success.</p>
<p>Now, to the organisations. See if you can match the organisational description to the project style.</p>
<p>One of these two projects is a really fascinating piece of software in the transport industry (I can&#8217;t say more than that) which is integrating a number of &#8220;old&#8221; software solutions and creating some really sexy new features that the customer wants and loves. It is across what Eric Evans calls the &#8220;core domain&#8221; of the business. Not only is it a relatively short piece of work, but it will deliver high value to the business. It also enables a bunch of even higher value business services in the future. Things that directly expand their capabilities they can offer to their customers (which will be many of my readers) and do other related sexy things core to the business. The business salivate over it. It buffs their shine. They want it.</p>
<p>The other project is a little less flashy. The product is a rather niche product but it&#8217;s purpose is around the environmental effects of carbon emissions so at it&#8217;s core is the mission &#8220;save the planet from CO2&#8243; &#8212; a pretty high value mission you&#8217;d think. However the actual functions of the software product are fairly mundane &#8211; based around helping large organisations capture and control data about their carbon emissions, because many of them have been required now to report these numbers to government agencies for a number of years. It has customers, all of then big companies or government agencies, and all the future prospects are similar sorts of organisations.</p>
<p>Which one is which? Which one uses REST/Agile, and which one is the SOA/Waterfall project? Do you think you can guess?</p>
<p>Would you be surprised if I said that the &#8220;sexy&#8221; transport project is the first one (SOA/Waterfall) and the second one is the REST/Agile project?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2010/12/21/rest-and-soa-and-agile-and-waterfall/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tapestry 5 web framework</title>
		<link>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/</link>
		<comments>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 12:09:18 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tapestry]]></category>
		<category><![CDATA[tapestry5]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web framework]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=443</guid>
		<description><![CDATA[Lately I&#8217;ve been writing a Tapestry 5 based web application. I&#8217;ve used it before for a smaller application but this is the first time I&#8217;ve used it on a larger project. In a number of ways it is a very powerful framework to write web applications. The basics of Tapestry is that it is a [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been writing a <a href="http://tapestry.apache.org/tapestry5/" target="_blank">Tapestry 5</a> based web application. I&#8217;ve used it before for a smaller application but this is the first time I&#8217;ve used it on a larger project. In a number of ways it is a very powerful framework to write web applications.</p>
<p>The basics of Tapestry is that it is a component-based web framework. Just about everything, including web pages, are components. Components may contain other components. The way it works is very simple and quite elegant, once you get used to it and weaned off the big-XML-file style of configuring a web application.</p>
<p>When you start, you have two main Java packages that are created for you (if you use the maven archetype, otherwise you will create these packages yourself). If your package root is say &#8220;net.crazymcphee.webapp&#8221;, then your two packages are &#8220;net.crazymcphee.webapp.pages&#8221; and &#8220;net.crazymcphee.webapp.components&#8221;. To configure a Tapestry 5 project with maven <a href="http://tapestry.apache.org/tapestry5/quickstart/">use this command</a> and answer the prompts:</p>
<pre>mvn archetype:generate \</pre>
<pre>    -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository</pre>
<p>Don&#8217;t use the one in the <a href="http://tapestry.apache.org/tapestry5/tutorial1/first.html">tutorial</a> as it will not work! This is an excellent illustration of the first and most serious problem that Tapestry 5 has: the documentation not only has massive lacunas, it is also sometimes wrong and not updated.</p>
<p>Now, any class that you create in the &#8220;pages&#8221; package will automatically become a page in your application. But these classes need not be very complex at all. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.crazymcphee.webapp.pages</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Collections</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.annotations.Persist</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.annotations.Property</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.tapestry5.ioc.annotations.Inject</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.crazymcphee.webapp.model.Person</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">net.crazymcphee.webapp.services.PersonService</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Persons <span style="color: #009900;">&#123;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">private</span> PersonService personService<span style="color: #339933;">;</span>
    @Property
    @Persist
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">List</span> persons<span style="color: #339933;">;</span>
    @Property
    @Persist
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> searchTerm<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003399;">Object</span> onSubmitFromSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> personService.<span style="color: #006633;">findPersons</span><span style="color: #009900;">&#40;</span>searchTerm<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">Object</span> onSubmitFromClear<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> <span style="color: #003399;">Collections</span>.<span style="color: #006633;">EMPTY_LIST</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can see that this class doesn&#8217;t extend any infrastructure classes and has quite a simple structure. This is a fully functional page with two actions &#8211; one populates a list, the other clears it.</p>
<p>Now, to explain just a little here; PersonService is injected by Tapestry, but you need to configure in your AppModule which implementation you want to use. You can also use it with Spring as your IOC container but the one that comes with Tapestry is perfectly good enough for most applications.</p>
<p>The List, persons, and the searchTerm parameters are marked as @Property (so we don&#8217;t need to add getters and setters) and also @Persist so that the variables are preserved from request to request.</p>
<p>The methods &#8220;onSubmitFromSearch&#8221; and &#8220;onSubmitFromClear&#8221; are using a convention &#8211; &#8220;onSubmit&#8221; will also work, but assuming (as is true in this case) that we may have multiple forms on the one page, each method will only be fired from the &#8220;search&#8221; form in one instance, and the &#8220;clear&#8221; form in the other. These names are not special, it&#8217;s just (as you&#8217;ll see below) the forms will have these two names. They could be &#8220;Bill&#8221; and &#8220;Ben&#8221; in which case the methods would be &#8220;onSubmitFromBill&#8221; and &#8220;onSubmitFromBen&#8221;.</p>
<p>You will also note that these methods return the same page instance, which tells Tapestry to re-render the same page, but if you wanted to forward onto another page, you would add a instance variable, mark it with an @InjectPage annotation, and return that instance variable (after initialising it in your &#8220;onSubmit&#8221; method) instead of just returning &#8220;this&#8221;.</p>
<p>This page Persons, is available at {application-context-path}/persons. But there is one other part of the puzzle &#8211; the actual view. As mentioned, Tapestry uses convention over configuration and in this case, the convention is that the Page markup must be named the same: Persons.tml. Here is the matching tml file for the class above;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">html</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:type</span><span style="color: #000000;">=</span>&#8220;layout&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">title</span><span style="color: #000000;">=</span>&#8220;Peoples I Might Know&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #7f007f;"><span style="color: #000000;"> </span>t:sidebarTitle<span style="color: #000000;">=</span><span style="color: #2a00ff;">&#8220;Current Time&#8221;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #7f007f;">xmlns:t</span><span style="color: #000000;">=</span>&#8220;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #7f007f;">xmlns:p</span><span style="color: #000000;">=</span>&#8220;tapestry:parameter&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f5fbf;">&lt;!&#8211; Most of the page content, including &lt;head&gt;, &lt;body&gt;, etc. tags, comes from Layout.tml &#8211;&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:form</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;search&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:textfield</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;searchTerm&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">validate</span><span style="color: #000000;">=</span>&#8220;required&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">size</span><span style="color: #000000;">=</span>&#8220;20&#8243;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:submit</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;searchPeople&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">value</span><span style="color: #000000;">=</span>&#8220;search&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>t:form<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:grid</span><span style="color: #000000;"> </span><span style="color: #7f007f;">source</span><span style="color: #000000;">=</span>&#8220;persons&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:form</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;clear&#8221;<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #2a00ff;"><span style="color: #000000;"> </span><span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:submit</span><span style="color: #000000;"> </span><span style="color: #7f007f;">t:id</span><span style="color: #000000;">=</span>&#8220;clearPeople&#8221;<span style="color: #000000;"> </span><span style="color: #7f007f;">value</span><span style="color: #000000;">=</span>&#8220;clear&#8221;<span style="color: #008080;">/&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>t:form<span style="color: #008080;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Andale Mono; color: #3f7f7f;"><span style="color: #008080;">&lt;/</span>html<span style="color: #008080;">&gt;</span></p>
<p>Yes, it&#8217;s that bloody simple. The first form fires the &#8220;onSubmitFromSearch&#8221; method (with a little bit of validation, done in javascript) and the second method clears the list. In-between, there is this <span style="color: #008080;">&lt;</span><span style="color: #3f7f7f;">t:grid</span><span style="color: #000000;"> </span><span style="color: #7f007f;">source</span><span style="color: #000000;">=</span>&#8220;persons&#8221;<span style="color: #008080;">/&gt; <span style="color: #000000;">business, which, if the &#8216;persons&#8217; variable in the page class is populated, will show a list of its contents! </span></span></p>
<p>To test our app, we can use the command-line &#8216;mvn clean jetty:run&#8217;. When Jetty has run up, then we can point our browser at the web app: http://localhost:8080/sample-webapp/Persons, and with any luck we will see the following:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-1.png"><img style="border: 0px initial initial;" title="Initial View" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-1-300x171.png" alt="Initial View" width="300" height="171" /></a></p>
<p>Now, by default, Tapestry creates the web app to use the template design as shown above. Of course, you can make it look completely some other way &#8211; or even use a totally different template if you want. The page template is just a component that&#8217;s included.</p>
<p>So if you enter in a search term and click the search button, you&#8217;d expect to see a result like this:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-2.png"><img class="alignnone size-medium wp-image-452" title="Search Result" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-2-300x174.png" alt="Search Result" width="300" height="174" /></a></p>
<p>As you can see, the list is automatically populated with the details returned from the service method (in this particular instance, this are just a canned response, but normally of course they&#8217;d be the result of a database or a web service call of some type).</p>
<p>When you click the clear button, the list is cleared as you&#8217;d expect:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-3.png"><img class="alignnone size-medium wp-image-453" title="Clear button result" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-3-300x175.png" alt="Clear button result" width="300" height="175" /></a></p>
<p>Now, here&#8217;s a really powerful feature I find in Tapestry. Let&#8217;s say our automated acceptance tests assert that when the &#8216;Clear&#8217; button is pressed, the Search box as well as the persons list is cleared. What Tapestry allows us to to do, is keep Jetty running, edit the files in the IDE, and re-run the tests against the running app without restarting! We edit our method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">Object</span> onSubmitFromClear<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        persons <span style="color: #339933;">=</span> <span style="color: #003399;">Collections</span>.<span style="color: #006633;">EMPTY_LIST</span><span style="color: #339933;">;</span>
        searchTerm<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>In this case I&#8217;ve also added a bit of space around the clear button in the template as well:</p>
<p><a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-4.png"><img class="alignnone size-medium wp-image-454" title="Picture 4" src="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/Picture-4-300x175.png" alt="Picture 4" width="300" height="175" /></a></p>
<p>And now our failing test will pass.</p>
<p>Editing files like this in the running web app only works for Pages and I think Components. If I had to change the service or model classes I&#8217;d have to restart, but &#8220;mvn jetty:run&#8221; isn&#8217;t very a heavyweight process.</p>
<p>As I said above, Tapestry&#8217;s not perfect: it&#8217;s major flaw is the poor documentation. Convention-over-configuration is easy to grok &#8211; if you know the convention. If you don&#8217;t and the documentation doesn&#8217;t tell you, and you can&#8217;t find a sample of what you need, it can be very frustrating. There is an excellent user list though.</p>
<p>Its other major flaw may be the stability of the API. Tapestry 5 is different (and incompatible) from Tapestry 4 is different from Tapestry 3. But so far I&#8217;ve used it on a couple of projects and I&#8217;m really enjoying it. I really hate the oodles of XML boilerplate and massive amounts of configuration found in Spring and I find myself somewhat reluctant to use it unless I really have to. Tapestry solves for me a range of different problems and mostly it presents a very elegant way to create a componentised web application. You might like to give it a try.</p>
<p>Attached is the sample code used above. It took me about 10 minutes to write (far shorter than it took me to write this blog entry!) - <a href="http://www.crazymcphee.net/x/wp-content/uploads/2009/08/sample-webapp.tar.gz">sample-webapp.tar bundle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>In those OTHER multiverses, Oracle already bought it for $500mil</title>
		<link>http://www.crazymcphee.net/x/2009/05/21/in-those-other-multiverses-oracle-already-bought-it-for-500mil/</link>
		<comments>http://www.crazymcphee.net/x/2009/05/21/in-those-other-multiverses-oracle-already-bought-it-for-500mil/#comments</comments>
		<pubDate>Thu, 21 May 2009 11:40:54 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[poorly attempted humour]]></category>
		<category><![CDATA[wizards considered harmful]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=364</guid>
		<description><![CDATA[Strange IM conversation came my way the other night, whilst discussing some code a team I led wrote at a previous workplace, I think it highlights some crucial factors Oracle bring to the Enterprise Java World: anon 9:04PM [about that code] crazymcphee 9:05 PM well, it WAS perfect &#8230; CRAZY perfect anon 9:06 PM lol&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Strange IM conversation came my way the other night, whilst discussing some code a team I led wrote at a previous workplace, I think it highlights some crucial factors Oracle bring to the Enterprise Java World:</p>
<blockquote><p><strong>anon</strong> 9:04PM<br />
[about that code]</p>
<p><strong>crazymcphee</strong> 9:05 PM<br />
well, it WAS perfect &#8230; CRAZY perfect</p>
<p><strong>anon</strong> 9:06 PM<br />
lol&#8230;  no doubt it even spans a 2yr time frame and 2 organisational puchases later, with no impact</p>
<p><strong>crazymcphee</strong> 9:07 PM<br />
exactly. all future and past and alternative universe combinations taken care of forever. no changes necessary.</p>
<p><strong>anon</strong> 9:08 PM<br />
sweeet&#8230; it should be a product</p>
<p><strong>crazymcphee</strong> 9:08 PM<br />
oh it already is just not in this instantiation of the multiverse</p>
<p><strong>anon</strong> 9:08 PM<br />
this instance has finished run level 3 yet</p>
<p><strong>crazymcphee</strong> 9:08 PM<br />
but in those OTHER multiverses, Oracle already bought it for $500mil</p>
<p><strong>anon</strong> 9:09 PM<br />
hahaha, i can see you partying with ellison and his geisha girls ;D</p>
<p><strong>crazymcphee</strong> 9:09 PM<br />
tried a &#8216;sudo shutdown&#8217; but something&#8217;s threadlocked the kernel</p>
<p><strong>anon</strong> 9:10 PM<br />
then I stepped in a core dump</p>
<p><strong>crazymcphee</strong> 9:10 PM<br />
that&#8217;s why i&#8217;m hard at work building a mutiverse portal so i get me a slice of sweet ellison geisha-girl action</p>
<p>and here you are thinking about some OTHER sort of portal when i said i was working on an &#8216;Oracle 10g Portal Implementation&#8217;</p>
<p><strong>anon</strong> 9:11 PM<br />
don&#8217;t forget to add some proprietary and intrusive components that spread like a virus and grind all the other appservers to dust</p>
<p><strong>crazymcphee</strong> 9:12 PM<br />
well, that&#8217;s what at least half of those 10^100 multiverses full of new Indian IT grads are working on</p>
<p>I just send them a 500 page spec each month and they will get it to me at sometime before the death of this multiverse</p>
<p><strong>anon</strong> 9:13 PM<br />
that means it should be about ready by now, well as in it probably compiles in at least one of those multiverses, will be fully cmm lvl 5, yet not actually do what you asked</p>
<p><strong>crazymcphee</strong> 9:13 PM<br />
(oh by &#8216;spec&#8217; i mean, a drunken rant shouted into my mobile phone on the walk home)</p>
<p>well, yes, but i&#8217;m fully expecting it will meet oracle&#8217;s stringent marketing requirements</p>
<p><strong>anon</strong> 9:14 PM<br />
well shit, they have to do some work, what do they expect, 4 u to write the code as well</p>
<p>yes marketing tickbox on the packaging is the only requirements they really need</p>
<p><strong>crazymcphee</strong> 9:15 PM<br />
yeah, i mean, hell, we pay at least $5.50 a day per developer &#8230;</p>
<p>oh we don&#8217;t tell the DEVELOPERS about the marketing tickbox requirements! they are super-secret. we just slap those on the box at the end. when i say &#8216;end&#8217; i mean end of the box design process which has been ready for about 8 months now.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/05/21/in-those-other-multiverses-oracle-already-bought-it-for-500mil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GUI builders, modern development practices, and vendor lock-in</title>
		<link>http://www.crazymcphee.net/x/2009/02/14/gui-builders-modern-development-practices-and-vendor-lock-in/</link>
		<comments>http://www.crazymcphee.net/x/2009/02/14/gui-builders-modern-development-practices-and-vendor-lock-in/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 02:22:34 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[weblogic]]></category>
		<category><![CDATA[wizards considered harmful]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=176</guid>
		<description><![CDATA[The Paranoid Engineer has declared &#8216;Screw All Gui Builders&#8216;, with an excellent example of the genre of code that can be produced by one such tool, contrasted against the much nicer hand-written code. Now I can certainly sympathise with his pain. The thing that really gets my goat up, and the subject of this post, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://paranoid-engineering.blogspot.com/">Paranoid Engineer</a> has declared <a href="http://paranoid-engineering.blogspot.com/2009/02/screw-all-gui-builders.html" target="_blank"><em>&#8216;Screw All Gui Builders</em></a>&#8216;, with an excellent example of the genre of code that can be produced by one such tool, contrasted against the much nicer hand-written code. Now I can certainly sympathise with his pain. The thing that really gets my goat up, and the subject of this post, is when vendors use a GUI builder to lock the poor developer and the target <span style="text-decoration: line-through;">victim</span> sorry, enterprise, into their <em>entire product suite</em>.</p>
<p>My case-in-point <em>du jour</em> is Oracle&#8217;s new <a title="Oracle Rich Enterprise Applications" href="http://rea.oracle.com/" target="_blank">Rich Enterprise Applications</a> site and the associated technology.  On that site you will find a flash presentation of their technology around delivering and I quote:</p>
<blockquote><p>multi-channel capable applications that deliver desktop quality, highly interactive user experiences that are pre-integrated to enterprise class server technology.</p></blockquote>
<p>That sounds pretty good, might be of interest to me. Lets investigate further. Now, a lot this technology is built on top of standards, like JSF, and other commonly used technology like AJAX. The earlier version of the ADF component technology was donated to Apache where it lives as the <a title="Apache Trinidad" href="http://myfaces.apache.org/trinidad/index.html" target="_blank">Apache Myfaces Trinidad</a> project. The new components are built on top of these open sourced components. So far, so much is OK.</p>
<p>But, the kick in the tail can be seen in   even just in the quoted sentence above: <em>&#8220;pre-integrated to enterprise class server technology&#8221;</em> &#8211; they certainly don&#8217;t mean <em>Tomcat</em>, right? The point of the presentation is induce <em>lock in</em>. However I&#8217;m still willing to cut them some slack on this particular point. Of course, if you are thinking about using Oracle&#8217;s JSF technology, you probably are already committed to Oracle&#8217;s middleware technology anyway &#8211; and Weblogic is a perfectly good application server, if you need such advanced capabilities (and whether you actually do is another question for another day).</p>
<p>But what absolutely does my head in, is the insistence the only way to develop for this technology is to write it using their proprietary, non-standard developer technology, aka <em>JDeveloper</em>. This is the point where I have to say, I&#8217;m sorry Oracle, but &#8230; <em><strong>FAIL</strong></em>. <em>I actually don&#8217;t even care if your IDE is even the world&#8217;s best!</em> Or even if it comes as an Eclipse plugin. My beef with this sort of IDE integration is the total mind-set that it embodies. The IDE might have all the <em>drag-and-drop interface-building mojo</em> in all the world, but the code it produces will never, ever, stand up to a hand coded model driven off the target domain, using modern agile development techniques that are designed to ensure the most cost-effective, best-quality development delivering timely business process transformation (aka <em>value</em>) that the enterprise prioritises and chooses. Just look at the <a title="Oracle ADF FAQ" href="http://wiki.oracle.com/page/Oracle+ADF+FAQ?t=anon" target="_blank">ADF FAQ on the Oracle Wiki</a>.  Half the questions are related to the <em>IDE</em>. Here&#8217;s a <a title="Introduction to Oracle's ADF Faces" href="http://java.dzone.com/news/introduction-oracles-adf-faces" target="_blank">tutorial style introduction</a> that just assumes JDeveloper as the default way to get access to the Oracle JDF components.<em> </em></p>
<p><em>No, no a thousand times NO!</em></p>
<p>The biggest insult is the way that developers are treated as mere <em>commodities</em> in this whole process. They are just the warm bodies occupying the chair driving the interface. Much like the continually failed dream of <a title="Programmerless programming is just a mirage" href="http://www.crazymcphee.net/x/2009/01/17/programmerless-programming-is-just-a-mirage/" target="_self">developerless development</a>, their primary skill is seen as not &#8220;being a programmer&#8221; but &#8220;being a driver of a software package&#8221;. If I said, my financial skills and experience include 10 years Excel and 5 years MYOB &#8211; <em>I can haz CFO jobz now</em>? NO?! <em>Why not?</em> It&#8217;s insulting, that&#8217;s why not.</p>
<p>Software development is a profession, or at the very least a <em>craft</em>, and software developers should be able to choose their own tools. Obviously, some agreement has to be made organisationally, or at least across a single team or a whole project, to use a certain common toolset. Here&#8217;s one possible checklist:</p>
<blockquote><p>We&#8217;re writing a Java app, check. Deploying onto Weblogic, check. Database is Oracle 11g, check. We have <a href="http://www.crazymcphee.net/x/tag/scrum/">Scrum</a> as our process framework, check. <a href="http://www.crazymcphee.net/x/tag/test-driven-design/">TDD</a> is in our list of favoured engineering disciplines, check. Maven is our chosen build tool, check. Using Subversion for version control, check. Hudson for a continuous integration server, check. Writing the interface with Oracle ADF, check. Using Crossfire to deliver our web services, check. Spring for application wiring, check. Hibernate for persistence, check.</p></blockquote>
<p>Each of these things has to be agreed upon at an architectural and organisational level (and obviously I don&#8217;t mean to say that each of the above is the only choice for each type of item, I&#8217;m just giving <em>examples</em>).</p>
<p>You should note one very deliberate omission from that list, the IDE. <em>Architects</em> might impose a certain application server, a particular approach to application layering, and so on. The <em>developers</em> &#8211; at least the senior ones &#8211; have to choose and agree, for example, on whether to use Ant or Maven, CVS or SVN, Cruisecontrol or Hudson. But what they do not do, is force developers to favour Eclipse or IntelliJ or Netbeans or JDeveloper. What is the point of taking someone who is super-productive with a particular IDE&#8217;s keystrokes and  then forcing them to spend six months learning a whole new set, a new environment? That&#8217;s not productive! A developer needs to have the IDE <em>get out of the way</em>, become second nature &#8211; they need to be thinking about <em>code</em>, not where the menu is for the rename-method refactoring because they are unfamiliar with the keystrokes of the unfamiliar IDE. Keystrokes are <em>muscle memory</em>. You just think, <em>rename this method</em> and your fingers are already on the keys you need to press, without breaking your all-important <em>flow</em>. That&#8217;s how a developer is as <em>productive</em> as they can be. A productive development team should have a <em>mix</em> of IDEs (I&#8217;d propose that this would be statistically in proportion to the usage patterns of the common IDEs). Then we have the specific example of JDeveloper. I won&#8217;t even go into it except to say I&#8217;ve never heard a developer do anything but <em>curse</em> it, or maybe <em>laugh</em> at it. But it&#8217;s the laughter of the condemned man.</p>
<p>It&#8217;s something that vendors really need to get serious about. Rather than presenting me with a seamlessly integrated vision, from developer&#8217;s screen, through application server, to user&#8217;s screen, their technology presentations ought to think <em>discrete</em>. Each piece of technology ought to live and die on it&#8217;s own merits, something I&#8217;m sure Oracle&#8217;s ADF is perfectly capable of &#8211; without JDeveloper. If it&#8217;s not capable of being developed productively without JDeveloper, it&#8217;s already in the reject pile as far as I am concerned.</p>
<p>This essential information needs to be right up front. Don&#8217;t bury the information a thousand web sites deep in your developer portal. <em>Put it right there in the first presentation!</em> Separate the selling of the developer tooling from the selling of the user presentation frameworks and the server technology. Show me how I integrate Oracle ADF into TDD, into continuous integration, into the IDE of the developer&#8217;s choice. Because if you don&#8217;t, <em>you&#8217;ve already lost me as a potential customer</em>. This is the <em>real</em> future of software development. Look at where the major thought leaders of software development are taking development &#8211; open source frameworks, inversion of control, TDD, Domain Driven Design, Domain Specific Languages, Agile Methods, delivering real process transformation and business capability as early as possible &#8211; not <em>drag and drop with wizards</em>. FFS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/02/14/gui-builders-modern-development-practices-and-vendor-lock-in/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>&#8216;Disappeared&#8217; DAO layers</title>
		<link>http://www.crazymcphee.net/x/2009/02/06/disappeared-dao-layers/</link>
		<comments>http://www.crazymcphee.net/x/2009/02/06/disappeared-dao-layers/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 07:01:18 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[test driven design]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=139</guid>
		<description><![CDATA[Adam Bien still wants to believe that a JPA layer can directly replace a formal &#8216;DAO layer&#8217;. And I still disagree. I might agree that for simple enough systems, it could end up being that in fact the service layers end up with PersistenceManager logic directly in their methods. But then I might say a [...]]]></description>
			<content:encoded><![CDATA[<p>Adam Bien still wants to believe that a <a href="http://www.adam-bien.com/roller/abien/entry/daos_aren_t_dead_but" target="_blank">JPA layer can directly replace a formal &#8216;DAO layer&#8217;</a>. And I still disagree.</p>
<p>I might agree that for simple enough systems, it could end up being that in fact the service layers end up with PersistenceManager logic directly in their methods. But then I might say a language and framework like Ruby on Rails could suit your application better in that case. For any sufficiently complex Java-based enterprise system, a POJO-style data persistence layer naturally evolves, in order to reduce as far as possible the responsibilities the service layer must carry out.</p>
<p>As mentioned by commentators on his blog, the discipline of test-driven design is usually  a strong driver of having a separated set of components that deal with persistence and other data concerns. Not just from the issue over mocking the PersistenceManager, which is certainly a strong driver, but also from design principles.</p>
<p>Service layers marshall requests from clients, and decompose them to call various component layers. Data access layers typically form part of these component layers. A TDD discipline means these data access layers usually end up with more than just CRUD operations.</p>
<p>Furthermore, as a matter of discipline, in any sufficiently complex service layer I prefer not to work directly with database abstractions (i.e. entities that are modelled on database tables and their relationships) but on first-class objects designed to fit directly with the modelled domain. I want those objects to have rich behaviour &#8211; the service layer is actually part of their behaviour. I want to start the design of the system by directly modelling those actions, e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">passenger.<span style="color: #006633;">at</span><span style="color: #009900;">&#40;</span>origin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
passenger.<span style="color: #006633;">orderJourney</span><span style="color: #009900;">&#40;</span>dispatch, destination<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Vehicle vehicle <span style="color: #339933;">=</span> dispatch.<span style="color: #006633;">sendVehicle</span><span style="color: #009900;">&#40;</span>origin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
vehicle.<span style="color: #006633;">pickUp</span><span style="color: #009900;">&#40;</span>passenger<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
vehicle.<span style="color: #006633;">arrives</span><span style="color: #009900;">&#40;</span>destination<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">dropsOff</span><span style="color: #009900;">&#40;</span>passenger<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
vehicle.<span style="color: #006633;">notify</span><span style="color: #009900;">&#40;</span>dispatch<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I do not want these objects to know about database semantics. That is a responsibility of a separated persistence layer, which we may for convienience sake, called the DAO. Even if internally we end up with;</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Passenger <span style="color: #009900;">&#123;</span>
  at<span style="color: #009900;">&#40;</span>Location origin<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">origin</span><span style="color: #339933;">=</span>origin<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  call<span style="color: #009900;">&#40;</span>DispatchCentre dispatch, Location destination<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    dispatch.<span style="color: #006633;">passengerOrder</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, destination<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>DispatchCentre at this level, is a service, but we will model it as part of the domain of passengers, locations, and vehicles. Behind that service, it will have a database layer with the semantics as to how it saves and loads the data concerning passengers, locations, and vehicles. I don&#8217;t necessarily want the client objects (e.g. the web action) to have to deal with JPA annotated objects. They just deal with objects as much as possible. And I don&#8217;t see there&#8217;s anything served with developing possibly complex persistence logic directly in the DispatchCentre. In fact, taking a top-down approach, I know pretty much I won&#8217;t do that.</p>
<p>Only after I&#8217;ve done this initial part of the modelling, will I be concerned as to which of these components can be directly JPA or Hibernate annotated, which are Spring-injected services, which are Session EJBs, and the like. I think starting your modelling from the point of view of having a persistence framework like JPA or Session EJBs or any other &#8216;archtectural artifact&#8217; leads to an unnatural design.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/02/06/disappeared-dao-layers/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Is Java &#8220;architecture&#8221; irrelevant?</title>
		<link>http://www.crazymcphee.net/x/2009/01/30/is-java-architecture-irrelevant/</link>
		<comments>http://www.crazymcphee.net/x/2009/01/30/is-java-architecture-irrelevant/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 02:51:48 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=113</guid>
		<description><![CDATA[Simon Mittag says that Java Architecture is becoming irrelevant. I am now a contractor for a large government organisation and as part of my role there, I get to participate in these workshops. Trust me, a fruitless exercise. People bickering about their favourite frameworks, why to use Axis over Spring-WS, why everyone should use maven [...]]]></description>
			<content:encoded><![CDATA[<p>Simon Mittag <a title="simonsays: The Growing Irrelevance of Java Architecture" href="http://simonsayz.blogspot.com/2009/01/growing-irrelevance-of-java.html" target="_blank">says that Java Architecture is becoming irrelevant</a>.</p>
<blockquote><p>I am now a contractor for a large government organisation and as part of my role there, I get to participate in these workshops. Trust me, a fruitless exercise. People bickering about their favourite frameworks, why to use Axis over Spring-WS, why everyone should use maven style dependency management, maven is the devil, etc, etc.</p></blockquote>
<p>Well, this has been a problem in Java circles for a long time now. I think we are learning to live with it. But what I don&#8217;t clearly see is its full relevance to Java &#8220;architecture&#8221;.</p>
<p>In my view, architecture is an independent set of constraints on the selection of the requisite frameworks; but the selection of the frameworks isn&#8217;t itself  an archiecture, nor necessarily an architectural task. In my view, achitecture is the view that says, &#8220;this is a web service&#8221; or maybe in more detail: &#8220;these are five components &#8216;C&#8217; {Ca, Cb, Cc, Cd, Ce} having responsibilities &#8216;R&#8217; {Ra, Rb, Rc, Rd, Rd} and they communicate via an asynchronous messaging bus in message formats &#8216;M&#8217; {M1, M2, M3}&#8221;. The actual selection of the frameworks to accomplish this just should <em>not</em> be charged to a committee &#8211; ideally the developers should do it, with appropriate guidance from the relevant architect (who should be on the development team anyway).</p>
<p>Of course this proliferation of frameworks and standards to get this stuff done can lead such committees up the proverbial garden path. But, and without being privy to the full scope of the particular organisation Simon refers to, the essential problem I see here is the <em>function of the committee</em> &#8211; it&#8217;s just compounded by the additional issue of choice, and for some, those choices have inevitably become <em>religious</em>, making the said committee even more dysfunctional. Some would argue the proliferation of frameworks is something that makes Java <em>stronger</em>. There&#8217;s a marketplace in frameworks. But we all know about <em>design by committee</em>, don&#8217;t we?</p>
<p>That said, a lot &#8216;standards&#8217; (even the JSR standards) are indeed irrelevant and out of date, as <a title="JSR286 and vendor sales" href="http://www.crazymcphee.net/x/2009/01/25/jsr286-and-vendor-sales/" target="_self">I pointed out only a few days ago</a>.</p>
<p>In closing his blog entry, Simon leaves us with a question:</p>
<blockquote><p>In closing, do you think JEE can be saved from becoming the next dinosaur?</p></blockquote>
<p>Well, that, of course, is the million dollar question for a Java programmer isn&#8217;t it? Myself, I just prefer to get down and dirty and into the writing of the code &#8211; the business objects &#8211; that encapsulate the domain at hand. If we can&#8217;t just naturally select an uncontroversial framework to enable some segment of the desired infrastructure, then the best thing I find is to use your process, or more appropriately, your <em>design</em>, to just route around the controversy. But the best position is just not to be in that position anyway. Unless the chosen framework absolutely prevents you from doing something you <em>absolutely need</em> to do, you&#8217;re not quite in a pile of stinking do-do just yet.</p>
<p>And if your architecture committee is bogged down in arguing about framework selection, then I&#8217;ll tell you your real problem is is your <em>committee</em>, not the <em>frameworks</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/01/30/is-java-architecture-irrelevant/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JSR286 and vendor sales teams</title>
		<link>http://www.crazymcphee.net/x/2009/01/25/jsr286-and-vendor-sales/</link>
		<comments>http://www.crazymcphee.net/x/2009/01/25/jsr286-and-vendor-sales/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 01:06:27 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[jsr168]]></category>
		<category><![CDATA[jsr286]]></category>
		<category><![CDATA[portal]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[tapestry5]]></category>
		<category><![CDATA[weblogic]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=94</guid>
		<description><![CDATA[Eric Spiegelberg recently speculated that the new Java portal specification JSR286 was at the edge of irrelevance. And others agree. I think it&#8217;s worse than irrelevant &#8211; it&#8217;s a solution in search of a problem. I&#8217;ve worked on a successful (JSR168) portal implementation, just last year. I truly don&#8217;t see what the concept of &#8216;portal&#8217; brings [...]]]></description>
			<content:encoded><![CDATA[<p>Eric Spiegelberg recently speculated that the new Java portal specification JSR286 was at the <a title="The edge of irrelevance" href="http://today.java.net/pub/a/today/2009/01/20/jsr-286-portlet-irrelevance.html" target="_blank">edge of irrelevance</a>. And <a title="In response to JSR286" href="http://www.andypemberton.com/portal/in-response-to-jsr-286-the-edge-of-irrelevance/" target="_blank">others agree</a>. I think it&#8217;s worse than irrelevant &#8211; it&#8217;s a solution in search of a problem.</p>
<p>I&#8217;ve worked on a successful (JSR168) portal implementation, just last year. I truly don&#8217;t see what the concept of &#8216;portal&#8217; brings to a web application beyond what could be simply programmed into a customised web application. We used Spring MVC Portal running under Websphere Portal and calling back-end services deployed on a BEA Weblogic server using Spring remoting (note: not WSRP which would have probably massively increased complexity). The reason this mix of platforms (Websphere and Weblogic) was used was <em>political</em>, not technical. I believe the whole use of portals in general tends to follow organisation&#8217;s political and not technical needs.</p>
<p>Despite all that, overall the custom portlets and the project as a whole was quite successful and the customer satisfied with the result. However I felt the most difficult aspects of the project were the parts of the deployment that were left to the portal container to provide. These are the things that are touted as the &#8216;advantage&#8217; using a portal container over a simple custom-built web application. Content management features caused the team members delivering these enormous headaches (and late nights) and the same can be said of the authentication and authorisation mechanisms employed. I felt we could have easily delivered these components using known JEE development APIs with all the customisation required by the customer in at least an equal amount of time.</p>
<p>As a contrast, we used Tapestry 5 to develop (actually, completely rewrite from an earlier phase one version in dire need of improvement) an administration component as a straight web application deployed into the Weblogic server. This took a pair of us less than two weeks to write using a functional-test-driven approach and delivered a very nice web app.</p>
<p>The issue of portal containers and standards being a political rather than a technical concern is particularly pertinent to me at the moment because it looks likely in the near future I&#8217;ll be working on another portal implementation for another client. I can&#8217;t be more specific regarding this but this particular client had already bought the portal server from a vendor and then approached consultants in order to get an actual implementation completed. Of course, no requirements gathering or analysis was done to determine if the portal solution was indeed the right one &#8211; the vendor&#8217;s sales team effectively provided the assurances of product suitability. Because the money is already spent and reputations already staked on the portal platform there&#8217;s no possible way a better solution can be suggested by any technical expert at this stage.</p>
<p>In my view, that&#8217;s the &#8220;relevance&#8221; of portal servers in the Java world. Vendor sales teams love to sell them.</p>
<h4>Update</h4>
<p><span style="color: #000000; "><span style="text-decoration: none;"><a title="JSR286 versus reality" href="http://www.jroller.com/holy/entry/are_portlets_dead_jsr168_and" target="_blank">Jakub Holý makes an excellent observation</a></span></span> about validity of the <em>concept</em> of a portal server:</p>
<blockquote><p>It&#8217;s a pity that portals and portlets aren&#8217;t easier to use and haven&#8217;t made it into the mainstream, the abilities of content aggregation, personalization, uniform security etc. are promising and as we can see in the rise of personal mashups like iGoogle, the fundamental ideas behind portals are still valid and extremely attractive. I hope that some mashup technology will soon provide a viable, light-weight alternative to portals.</p></blockquote>
<p>That&#8217;s an important point: <a title="iGoogle" href="http://google.com/ig/" target="_blank">iGoogle</a> is the most widely used example of a &#8220;portal&#8221; architecture. The modern trend towards the &#8220;mashup&#8221; (especially in social software) also shows the idea to aggregate different web applications under a common view, with security and other features is a valid one: it&#8217;s just the bloated, slow specification process, and predatory vendor sales departments that are stopping real innovation in this space in the Java area. Hopefully some light weight technology will soon emerge from among something like Spring, Tapestry, and GWT to produce a &#8220;portal&#8221; server that delivers actual value, and ease of development, deployment and usage, in a corporate context.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/01/25/jsr286-and-vendor-sales/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programmerless programming is just a mirage</title>
		<link>http://www.crazymcphee.net/x/2009/01/17/programmerless-programming-is-just-a-mirage/</link>
		<comments>http://www.crazymcphee.net/x/2009/01/17/programmerless-programming-is-just-a-mirage/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 10:09:24 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[professional practice]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[test driven design]]></category>
		<category><![CDATA[test first]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=51</guid>
		<description><![CDATA[&#8220;Programmerless programming&#8221; is a fad that never dies. It&#8217;s a mirage that never fades but always recedes to just out of reach. Every few years a vendor, or a group of vendors comes out with some bright idea to allow some class of end-user, or business analyst, or what have you to build their own [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Programmerless programming&#8221; is a fad that <a title="The End of The Software Developer" href="http://www.craigslinkedlist.com/posts/end-of-the-software-developer" target="_blank">never dies</a>. It&#8217;s a mirage that never fades but always recedes to just out of reach.</p>
<p>Every few years a vendor, or a group of vendors comes out with some bright idea to allow some class of end-user, or business analyst, or what have you to build their own systems, in recent years usually by some type of graphic language (draw your system&#8217;s program flow right on the screen! bypass those pesky, and expensive, <em>programmers</em> who just ask confusing questions and force you to clarify your thinking!  press the magic &#8216;deployment&#8217; button and your half-baked idea is in <em>production in seconds</em>!). In the past, these systems used &#8220;natural&#8221; language or &#8220;plain English&#8221;  languages such as say Director Lingo.  Every few years it moves onto some new paradigm or expression of the old one. <em>And it always just ends up simply with a whole new class of programmers being created.</em></p>
<p>Do not trust any product &#8211; or standard &#8211; that promises to deliver &#8220;programmerless programming&#8221;. Plenty of 4GLs like SQL and the like are originally meant for non-programmers to use  &#8230; imagine giving a business user just a SQLPLUS prompt now! Included in that mix there was CASE &#8230; a recent example from the past few years I can think of might be BPEL and ESB style tools, or for another example a number of attempts to define architectural languages that generate the system components for you off the UML or similar.</p>
<p>A big issue I see with these systems is that they tend to be highly resistant to modern programming <a title="Emergent Design" href="http://www.crazymcphee.net/x/2009/01/13/emergent-design/" target="_self">principles and practices</a>. For example, test-driven design &#8211; or even simple <a title="Unit testing as a discipline" href="http://www.crazymcphee.net/x/2009/01/15/unitestingasadiscipline/" target="_self">unit testing</a>. Sure, if you&#8217;re building a web app with these things, maybe you could use a web-testing framework to build functional tests and build-to-pass. But most of these tools are very resistant to a test-first approach.</p>
<p>Take Oracle&#8217;s BPEL tooling. For a start, you&#8217;re forced to used JDeveloper, which is a crap IDE you&#8217;d never otherwise inflict on yourself (it is so bad, on start up it displays the most meaningless <em>product slogan</em> I&#8217;ve seen seen on such a tool &#8211; &#8220;Productivity through Choice&#8221;). But more than poor tooling, the very paradigm is completely broken. Forget about a test-first approach (although I&#8217;m sure there&#8217;s some seriously weird way to achieve it), just try setting the damn tools to have the traditional <em>development</em>, <em>testing</em> and <em>production</em> environments. When ever you need to call a service end-point, you are bound to the particular host and port you specify &#8211; it&#8217;s embedded in XML document that represents the BPEL design. The workarounds? Well if you are super organised you could arrange for your different environments to contain identical setups and  use DNS hacks (or host files) to ensure that each service looks the same when you move from development to integration testing to production. Or you can write Ant scripts (or sed and awk if you really want) to search-and-replace the offending hostnames and ports and replace them with the correct values for the target environment. Clearly, once you use it, you see that the tool&#8217;s paradigm is, in reality, to just hook up the IDE to the production server, draw your pretty flow chart modelling your business process, then publish it straight back into production. In other words, there&#8217;s a whole new class of programmer out there now &#8211; BPEL programmers &#8211; and life must be a <em>nightmare</em> for them. Its fundamental paradigm is broken. Given me <em>any</em> language with a unit test framework with a half-decent programmer on <em>any</em> day of the week, and you will beat the pants off this system in productivity <em>and</em> choice. It&#8217;s living a lie &#8211; and a big one.</p>
<p>Ultimately, as each new generation of &#8220;programmerless&#8221; program-construction tooling comes along, it allows developers to do more powerful things (and sometimes, <em>less</em> powerful things in a <em>more</em> retarded way). And the scale of the task always increases to the point where development specialists are still needed. In my view, there is a definite on-going role for for the talented programmer/analyst who knows how to take a vaguely-worded, incomplete, and contradictory bunch of requirements expressed in common verbal language and then <em>ask the right questions</em> in order to clarify them and decompose the requirements to a series of simple logical components &#8211; and then develop and deliver those components in the form of usable systems. You need to continuously learn new languages and systems, but the basic skills stay the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/01/17/programmerless-programming-is-just-a-mirage/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

