<?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>Josh Gertzen</title>
	<atom:link href="http://joshgertzen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://joshgertzen.com</link>
	<description>Business, Technology and the Pursuit of Happiness</description>
	<lastBuildDate>Fri, 04 Dec 2009 09:20:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>State of the ThinWire Framework 2008</title>
		<link>http://joshgertzen.com/state-of-the-thinwire-framework-2008/</link>
		<comments>http://joshgertzen.com/state-of-the-thinwire-framework-2008/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 20:13:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ThinWire]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-6439874440595166520</guid>
		<description><![CDATA[For those of you who have been following ThinWire, you have probably noticed that the framework has been receiving limited attention for a while now, and I want to take a few minutes to discuss why this is so that people are not left guessing.
The other thing I want to touch on is what the [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have been following <a href="http://www.thinwire.com">ThinWire</a>, you have probably noticed that the framework has been receiving limited attention for a while now, and I want to take a few minutes to discuss why this is so that people are not left guessing.</p>
<p>The other thing I want to touch on is what the frameworks future will likely be and to ask if there are developers who might be interested in joining the project to help establish the future of the framework.</p>
<h2>Where We&#8217;re At Currently</h2>
<p>First, let me talk about the delays in development/releases. Part of the delay has been a result of backward compatibility testing that&#8217;s been going on by Custom Credit Systems (the company backing ThinWire) to make sure that the latest builds work correctly with the existing applications they have deployed with their customers. And since CCS&#8217;s customers are top U.S. banks, they tend to have a very rigorous testing process that spans months.</p>
<p>However, I&#8217;m not going to try and convince you that&#8217;s the only reason for the delays in ThinWire development.  The other, more important, reason is that both CCS and I have been discussing various options for ThinWire&#8217;s future over the last six months. It was just about six months ago that I decided to leave CCS to consider other options. I won&#8217;t bore with you some run-on about why I left; it&#8217;s suffice to say that CCS is a good company and I just wanted to try other things since I&#8217;d been working for them for over 7yrs.</p>
<p><span id="more-140"></span></p>
<p>Where does this leave ThinWire? Well, I&#8217;m the lead developer who started the project back in early 2003 (it was an internal CCS project then) and while there has been help from others along the way, most notably the bright guy <a href="http://tedchoward.com">Ted C. Howard</a>, there really hasn&#8217;t been any other developer working on the framework since it&#8217;s inception. Granted, there have been bug fixes from CCS and other community members, but generally, it&#8217;s been a one or two man show for most of it&#8217;s life.</p>
<p>So when I decided to leave, CCS and I had to sit down and figure out what was going to happen with ThinWire as a whole. In the beginning we started down the path of creating a new company dedicated to ThinWire that I would be in charge of and that CCS would only oversee from a distance. This idea worked on paper, but as time drew on three things became apparent:</p>
<ol>
<li>There are legal issues with who owns the codebase and the ThinWire trademark, as well as what the operational guidelines for this new company would be.  Now, it&#8217;s easy to just squawk at such statements and say&#8230; What do you mean, this thing is open source!?!?!  But in order to be competitive in the market, the new ThinWire company would have to have the ability to commercially license the code to others, which it could not do with the opensource LGPL code.  Additionally, just because the code is open-sourced, doesn&#8217;t mean that you have the right to use the ThinWire(R) name.  The same holds true for many open-source projects.. heck, even <a href="http://opensource.org/trademark">the term &#8220;Open Source&#8221; is trademarked</a>. That&#8217;s just the way things work in the business world. This means that the new company would need ownership of the codebase and trademark in order to control it&#8217;s own destiny and it turns out that ironing out all the issues that brings up is not as easy as you may think.</li>
<li>Unlike many other open-source projects, ThinWire is smack in the middle of the largest development paradigm shift since the internet came on to the scene 15+ years ago. Before Ajax it was possible that the web would be the primary platform of the future. Now it&#8217;s unquestionable. By utilizing the various techniques championed by Ajax, it&#8217;s possible to entirely replace all but the most resource intensive desktop applications and to do so while providing the user with a <em>BETTER</em> experience, not a watered down experience like you got with old school Web applications. So what does this mean with regards to ThinWire? Well, it means that the market is insanely competitive. Everyone knows this technology is the future, so everyone wants to own as much of it as they possibly can. And when market conditions are like that, it&#8217;s very difficult for a 1 1/2 person gig with no funding and no major company backing to get noticed or make much more than a dent regardless of how much effort is put in:<br />
<a href="http://www.ohloh.net/projects/10584"><img src="http://www.ohloh.net/projects/10584/widgets/project_partner_badge.gif" alt="2.2 Million USD, 39 person years" /></a></li>
<li>For a number of developers, ThinWire doesn&#8217;t fit the definition of Ajax or Web 2.0 development:
<ol>
<li>First, it&#8217;s built on a proprietary component model similar but not identical to Swing or JSF. Swing&#8217;s API is not designed for web development and when ThinWire was started, JSF was just a twinkle in <a href="http://blogs.sun.com/craigmcc/">Craig McClanahan&#8217;s</a> eye and it most certainly was not taking an Ajax-driven model into account.  IMO, to this day it tries to straddle too much and therefore collapses in it&#8217;s own weight.  But that&#8217;s besides the point. CCS and I spoke with a few people from Sun early on (2004) to see if they had any interest in taking on ThinWire, but they pretty much said&#8230; if it ain&#8217;t JSF, then we aren&#8217;t interested. Sun could have been an industry leader and beaten Google to the Ajax punch.</li>
<li>Then you have the fact that ThinWire is meant to be like Visual Basic for web development, which seems to be about the worst thing you could say about any web framework.  However, ThinWire is all about allowing developers to craft web applications as quickly as possible&#8230; not as sexily as possible.  And stability and memory footprint are much higher on the priority list for big banking applications then spiffy Fisheye widgets, transparencies or animations. Unfortunately, boring business applications don&#8217;t exactly get the blood of most developers sizzling <img src='http://joshgertzen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Most developers look and think: it&#8217;s server-side, it looks like a desktop app, it&#8217;s Java (oh the humanity), therefore it can&#8217;t be cool! Sure, it&#8217;s not the kind of framework you want to build your next Facebook killer on, but that doesn&#8217;t mean it&#8217;s not the most appropriate solution for back office applications. As always, it&#8217;s about using the right tool for the job.</li>
</ol>
</li>
</ol>
<h2>How You Can Help</h2>
<p>Don&#8217;t take my &#8220;State of the Framework&#8221; as some kind of death sentence for ThinWire, because it&#8217;s not. The framework has a lot to offer developers in it&#8217;s current state and both CCS and other developers will continue to use it for years to come.  However, if you and/or other developers are willing to help by joining the project and doing one of the following listed below, then there can be an active and bright future for the framework:</p>
<ol>
<li>Implementing some of the features from the rather extensive <a href="https://sourceforge.net/tracker/?group_id=170706&amp;atid=855242">feature request list</a>.</li>
<li>Help find and <a href="https://sourceforge.net/tracker/?group_id=170706&amp;atid=855239">fix the known bugs</a>.</li>
<li>Add javadoc documenation to the sourcecode or write tutorials of your own.</li>
</ol>
<p><em>So, please, if you want to join, shoot me an email: josh at truecode dot org</em>.  I&#8217;m going to be trying to add 5-10 developers/contributors that are willing to take an active interest in pushing forward.  I will still be involved and help as much as I can, but like so many other open source hackers, I&#8217;ve got other things going on that I have to attend to as well.</p>
<h2>The Near-Term Future</h2>
<p>To wrap things up, I&#8217;m am still working with CCS to persuade them to open the framework further, ideally under a BSD license. My goal in doing this is that it would free the codebase for any and all use and would ease the difficulty of managing code committers since there wouldn&#8217;t be any &#8220;who owns what code&#8221; issue to contend with.  Under a BSD style license, all code would be owned by everyone&#8230; and even if you simply want to grab a small piece of the framework to include in your work, you&#8217;d have no trouble doing so.  I believe this approach is the best option for the benefit of the community and everyone involved. If you have some thoughts you&#8217;d like to share on all this, either send me an email at: josh at truecode dot org, or add a comment to this post.</p>
<p>Thanks Again.</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/state-of-the-thinwire-framework-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bypassing Java Checked Exception Verification</title>
		<link>http://joshgertzen.com/bypassing-java-checked-exception-verification/</link>
		<comments>http://joshgertzen.com/bypassing-java-checked-exception-verification/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 06:52:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-8801127352172347794</guid>
		<description><![CDATA[So, Java checked exceptions. Of all the Java hot-points, this one still has the power to invoke avid flame wars between those who feel they make the platform &#8220;enterprise&#8221; class and those who are so disgusted with writing try/catch blocks to wrap them that they are willing to defect to .Net &#38; C# simply to [...]]]></description>
			<content:encoded><![CDATA[<p>So, Java checked exceptions. Of all the Java hot-points, this one still has the power to invoke avid flame wars between those who feel they make the platform &#8220;enterprise&#8221; class and those who are so disgusted with writing try/catch blocks to wrap them that they are willing to defect to .Net &amp; C# simply to escape the drudgery of it all (.Net does not have checked exceptions).</p>
<p>Now, to be honest, while I have tried to look at the issue from multiple perspectives over the years, I tend to find myself leaning toward the latter camp for one very simple reason:</p>
<p><em><strong>&#8220;Checked exceptions are great in theory, but in practice lots of developers use them poorly and then the rest of us are left to clean up their mess.&#8221;</strong></em></p>
<p>Truthfully, as a developer that&#8217;s somewhat par for the course, you get used to paying for the mistakes of other developers and to be honest I know that when pressed for time I&#8217;ve written less than stellar code that I&#8217;m sure someone else has had to clean up.  It&#8217;s just part of being a developer.</p>
<p>However, the problem with checked exceptions is that when they are done wrong you suffer in really really ugly ways that take your suffering to completely new levels.  In this article I&#8217;m going to first cover some of the various problems that exist with using checked exceptions and then&#8230; for the finale, I&#8217;m going to show you a technique I&#8217;ve started using in the <a href="http://www.thinwire.com">ThinWire Ajax framework</a> and other projects to force checked exceptions into behaving like plain old RuntimeExceptions. Yup, you read that correctly. If you just can&#8217;t wait to see how that&#8217;s possible, you can jump to the end.<br />
<span id="more-141"></span></p>
<h1>Adventures with java.sql&#8230;</h1>
<p>To get started, the most common way checked exceptions make you suffer is when you are forced to deal with an API that has chosen to throw checked exceptions whenever anything at ALL goes wrong.  A classic and widely known example of this is the java.sql API. I&#8217;ve been fortunate enough to avoid having to write much code against that API and when I have had to use it, I&#8217;ve usually developed a pattern that makes working with bearable. However, as I mentioned, the real problem is not necessarily the code you write, it&#8217;s the code other&#8217;s write and I know I&#8217;ve seen one too many code blocks that look like this:</p>
<h2>A real-life in the wild example</h2>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testRetrieval<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span>, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">ClassNotFoundException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ClassNotFoundException: &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">Connection</span> con <span style="color: #339933;">=</span> <span style="color: #003399;">DriverManager</span>.<span style="color: #006633;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jdbc:odbc:test&quot;</span>,
                <span style="color: #0000ff;">&quot;user&quot;</span>, <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection To The Database Established...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        stmt <span style="color: #339933;">=</span> con.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">SQLException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection SQLException: &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> Info getData<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> rNum<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Info info <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">ResultSet</span> rs <span style="color: #339933;">=</span> stmt.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;select * from itable where po =&quot;</span>
                <span style="color: #339933;">+</span> rNum<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            info <span style="color: #339933;">=</span> getResultSet<span style="color: #009900;">&#40;</span>rs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// do nothing</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        rs.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">SQLException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SQLException: &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> info<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> Info getResultSet<span style="color: #009900;">&#40;</span><span style="color: #003399;">ResultSet</span> rs<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Info info <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        info.<span style="color: #006633;">setPo</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;po&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        info.<span style="color: #006633;">setType</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;type&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">sql</span>.<span style="color: #003399;">SQLException</span> se<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Info retrieval from ResultSet failed.&quot;</span> <span style="color: #339933;">+</span> se<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> info<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That&#8217;s a little bit clearer don&#8217;t you think? The more savvy of you might be balking at the lack of proper Statement &amp; ResultSet closing within a finally block, but keep in mind that the developer wasn&#8217;t doing that anyhow and additionally the use of a finally block has nothing to do with the handling of checked exceptions.</p>
<h2>Different Recovery Strategies</h2>
<p>Now, I want you to consider something else about this code. What do you suppose you could do to reasonably recover from an exception being thrown by any random java.sql method? Lets see:</p>
<p>Option 1: You could retry the whole block I suppose, but without extensive investigation of the SQLException details and a solid understanding of the error states presented by the specific DB you are connected to, that would really just be a shot in the dark.</p>
<p>Option 2: You could log all the exception details so that it&#8217;s easier to troubleshoot. But wait, wouldn&#8217;t it make sense to handle that in a centralized place further upstream in your code? Oh, I know&#8230; throw another exception that your upstream code catches! Although that&#8217;s somewhat repetitive when you think about it. You catch an exception just so you can throw it upstream. Hmm.</p>
<p>Option 3: Well, I guess you could log the details and return a default empty value or default object and then your upstream code could still process the empty value, but that seems kind of senseless. You&#8217;d either have to write your upstream code in such a way that it made sense to process an empty value or you&#8217;d have to write it to detect the empty value and treat it like an error has occurred.  But wait, wouldn&#8217;t that kind of put you back into the same mode of development that used to exist prior to exception handling in languages?  The kind of development where you always have to check the return value to see if an &#8220;error-value&#8221; was returned. I shudder at the thought!</p>
<h1>Handling Checked Exceptions Sensibly</h1>
<p>So, hopefully you see what I&#8217;m saying here. Generally, there is very little you can do to sensible respond to an SQLException, at least not that close to the SQL code. This leads me to Option 4, which is hardly ever used, but is in fact the most appropriate way to handle this case: Declare your SQL processing method declarations with &#8220;throws SQLException&#8221; on the end.  The theory here is that somewhere up the call  stack, in code that the SQL processing methods do not know about, there is a place in the application where the current &#8220;Operation&#8221; began and it is at that point in the application that you can generally handle an exceptional situation the most gracefully.</p>
<p>For instance, a web application may receive a request to display a specific record.  In response, the application prepares a pretty HTML view that contains a number of sections, such as a header, footer, navigation, top-level record information and finally the specific details of an item. To assemble all of the information, the view will likely call out to entity objects, other framework layers or at the very least other methods to retrieve the data records. Whatever the structure, the point is that it&#8217;s in the view presentation code that it&#8217;d make most sense to setup a try/catch and often times that&#8217;s a few method calls removed from the SQL code. In the simplest case you could just wrap the whole body in a try/catch, excluding the header/footer/navigation sections, and then if a failure occurs you could display an error message in the body while still allowing the user to attempt to navigate to other parts of your application.</p>
<h2>Third-Party API&#8217;s Prevent Elegant Handling</h2>
<p>Unfortunately, even if the developer gets smart and decides to try something like this, they often times run into another major issue with checked exceptions. Declaring that a method throws a checked exception, binds the method that calls it to the contract of either handling the checked exception or declaring that it also throws the exception. So by placing &#8220;throws SQLException&#8221; on all the methods, you&#8217;d be forcing all upstream users of your API to handle the SQLException in some way.  At first the solution may sound straight forward.  Just have all upstream methods declare &#8220;throws SQLException&#8221; and then the exception will unroll up the call stack to the desired spot.</p>
<p>It&#8217;d be great if that worked, but often times there are road-blocks in that wonderful idea.  The primary one being that you most likely don&#8217;t have control over every single method declaration.  Often times a layer of your code implements an interface from a third-party library and the interface probably doesn&#8217;t throw SQLException or whatever checked exception type you need to pass up the call stack.  So, what do you do.  You&#8217;re stuck.  Well, if you&#8217;ve ever found yourself in this situation, you do the only thing you can (unless you use the technique below).  At the interface method implementation, you wrap the checked exception in a RuntimeException and throw it up the call stack. Talk about ugly!</p>
<h1>Rethinking the Value of Checked Exceptions</h1>
<p>About this time you should be trying to reassure yourself that checked exceptions are a good thing and that such issues are just part of creating highly robust code. Ok, hopefully you&#8217;re not saying that, because again, ask yourself: What do you suppose you could do to reasonably recover from an exception being thrown by any random java.sql method?</p>
<p>Answer: Very Little. Keep in mind I said &#8220;reasonably recover&#8221;. Remember, that is in fact the purpose of checked exceptions. If the operation cannot be reasonably recovered from then the API should be throwing unchecked exceptions. In the case of the SQL API, there is very very few cases where a reasonable recovery is possible and even if you could dream up a recovery scheme, it&#8217;d probably be very costly to implement and unreasonable for 95% of the applications. And when you think about it, many API&#8217;s that use checked exceptions do so improperly. java.io? Hmm&#8230; IOException&#8230; couldn&#8217;t read from my file.  What can I do to recover from that within the context of my file read method? Nothing.</p>
<h2>What About Mission Critical Applications?</h2>
<p>But what if you&#8217;re writing a 100% mission-critical cannot go down under any circumstance or else I&#8217;ll loose my job and life kind of application?  The kind of application that runs the Mars Rovers or the New York Stock exchange or eBay. Well, great, invest in redundant servers, clusters, backups, replication models, use transactions, do extensive unit testing, end-user testing, stress testing, and apply sensible exception handling. But checked exceptions will not in anyway determine your success or failure.</p>
<p>Ok, ok.  Enough on that.  If you still think checked exceptions are great then no one will convince you otherwise and I&#8217;m sure the following code will really make your blood boil.</p>
<h1>How-To Bypass Checked Exceptions</h1>
<p>Recently I checked in a class called Reflector to the <a href="http://thinwire.svn.sourceforge.net/viewvc/thinwire/framework/trunk/src/thinwire/util/">thinwire.util package</a> of the framework&#8217;s dev trunk. One of the static methods on it has the signature:<br />
public static void throwException(Exception e);</p>
<p>It&#8217;s intended to be used in the following manner to first catch and then re-throw a checked exception in a manner that bypasses the checking that both compiler and byte code verifier do to make sure that checked exceptions are handled properly. Here&#8217;s how you might adjust the prior example to leverage the checked exception bypass:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> preformOperation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// You can simply call the retrival method without a try/catch</span>
    testRetrieval<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Or you can wrap it in a try catch to catch the checked exception</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        testRetrieval<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #003399;">SQLException</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// do something</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Assuming testRetrieval is the public API boundary</span>
<span style="color: #000000; font-weight: bold;">public</span> Info testRetrieval<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">Connection</span> con <span style="color: #339933;">=</span> <span style="color: #003399;">DriverManager</span>.<span style="color: #006633;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jdbc:odbc:test&quot;</span>,
                <span style="color: #0000ff;">&quot;user&quot;</span>, <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Connection To The Database Established...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        stmt <span style="color: #339933;">=</span> con.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Info info <span style="color: #339933;">=</span> getData<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> info<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Calls the special method that bypasses checking</span>
        throwException<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Unreachable code</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> Info getData<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> rNum<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    Info info <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">ResultSet</span> rs <span style="color: #339933;">=</span> stmt.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;select * from itable where po =&quot;</span>
            <span style="color: #339933;">+</span> rNum<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        info <span style="color: #339933;">=</span> getResultSet<span style="color: #009900;">&#40;</span>rs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// do nothing</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    rs.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> info<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> Info getResultSet<span style="color: #009900;">&#40;</span><span style="color: #003399;">ResultSet</span> rs<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    Info info <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Info<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    info.<span style="color: #006633;">setPo</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;po&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    info.<span style="color: #006633;">setType</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;type&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> info<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>What Does It Do?</h2>
<p>Assuming that the testRetrieval() method is a public API defining an operation. I added a higher level performOperation() method to serve as the user of the API. With that in mind, getData() and getResultSet() are really just methods used by testRetrieval and shouldn&#8217;t be part of the public API, so I made them private and altered them to just throw all Exceptions&#8217; (which includes checked exceptions) so that testRetrieval() receives all SQLExceptions&#8217; as well as all other Exceptions&#8217;. Then testRetrieval() serving as the public API, wraps it&#8217;s code-block in a try/catch.  The trick is that the catch block calls the bypass method thorwException(), which in turn re-throws the checked exception so that performOperation() can recieve it. Notice how the testRetreival() method does not declare that it throws any exception types.</p>
<p>Then in the performOperation() method that uses the testRetrieval() call, I can have the method called outside a try/catch, in which case any checked exceptions generated by testRetrieval() will simple be passed further up the call stack and eventually to the console or log file (hmm&#8230; sounds like a good default don&#8217;t you think?).</p>
<p>Optionally I can wrap the testRetrieval() call in a try/catch on the Exception type and then do an instanceof check in the catch block to see if the exception is in fact of the the checked exception type SQLException. It&#8217;s important to note that I cannot just catch SQLException because the compiler doesn&#8217;t know that we&#8217;ve just spoofed it so it&#8217;ll still expect testRetrieval() to declare that it throws an SQLException if you try to catch the exception as an SQLException.</p>
<h2>The throwException() Bypass Code from <a href="http://thinwire.svn.sourceforge.net/viewvc/thinwire/framework/trunk/src/thinwire/util/Reflector.java?view=markup">thinwire.util.Reflector</a></h2>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> throwException<span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ex <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #003399;">RuntimeException</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">RuntimeException</span><span style="color: #009900;">&#41;</span> ex<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #009900;">&#40;</span>CheckedExceptionThrower.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            CheckedExceptionThrower.<span style="color: #006633;">exception</span> <span style="color: #339933;">=</span> ex<span style="color: #339933;">;</span>
            CheckedExceptionThrower.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InstantiationException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">RuntimeException</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IllegalAccessException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">RuntimeException</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> CheckedExceptionThrower <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">Exception</span> exception<span style="color: #339933;">;</span>
&nbsp;
    CheckedExceptionThrower<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">Exception</span> ex <span style="color: #339933;">=</span> exception<span style="color: #339933;">;</span>
        exception <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">throw</span> ex<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>How In The Heck Does That Work?</h2>
<p>Well, an interestingly little nugget that I stumbled upon in the javadoc for java.lang.Class led to this solution. In the &#8220;newInstance()&#8221; method documentation it states:</p>
<p><em>&#8220;this method propagates any exception thrown by the nullary &#8216;zero-argument&#8217; constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler.&#8221;</em></p>
<p>This somewhat makes sense when you think about it. It means that if the reflection method newInstance() is used to dynamically create an object instance and the constructor for the object throws an exception, that exception whether checked or otherwise will be thrown by the newInstance() method. Thus, calling newInstance() behaves identically to statically constructing the same object in code (i.e. MyObject.class.newInstance() will throw the same exceptions that new MyObject() will). Of course, if you constructed the same class statically in code and the classes constructor threw a checked exception, the compiler would force you to use a try/catch to handle it. But since this is reflection based creation, it bypasses this behavior.</p>
<h2>What&#8217;s Happening Behind the Scene</h2>
<p>Ok, so this probably still doesn&#8217;t sit well with you. You&#8217;re probably wondering how does newInstance() get away with this? My first guess was that it was making a native call and it is, but in a manner different then you&#8217;d expect. The body of newInstance contains the following block of code that makes this all work:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Run constructor</span>
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> tmpConstructor.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InvocationTargetException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Unsafe.<span style="color: #006633;">getUnsafe</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">throwException</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getTargetException</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Not reached</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Isn&#8217;t that pretty! The Unsafe class comes from the &#8217;sun.misc&#8217; package. Interestingly enough it offers all sorts of unsafe operations, such as raw memory allocation, but that&#8217;s off topic.  The bottom line is that the throwException method on the Unsafe class allows checked exceptions to be thrown without the compiler knowing about it. And ultimately that&#8217;s what the throwException() method I provided above leverages.</p>
<h1>Compatibility Across VM&#8217;s</h1>
<p>So, you are probably wondering, does this work in other environments or just on Sun&#8217;s VM? Truth is that I&#8217;m not 100% sure, but if the environment is compliant with the the Class.newInstance() method specification, then this approach should work in that environment. And for compatibility reasons it&#8217;s unlikely that Class.newInstance() behaves differently in other environments. As far as I can tell, in the worst case scenario, another environment might wrap up the exceptions caught from the constructor in one of the documented checked exceptions that newInstance() can throw. But in those cases the code above will at least wrap those exceptions in a RuntimeException, thus guaranteeing solid compatibility in all environments.  Of course the real solution would be for Sun to wake up and just eliminate or significantly reduce the burden of checked exceptions.  But in the meantime, happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/bypassing-java-checked-exception-verification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping the User in Perspective with Ajax</title>
		<link>http://joshgertzen.com/keeping-the-user-in-perspective-with-ajax/</link>
		<comments>http://joshgertzen.com/keeping-the-user-in-perspective-with-ajax/#comments</comments>
		<pubDate>Wed, 19 Sep 2007 04:35:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-630290760163316279</guid>
		<description><![CDATA[Although I am a technologist and I like pushing the limits of technology, I try to look at things from a users perspective as often as possible to make sure that I&#8217;m creating value and not just making decisions that would lead to things that I think are cool.  End users, as most of [...]]]></description>
			<content:encoded><![CDATA[<p>Although I am a technologist and I like pushing the limits of technology, I try to look at things from a users perspective as often as possible to make sure that I&#8217;m creating value and not just making decisions that would lead to things that I think are cool.  End users, as most of us know, just want an application that works well and helps them do something they find important. The technology used to implement the application does not matter to them at all.  You get bonus points for going above and beyond that bar with flashy effects and eye candy, but only if you&#8217;ve got your bases covered first.</p>
<h2>Using Ajax Makes Sense <em>Sometimes</em></h2>
<p>Development managers need to ask themselves at least these two questions before adopting Ajax on a project. First, will you make up for the time invested in adopting a new technology through increased development speed? And second, will Ajax allow you to offer a more useful application to your users? Development managers are accustom to asking the first question about new technology because most organizations keep them focused on deadlines, budgets and getting functional requirements implemented quickly. However, really great organizations encourage their development managers to think about the user experience as well.</p>
<p><span id="more-142"></span></p>
<p>Now of course, nothing is that black and white, you also need to pick a project that makes sense. Success with Ajax has a lot to do with picking the right project to apply the technology to. Ideally, you want to bring in Ajax on an entirely new project or on a complete rewrite effort of an existing application. While enhancement projects to existing applications can work, they take a lot more planning and coordination and should only be done if you are positive the results will be a big gain with the users.  Since users have a certain expectation of how an existing application should work, any change to the application will be scrutinized much more closely and any negative reaction may overshadow the benefits you tried to add by using Ajax.</p>
<h2>Full Integration Saves Time</h2>
<p>In terms of a time savings, there is no question that Ajax and especially full scale Rich Internet Application (RIA) frameworks have the potential of significantly reducing the time it takes to develop web applications.  The main hurdle that exists right now is legacy applications and the prior web development paradigms on which they are built.  Many of the Ajax frameworks out there focus on adding another layer to the existing web development model, which typically leads to increased application complexity since there are more moving parts.</p>
<p>Therefore, IMHO the greatest gains with Ajax are to be realized with fully integrated frameworks that are designed around the power of Ajax from the start.  Frameworks like Rails, Grails and others provide tighter integration but they stop short of eliminating the request/response model, page flow semantics as well as other outdated paradigms. Additionally, they still require the developer to work with a number of separate technologies ([D]HTML, DOM, JS, CSS, etc.) and toolkits (<a href="http://dojotoolkit.org/">Dojo</a>, <a href="http://www.prototypejs.org/">Prototype</a>, <a href="http://script.aculo.us/">Scriptaculous</a>, etc.) rather than providing a single development technology like desktop applications have traditionally done. In contrast, server-integrated Ajax RIA&#8217;s such as <a href="http://www.thinwire.com">ThinWire</a>, <a href="http://www.nextapp.com/platform/echo2/echo/">Echo2</a> and others, cut out the complexity and provide the developer with a single homogeneous development environment.  Such frameworks allow the developer to focus on building a great application and not on the underlying details.  Anytime a technology can do that for your developers, you can realize a significant reduction in the time required to finish your projects.</p>
<p>In fact, these kinds of frameworks nearly close the gap between web and desktop applications. Unless you explicitly need access to lower-level desktop resources like the graphic card, sound card or file system, there is no longer any reason to build desktop applications. And even in those cases, you&#8217;re better off building an RIA app and then using browser extensions to provide the appropriate restricted access to desktop resources where required.</p>
<h2>Planning Trumps All</h2>
<p>The bottom line is that a little proper planning and the right Ajax framework selection for a project can lead to excellent wins for the developers in terms of time savings and for the users in terms of a more powerful and useful application. However, improper planning and implementing Ajax technology just for the sake of saying you use &#8220;Ajax&#8221; is almost always a loosing scenario for everyone involved.</p>
<p>Happy Coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/keeping-the-user-in-perspective-with-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ThinWire At JavaOne 2007 Conference</title>
		<link>http://joshgertzen.com/belated-thinwire-javaone-2007-conference-details/</link>
		<comments>http://joshgertzen.com/belated-thinwire-javaone-2007-conference-details/#comments</comments>
		<pubDate>Sat, 16 Jun 2007 05:34:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Conference]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[ThinWire]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-4489768894158837341</guid>
		<description><![CDATA[Ok, well this is coming a bit late I realize, but we have been quite busy working on a surprise for the ThinWire community, so I haven&#8217;t had a good moment to sit down and tell everyone about our JavaOne experience. As for the surprise, details arriving soon&#8230; in another post.
As a basic exhibitor at [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, well this is coming a bit late I realize, but we have been quite busy working on a surprise for the ThinWire community, so I haven&#8217;t had a good moment to sit down and tell everyone about our JavaOne experience. As for the surprise, details arriving soon&#8230; in another post.</p>
<p>As a basic exhibitor at JavaOne, we didn&#8217;t get to attend the actual sessions. This is a departure from the other conferences where you&#8217;re usually given at least one full conference pass. In the end, it probably wouldn&#8217;t have mattered that much though because I&#8217;m usually too busy talking to people about the framework to spend time in any of the conference sessions. The good news is that unlike my New York experience, I had someone along to help out. In this case it was Brian Shaw, the CCS company CEO &amp; President. I guess it figures that he&#8217;d leave me hanging at the other shows and only pop in for an appearance at the biggest show&#8230; hehe, he knows I&#8217;m kidding. Brian has long been a major supporter of my teams effort to bring this framework to the people. In any case, here&#8217;s what the startup booth on the Pavilion floor looked like with the new and updated splashy ThinWire graphics:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157558330/" title="CIMG0095 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2718/4157558330_0f7dc2c0fe.jpg" width="500" height="375" alt="CIMG0095" /></a></p>
<p><span id="more-143"></span></p>
<p>Like the other conferences I&#8217;ve been to, the first day was the the toughest. Usually it&#8217;s more hectic because you&#8217;re getting setup, you&#8217;re double-checking everything to make sure everything is working and you&#8217;re warming up your &#8220;Hey! Have you heard about ThinWire!&#8221; speech. In this case, the pavilion floor was open from 10am till 8pm the first day and we had a strong stream of visitors to our booth all day long. We gave out well over 100 fliers and held countless conversations. I thought for sure I was going to loose my voice due to all the conversations I was having. One thing that I found interesting was getting reminded throughout the day that not every Java developer writes web applications. It was definitely the largest contingent there, but there were a surprising number of mobile and embedded developers at the show as well as some big name companies that had embedded Java products. Here&#8217;s a few of our direct neighbors:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157560402/" title="CIMG0116 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2489/4157560402_ea1a411fb8.jpg" width="500" height="375" alt="CIMG0116" /></a></p>
<p>Another contingent that made a decent showing were various robotics developers. While I got the impression this was more for the &#8220;cool&#8221; factor than anything too practical, it was still neat to meet some of these people and see what they had done:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157560266/" title="CIMG0115 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2663/4157560266_b822aef329.jpg" width="500" height="375" alt="CIMG0115" /></a></p>
<p><a href="http://www.flickr.com/photos/jgertzen/4156799871/" title="CIMG0114 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2485/4156799871_6e711f6e16.jpg" width="500" height="375" alt="CIMG0114" /></a></p>
<p>The first is a submarine that sits in the tang you see behind it. I was talking to the guys and they were having trouble getting the WiFi connection between it and their computer working (WiFi overload), so instead they were using a hot glue gun to attach an actual cat5 cable to the robot directly&#8230; hmm&#8230; cat5 and water. I saw the thing running later on, so I guess they got it working. The helicopter on the right just sat on display the whole time, nothing to fancy. The robot below claims to be the fastest robot in the world&#8230; I guess at drawing pictures, but I&#8217;m not too sure that Java has anything to do with it&#8217;s speed. Gotta love the hype machine!</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4156799749/" title="CIMG0113 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2710/4156799749_46578440c4.jpg" width="500" height="375" alt="CIMG0113" /></a></p>
<p>While at the conference, I met up with a number of interesting people from some of the other big Java and open-source companies. In particular, I had a good conversation and provided many demos of ThinWire to various people from JBoss that wandered over to our booth. They seemed really impressed with what we were doing&#8230; and at one point Ram Venkataraman, Director of Product Management, showed up to get a preview as well. So don&#8217;t be too surprised if one of their initiatives suddenly starts to look something like ThinWire <img src='http://joshgertzen.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  In truth, we might be talking to these guys more in the future.</p>
<p>I also made it a point to stop by the Interface 21 booth and speak to some of their folks. If you don&#8217;t know this, Spring is a great alternative framework to Java EE and a couple people I personally know have integrated Spring with ThinWire to create a powerful solution. One of my friends runs a local Spring User Group here in the Dallas area and happens to have met Keith Donald, the Spring principal I spoke with. In any case, I drug Kevin to our booth and warmed him up to the ThinWire way. He arrived somewhat begrudgingly, but by the time he had to leave, the other Spring guys had to drag him away reluctantly! (I exaggerate a bit&#8230; but hey&#8230; at least he was impressed with the framework).</p>
<p>Another cool person I met is Greg Wilkins of WebTide. The brains behind the Jetty Servlet engine. We&#8217;ve been very impressed with Jetty for quite sometime now because of it&#8217;s small size, super fast speed and it&#8217;s Servlet spec enhancements that make true Ajax Push a possibility. At some point we&#8217;d like to explore the changes that are necessary to enable this feature in ThinWire when you&#8217;re running on the Jetty platform.</p>
<p>Finally, I ran into Chris Richardson, the author behind &#8220;POJOs in Action&#8221;. Chris has experience with some of the concepts that we use in ThinWire and he finds the approach to be very powerful. We spoke with him for a bit and showed him the usual fair of demos. He apparently liked what we had because he went back home and started getting to work on a project that uses ThinWire with the Groovy scripting language. Here&#8217;s the first part in a blog post he recently did about his efforts.</p>
<p>Here&#8217;s the classic JavaOne bean bag picture:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157560784/" title="CIMG0119 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2689/4157560784_7a2b3bbbbe.jpg" width="500" height="375" alt="CIMG0119" /></a></p>
<p>We had a great time talking to everyone at the conference. The audience at JavaOne is exactly the kind of people who would be interested in the framework and everyone who did web development that stopped by to talk to us was quite amazed by ThinWire. We even ended up with a couple people who just couldn&#8217;t get over it and hung around all slack jawed as they repeatedly said how they couldn&#8217;t believe what we were doing. Not sure I&#8217;d call those people groupies, but if there is such a thing in the software world, I guess that would be it. In any case, we are always happy to see that kind of feedback as you might imagine.</p>
<p>Now if Sun could just get over themselves and wake up to the realities of the web &amp; Ajax&#8230; I mean seriously, they wouldn&#8217;t shut up about JavaFX&#8230; as if repackaging an Applet with some new features is going to offer a superior solution. If you follow the hype machine they&#8217;ve been fueling, they essentially claim that JavaFX will kill Ajax&#8230; uhh&#8230; yeah&#8230; good luck with that Sun&#8230; cause you have a great record recently of making some great strategic decisions. In any case, maybe I&#8217;m just venting because they didn&#8217;t pick ThinWire for a Duke Choice award and instead picked&#8230; well, other projects that I&#8217;m sure are way more worthy, but I&#8217;ll let you all be the judge of that.</p>
<p>We wrapped up the conference on the last day by doing an interview with our friends at Sys-Con TV. They fit us in before the conference floor open because we had to catch an early flight back. Neither Brian or I are very lively in the interview because it was so early… and then my cell phone goes off in the first minute (*doh*)&#8230; but other than that it was a good end to a great conference.</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/belated-thinwire-javaone-2007-conference-details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back from AJAXWorld East 2007</title>
		<link>http://joshgertzen.com/back-from-ajaxworld-east-2007-other-interesting-bits/</link>
		<comments>http://joshgertzen.com/back-from-ajaxworld-east-2007-other-interesting-bits/#comments</comments>
		<pubDate>Mon, 26 Mar 2007 03:45:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ThinWire]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-4482003292421618524</guid>
		<description><![CDATA[I just got back last night from New York and I thought I&#8217;d spend a few minutes letting everyone know how things went. The first day was a little taxing&#8230; I had to lug a 22&#8243; flat panel screen, large suite case with conference goodies, and my laptop bag over a half mile from my [...]]]></description>
			<content:encoded><![CDATA[<p>I just got back last night from New York and I thought I&#8217;d spend a few minutes letting everyone know how things went. The first day was a little taxing&#8230; I had to lug a 22&#8243; flat panel screen, large suite case with conference goodies, and my laptop bag over a half mile from my hotel to the Roosevelt hotel that was hosting the event. As a side note, I have to say that New York was quite amazing. It was my first time there and I tried not to act to much like a tourist, but I couldn&#8217;t get over how enormous the place is and how the buildings are crammed right next to each other. Additionally, it was pretty cool to see the culture and people change from street to street&#8230; lots to see and do.</p>
<p>In any case, after lugging everything to the hotel, I hunted down the conference reservation &#038; sign-in desk, which was somewhat difficult to get to on a mezzanine above the lobby. After signing up, I made my way back down to the lobby and to a little landing right off the lobby where the empty ThinWire table awaited. Here’s what it look like after getting set up:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157600592/" title="CIMG0019 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2743/4157600592_edb63c8474.jpg" width="500" height="375" alt="CIMG0019" /></a></p>
<p><span id="more-144"></span></p>
<p>After getting setup, I spent the remainder of the first day talking to people and sitting around hacking on code while I waited for people to show up. Since most of the attendees were there to see the sessions, there were only certain times during the day when they were out and about visiting the various exhibitor booths. At the conclusion of the first day, the largest sponsor of the event, Laszlo Systems (a Flash based solutions provider), hosted a boat party at New York harbor, at which I got the opportunity to meet a lot of other vendors and find out what they had to offer. Here&#8217;s a picture I took from the boat:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157602396/" title="CIMG0046 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2716/4157602396_71fb8b2c8c.jpg" width="500" height="375" alt="CIMG0046" /></a></p>
<p>On the second day, things got a little more interesting. The bulk of the day was pretty much the same, answering lots of questions and telling people about ThinWire, but in addition to that I had the chance to participate in a recorded one-on-one interview with Jeremy Geelan, the conference chair. I&#8217;ve spoken with Jeremy a few times in the past via email and in person and he&#8217;s a great guy with a lot of enthusiasm for technology. Well, he and the technology chair of the conference Dion Hinchcliffe, have been interested in ThinWire for a while now and what it can mean for the enterprise, so when a slot became available for an interview I was asked to participate. Here&#8217;s a picture of another guy doing an interview with Jeremy (guy on the left), unfortunately no one grabbed a photo of me during my interview:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4156840653/" title="CIMG0026 by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2576/4156840653_3de7eccb1b.jpg" width="500" height="375" alt="CIMG0026" /></a></p>
<p>The interview was a great time to talk about a recent development with ThinWire. We&#8217;ve recently announced an arrangement with another Ajax company called <a href="http://www.helmi.com/">Helmi Technologies</a>, who has a client-centric component framework with some unique capabilities. We&#8217;ve been in talks with these guys for the past six months, but the conference provided the perfect opportunity to <a href="http://ajaxworld.com/read/351001.htm">release a press statement about this arrangement</a>. I&#8217;ll elaborate more on what this will mean in a future blog post, but feel confident in the fact that ThinWire will remain LGPL forever and we will not do anything to the server-development model that will impact your investment in using the framework. The initial goal is simply to make our technologies inter-operate with each other so that both technologies will have the option to leverage the advantages of the other.</p>
<p>While the second day was great, the third day was even better. Like the past two days I met with a number of people who found ThinWire&#8217;s approach powerful and were very interested in using it for their development. Additionally, I had the opportunity to participate in one of the discussion panels, moderated by Jeremy Geelan. The focus of the panel was discuss SYS-CON.TV Power Panel &#8220;How Far Are We Along On Our Way To The Rich Web?&#8221;. The video of this will also be online in a few days, so I&#8217;ll be sure to post it when it becomes available. While the power panel opportunity was cool, it was nothing like what happen next.</p>
<p>My session was scheduled for 2:40pm and when I first walked into the room I&#8217;d been assigned, it was nice and it could easily sit 60 people. The cool thing is that upon walking in, there was already 30 people there, so it looked like it might fill up. But before I could get settled, Geelan walked up to me and said, well&#8230; it turns out that we have an opening in the Grand Ball room, would like to move over there? I said, sure&#8230; so, we proceeded to move everyone who was there into the huge room that was adjacent to one I was in. And man, this place could easily sit 400 people&#8230; it was huge, and it had two projection screens on which to display my slides. But the coolest thing is that sessions in the grand ball room are filmed and put up online for everyone to watch, so again, I&#8217;ll post the link as soon as it becomes available. Thanks to the ballroom&#8217;s size and the fact that there were other people just hanging out in the room when I walked in, I ended up presenting to well over 100 people. Here I am at the podium after giving the presentation, you can see the playground app that I just demonstrated running in the background:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157600978/" title="AJAXWorld07-Session by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2677/4157600978_b1aac31a7f.jpg" width="468" height="351" alt="AJAXWorld07-Session" /></a></p>
<p>And <a href="http://ajaxworld.com/read/352113.htm">here&#8217;s the short article</a> that the conference organizers put up about this presentation. In any case, as you can see, things went really well&#8230; lots of interest in what we are doing in this grassroots framework. There’s more exciting things to come, but I can&#8217;t divulge too much right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/back-from-ajaxworld-east-2007-other-interesting-bits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effective AJAX for Everyone</title>
		<link>http://joshgertzen.com/effective-ajax-for-everyone-including-the-enterprise/</link>
		<comments>http://joshgertzen.com/effective-ajax-for-everyone-including-the-enterprise/#comments</comments>
		<pubDate>Wed, 07 Feb 2007 03:24:00 +0000</pubDate>
		<dc:creator>Josh Gertzen</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ThinWire]]></category>

		<guid isPermaLink="false">tag:blogger.com,1999:blog-12006049.post-7557427966081831488</guid>
		<description><![CDATA[Well, this has been in the works since November and it’s finally arrived. An article I wrote last year titled Effective AJAX for Everyone ‘Including the Enterprise’, has just been published in the February edition of AJAXWorld magazine. The great thing about this is that you can go download the entire magazine for free, or [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this has been in the works since November and it’s finally arrived. An article I wrote last year titled Effective AJAX for Everyone ‘Including the Enterprise’, has just been published in the February edition of AJAXWorld magazine. The great thing about this is that you can go <a href="http://ajax.sys-con.com/general/pdfdownload.htm?issue=783">download the entire magazine for free</a>, or view it online directly on AJAXWorld magazine website. The February edition is the one of the right with the title “AJAX On The Enterprise” on it’s cover. I’ve been told that the paper publication of the magazine will be available at your local news stand sometime in the next couple weeks. The prior edition appears to have <a href="http://ajax.sys-con.com/read/288296.htm">made it to the Barns &#038; Noble book stores</a>, so keep an eye out for this latest volume:</p>
<p><a href="http://www.flickr.com/photos/jgertzen/4157623102/" title="AjaxWorld_FebMagLogo by gertzen, on Flickr"><img src="http://farm3.static.flickr.com/2509/4157623102_c2835ba2bf_m.jpg" width="175" height="224" alt="AjaxWorld_FebMagLogo" /></a></p>
<p>On a related note, keep in mind that I’m going to be <a href="http://www.ajaxworldconference.com/general/session07.htm?id=21">presenting at the AJAXWorld conference</a> next month in New York City (March 19 &#8211; 21). So if you can, sign up for the conference and come talk to members from the ThinWire team in person. The topic I’m going to be covering is centered around the article that was just published in February’s edition, but it will be much more hands on and interactive.</p>
<p>Hope to see you all there!</p>
]]></content:encoded>
			<wfw:commentRss>http://joshgertzen.com/effective-ajax-for-everyone-including-the-enterprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

