<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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" version="2.0">

<channel>
	<title>Tech Per</title>
	
	<link>http://www.techper.net</link>
	<description>About Technology in My Life</description>
	<pubDate>Sun, 30 Nov 2008 11:39:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/TechPer" type="application/rss+xml" /><item>
		<title>Is DDD Worth It? It Surely Aint Gonna Save Us!</title>
		<link>http://www.techper.net/2008/11/19/is-ddd-worth-it-it-surely-aint-gonna-save-us/</link>
		<comments>http://www.techper.net/2008/11/19/is-ddd-worth-it-it-surely-aint-gonna-save-us/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 21:10:10 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[DDD]]></category>

		<category><![CDATA[domain]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=161</guid>
		<description><![CDATA[In this post, I will play the devils advocate a bit.
I attended several of the sessions in the Domain Driven Design (DDD) track on Øredev 2008 today, and to the end of the panel debate, I kind of got to thinking: &#8220;Why actually bother ourselves with DDD?&#8221;
Now, don&#8217;t get me wrong here. I actually like [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, I will play the devils advocate a bit.</p>
<p>I attended several of the sessions in the <a title="Domain Driven Design" href="http://www.domaindrivendesign.org/">Domain Driven Design</a> (DDD) <a href="http://www.oredev.org/topmenu/program/trackdomaindrivendesign.4.2c4b8bee11a31fca49e8000832.html">track</a> on <a href="http://www.oredev.org/">Øredev</a> 2008 today, and to the end of the panel debate, I kind of got to thinking: &#8220;Why actually bother ourselves with DDD?&#8221;</p>
<p>Now, don&#8217;t get me wrong here. I actually like the idea of extra emphasis on domain modelling in our profession. Indeed, I wrote &#8220;DDD Wanna-Be&#8221; as the tagline on my conference pass. I really wanna do DDD. By I also got to thinking: &#8220;Why, actually?&#8221;</p>
<h2>Being the Devils Advocate</h2>
<p>It is old knowledge in the computer science industry, that no new tool or language are going to make us orders of magnitude more productive than yesterday. When going from <span style="text-decoration: line-through;">imperative</span> procedural to object-oriented programming, we get to express models in another way, said to be more like the real world. But it really does not make us any more productive than we were in the imperative thinking.</p>
<p>Likewise with DDD. I cannot see it making us orders of magnitude more productive, than when not doing DDD. I really do not. Sure, distilling the core domain seems a good idea, and protecting it with an anti-corruption layer might also be a good idea. And so on. But overall, the development of an application will not go way faster as a consequence of applying DDD. Actually, I think applying DDD to your application development can have the effect of slowing you down. At least while you learn. This is okay, if there is a bonus in the end. But is there?</p>
<p>And do the computing industry actually need saving? It is repeated again and again, how too little focus on domain modelling will create messy, unmaintainable systems. Maybe so. Maybe not. In close co-operation with colleagues and clients I have helped build lots of systems, that both meet the users needs by supporting the business domain while at the same time being maintainable. And we were not practising DDD.</p>
<h2>Back to Being Myself Again</h2>
<p>So why do I still like the idea of striving for more domain modelling?</p>
<p>Maybe because I find it an interesting academic exercise. Maybe because I see emerging DDD-supporting, interesting technology in stuff like spring load-time-weaving to inject into all of the domain, that I will get to play with then. Maybe because it is something new. Maybe to not be bored by always doing what I did yesterday, even though it worked for me just fine yesterday. Maybe to bring the fun back.</p>
<p>Do you do DDD? And if so, why? Honestly <img src='http://www.techper.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/458824722" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/11/19/is-ddd-worth-it-it-surely-aint-gonna-save-us/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The D Programming Language Is Not For Me</title>
		<link>http://www.techper.net/2008/11/19/the-d-programming-language-is-not-for-me/</link>
		<comments>http://www.techper.net/2008/11/19/the-d-programming-language-is-not-for-me/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 20:21:35 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[D]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=159</guid>
		<description><![CDATA[Today at Øredev 2008, I learned about the programming language D, but also that D is not for me.
I had not had the chance yet, to sit down and take a look at D, so I thought it would be a nice idea for me to attend the session named &#8220;What Makes a Programming Language [...]]]></description>
			<content:encoded><![CDATA[<p>Today at <a title="Øredev Conference" href="http://www.oredev.org/">Øredev</a> 2008, I learned about the <a title="the D programming language" href="http://www.digitalmars.com/d/">programming language D</a>, but also that <a href="http://www.digitalmars.com/d/">D</a> is <em>not</em> for me.</p>
<p>I had not had the chance yet, to sit down and take a look at <a href="http://www.digitalmars.com/d/">D</a>, so I thought it would be a nice idea for me to attend the session named &#8220;<a href="http://www.oredev.org/topmenu/program/trackcoollanguages/walterbright.4.3efb083311ac562f9fe80007227.html">What Makes a Programming Language Productive?</a>&#8221; by <a href="http://www.walterbright.com/">Walter Bright</a>, one of the people behind <a href="http://www.digitalmars.com/d/">D</a>. So I had completely no knowledge of <a href="http://www.digitalmars.com/d/">D</a> before I entered the session.</p>
<p>Now, the conference material did not mention anything about <a href="http://www.digitalmars.com/d/">D</a> being a <em>systems programming</em> language, something I kind of found out half-way through the session. And now I also understand why the language designers thought they had done some great things with stuff like automatic memory management and garbage collection, no pre-processor, automatic documentation generation from comments in the source, type inference, etc&#8230;</p>
<p>But, being an <em>application</em> developer myself, working with languages like Java and C# in addition to easy access to dynamic languages on the VM, not many of the constructs seem new or that special to me. But I guess they will be for C and C++ programmers doing systems programming.</p>
<p>But this is not the only thing that I find not to be for me.</p>
<p>The <a href="http://www.digitalmars.com/d/">D</a> language is said to support <em>multi-paradigm programming</em>. What this means is, that you can write imperative code in the old C-style, object-oriented code, inline assembler, template meta-programming and soon also functional programming in the same language - namely <a href="http://www.digitalmars.com/d/">D</a>.</p>
<p>Walter said this to be an advange. If for example, you wanted to express a part of your program in another paradigm, you would not have to learn a new language and interface with that from your <a href="http://www.digitalmars.com/d/">D</a> program. True, I guess, to some extent, at least about the integration part. But these are <em>completely different paradigms</em>. Learning to program in a functional language aint that much about syntax, but very much about understanding problem solving in the functional paradigm. Likewise in an imperative or object-oriented paradigm.</p>
<p>But <a href="http://www.digitalmars.com/d/">D</a> tries to express multiple paradigms in <a href="http://www.digitalmars.com/d/">D</a> alone. That way you won&#8217;t have to switch programming language, to express something in another paradigm. I would really think that another design goal of <a href="http://www.digitalmars.com/d/">D</a>: &#8220;Have a short learning curve for programmers comfortable with 	programming in C or C++&#8221; would go against its goal of being multi-paradigm.</p>
<p>How can one syntax support all those paradigms in a nice and concise manner?</p>
<p>How can the semantics of interoperating code between several paradigms be done simple enough, for it to be understandable and usable?</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/458779991" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/11/19/the-d-programming-language-is-not-for-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RubyMine - A New Ruby IDE</title>
		<link>http://www.techper.net/2008/11/04/rubymine-a-new-ruby-ide/</link>
		<comments>http://www.techper.net/2008/11/04/rubymine-a-new-ruby-ide/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 21:33:52 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[jetbrains]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=157</guid>
		<description><![CDATA[Here is something interesting.
JetBrains is releasing their ruby and rails support in IDEA as a specially targetted product called RubyMine. I just took a download of the preview and tried it out. To a long term IDEA user, it looks an awful lot like, &#8230; IDEA  I guess it is &#8220;just&#8221; a slimmed down [...]]]></description>
			<content:encoded><![CDATA[<p>Here is something interesting.</p>
<p><a href="http://www.jetbrains.com/">JetBrains</a> is releasing their ruby and rails support in IDEA as a specially targetted product called <a href="http://www.jetbrains.com/ruby/">RubyMine</a>. I just took a download of the preview and tried it out. To a long term IDEA user, it looks an awful lot like, &#8230; IDEA <img src='http://www.techper.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> I guess it is &#8220;just&#8221; a slimmed down version of IntelliJ IDEA, with &#8220;only&#8221; the ruby and rails support, together with various VCS plugins.</p>
<p>This is actually what Sun have been doing with Netbeans for some time now. Providing a slimmed down download of Netbeans, that only includes their support for ruby and rails.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/442542940" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/11/04/rubymine-a-new-ruby-ide/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Importance of URL Input Encoding and How To Set It</title>
		<link>http://www.techper.net/2008/11/04/importance-of-url-input-encoding-and-how-to-set-it/</link>
		<comments>http://www.techper.net/2008/11/04/importance-of-url-input-encoding-and-how-to-set-it/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 19:50:32 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[encoding]]></category>

		<category><![CDATA[tomcat]]></category>

		<category><![CDATA[weblogic]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=154</guid>
		<description><![CDATA[A while ago, we had a problem with international characters being mangled on parameters from an URL, which at the end made us uncover, that we had just relied on defaults for the setting of URL Input Encoding. And that can be a problem.
What URL Input Encoding Is
When a HTTP GET or POST request arrive [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, we had a problem with international characters being mangled on parameters from an URL, which at the end made us uncover, that we had just relied on defaults for the setting of URL Input Encoding. And that can be a problem.</p>
<h2>What URL Input Encoding Is</h2>
<p>When a HTTP GET or POST request arrive at a servlet-container, the container implementation must interpret the incoming characters using some character set. In the case of a POST request, the web application developer has a chance to submit this information explicitly, by including this element in the FORM:</p>
<p><code>&lt;input type="application/x-www-form-urlencoded; charset=charsetNameHere"&gt;</code></p>
<p>In the case of a GET request, there is no way to set this information, so the container use a default. I do not think, that the servlet specification mandates a specific default. In all cases, I think it is wise to uncover what it is set to for your container, and set it explicitly if it does not match your clients.</p>
<h2>Setting Input Encoding on Tomcat</h2>
<p>On tomcat, it is in the <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/http.html">Connector element in server.xml</a>, that you specify this setting. Here is an example of a <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/http.html">Connector element</a> that includes the setting:</p>
<p><code>&lt;Connector<br />
port="8080"<br />
maxThreads="150"<br />
minSpareThreads="25"<br />
maxSpareThreads="75"<br />
enableLookups="false"<br />
redirectPort="8443"<br />
acceptCount="100"<br />
debug="0"<br />
connectionTimeout="20000"<br />
disableUploadTimeout="true"<br />
URIEncoding="UTF-8" /&gt;<br />
</code></p>
<p>If not set, tomcat defaults to ISO-8859-1.</p>
<h2>Setting Input Encoding on Weblogic</h2>
<p>On Weblogic, the setting is done in the <a href="http://edocs.bea.com/wls/docs70/webapp/webappdeployment.html#1006657">weblogic.xml deployment descriptor</a>, using the <a href="http://edocs.bea.com/wls/docs70/webapp/weblogic_xml.html#1037173">input-charset element</a>. Here is a small example:</p>
<p><code>&lt;input-charset&gt;<br />
&lt;resource-path&gt;/some/url/resource&lt;/resource-path&gt;<br />
&lt;java-charset-name&gt;UTF-8&lt;/java-charset-name&gt;<br />
&lt;/input-charset&gt;<br />
</code></p>
<p>It appears that weblogic supports setting this more fine-grained than tomcat, as you can set a resource url for the setting to apply to.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/442444278" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/11/04/importance-of-url-input-encoding-and-how-to-set-it/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Module Settings are Moving in IntelliJ IDEA 8</title>
		<link>http://www.techper.net/2008/11/04/module-settings-are-moving-in-intellij-idea-8/</link>
		<comments>http://www.techper.net/2008/11/04/module-settings-are-moving-in-intellij-idea-8/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 19:21:16 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[IDEA]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=151</guid>
		<description><![CDATA[Shortly before the soon coming final release of IDEA8, a completely new settings dialog started to appear on the EAP versions. With it, I found myself totally lost, because I was used to navigating directly into my module settings by hitting Ctrl-Alt-S + 1.
Actually, it took me a while to discover where the module settings [...]]]></description>
			<content:encoded><![CDATA[<p>Shortly before the <a href="http://www.jetbrains.com/idea/nextversion/">soon coming</a> final release of IDEA8, a completely new settings dialog started to appear on the <a href="http://www.jetbrains.net/confluence/display/IDEADEV/Diana+EAP">EAP versions</a>. With it, I found myself totally lost, because I was used to navigating directly into my module settings by hitting <tt>Ctrl-Alt-S + 1</tt>.</p>
<p>Actually, it took me a while to discover where the module settings had been moved to. Not that they were hard to find when I actually started looking for them, but simply because I thought JetBrains were in the middle of reworking them into the new settings dialog.</p>
<p>It turns out, that the module settings have moved to another place altogether.</p>
<h2>The Old Module Settings at its New Place</h2>
<p>In IDEA 8, you can enter the (old style) module settings by hitting <tt>Ctrl-Alt-Shift-S</tt>, which will take you to a dialog like the one you entered through the old settings plus hitting 1 (one). You can also enter them by clicking the little icon in the top bar next to the old settings icon or by right-clicking a module in the project navigator and choose &#8220;Module Settings&#8221; near the bottom of the popup menu.</p>
<h2>The New Settings Dialog</h2>
<p>The old hot-key &#8220;Ctrl-Alt-S&#8221; now leads to a IDEA/Project settings only dialog, in which things like JDK, libraries, facets and modules <em>cannot</em> be edited anymore. Instead, you can edit IDE-wide settings like fonts, colors, plugins, &#8230; or project-wide settings like VCS settings, maven integration, &#8230; In fact, if you hit <tt>Ctrl-Alt-S</tt> without a project open, you can edit &#8220;new project default&#8221; settings too.</p>
<p>The navigation of the reworked settings dialog somehow reminds me of how Eclipse works in its settings. Hmm&#8230; I am not sure what to think of that, but lets see how it works over time.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/442414346" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/11/04/module-settings-are-moving-in-intellij-idea-8/feed/</wfw:commentRss>
		</item>
		<item>
		<title>4 Things To Hate About PureMVC</title>
		<link>http://www.techper.net/2008/10/05/4-things-to-hate-about-puremvc/</link>
		<comments>http://www.techper.net/2008/10/05/4-things-to-hate-about-puremvc/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 19:47:23 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Rich Internet Applications]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=143</guid>
		<description><![CDATA[Previously, I have written about how puremvc takes a stand on patterns of gui architecture while Cairngorm does not. I have also proclaimed to colleagues, that I do not find puremvc especially great, but at the same time find it &#8220;good enough&#8221;, which is to be understood as: The current contenders are (were?) not any [...]]]></description>
			<content:encoded><![CDATA[<p>Previously, I have written about how <a href="http://www.techper.net/2008/06/09/patterns-of-gui-architecture-in-cairngorm-and-puremvc/">puremvc takes a stand on patterns of gui architecture</a> while Cairngorm does not. I have also proclaimed to colleagues, that I do not find puremvc especially great, but at the same time find it &#8220;good enough&#8221;, which is to be understood as: The current contenders are (were?) not any better, and puremvc solves the problem.</p>
<p>After using puremvc for real for some time now, I have collected a list of things, where I find puremvc <em>getting in the way</em>.</p>
<p>Here it goes&#8230;</p>
<h2>1. Use of Service Locator instead of Dependency Injection</h2>
<p>Two patterns for letting a software components resolve its dependencies on other components are <a title="Service Locator" href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html">Service Locator</a> and <a href="http://martinfowler.com/articles/injection.html#FormsOfDependencyInjection">Dependency Injection</a>. Of the two, puremvc use the <a title="Service Locator" href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html">Service Locator</a> pattern, which I like the <em>least</em>. As an example, let us take a simple command:</p>
<pre name="code" class="javascript">

public class ExampleCommand extends SimpleCommand {
  override public function execute(note : INotification) : void {
    var clientDataProxy : ClientDataProxy = facade.retrieveProxy(ClientDataProxy.NAME) as ClientDataProxy;
    clientDataProxy.getExampleData();
  }
}
</pre>
<p>What this command class does, is to ask a service locator (the <tt>facade.retrieveProxy</tt> call), through a <em>direct dependency</em> on the puremvc api, to get an implementation of a <tt>ClientDataProxy</tt> service. Next thing is to call actual services on that proxy.</p>
<p>Here is how I would like it to have been:</p>
<pre name="code" class="javascript">

public class ExampleCommand extends SimpleCommand {
  [Inject] private var clientDataProxy : ClientDataProxy;

  override public function execute(note : INotification) : void {
    clientDataProxy.getExampleData();
  }
}
</pre>
<p>There is no code here, that looks up the service. There is only the usage of the service. For one thing, the service lookup code only clutters up the code, as it has nothing to do with what the application is doing. Another thing is the direct dependency in the puremvc api to lookup the service. Both are things not welcome in the code.</p>
<h2>2. Casting, Casting, Casting</h2>
<p>Again, taking a line from the example above:</p>
<pre name="code" class="javascript">

    var clientDataProxy : ClientDataProxy = facade.retrieveProxy(ClientDataProxy.NAME) as ClientDataProxy;
</pre>
<p>Wow! I am writing the type again, and again, and again. All the retrieve calls in puremvc have rather wide return types, hence the need for all the casting.</p>
<p>And it is not only the retrieval of proxies and mediators, that needs casting to specific types. It is also when extracting data from the notifications. Like this:</p>
<pre name="code" class="javascript">

   var user : User = notification.getBody() as User
</pre>
<p>This is partly because AS3 has no generics/templating system, partly because of puremvc design (notifications are not application specific classes) and partly due to the use of service locator and not dependency injection.</p>
<p>Anyway, it is damned irritating.</p>
<h2>3. Forced Inheritance Everywhere</h2>
<p>Anywhere I go, I <em>need to inherit a puremvc base class</em>. This is hard to cope with, in an OO programming world which have long gone to <a href="http://www.artima.com/lejava/articles/designprinciples4.html">favour composition over inheritance</a>. Especially in a single inheritance only language. To me, it seems like puremvc was designed for the inheritance to provide two things:</p>
<ol>
<li>Having mediators, commands and proxies hook properly into puremvc, but overriding methods like, <tt>listNotificationInterests()</tt>, <tt>execute()</tt> and call super constructors.</li>
<li>To provide access for the appliction into puremvc glue, primarily by letting sub-classes access the facade everywhere, hereby giving access to the service locators to obtain mediators and proxies.</li>
</ol>
<p>Now, both of these can be accomplished in other ways, if the framework had been designed in other ways.</p>
<h2>4. Avoids Platform Dependencies</h2>
<p>At first glance, avoiding platform dependencies for a framework might look like a positive thing, but it is not. At least not from the perspective of the user.</p>
<p>So, what do I mean by platform dependencies? Well, puremvc is written purely in ActionScript, and then ported to other languages like C#, Java, <a href="http://www.haxe.org/">haXe</a>, PHP, .. you name it. To be able to port the framework nice and easily, there can be no direct dependencies on flex and flash APIs.</p>
<p>Think about that for a while&#8230;</p>
<p>This means the framework cannot tell about what it is doing using the flash <tt>trace()</tt> method. I suspect this to be the reason that there is no debug option to turn on in puremvc. It also cannot utilize flex or flash event classes. I suspect this to be why notifications, a completely new abstraction found in puremvc, was conceived, instead of just using the event framework.</p>
<p>Each and every time there is a very platform specific feature, the core framework is unable to utilize it, as that part would then be impossible (or damned hard) to port to another platform.</p>
<p>But for me, the application developer, I have no need to port the puremvc framework. I have chosen flex. I am writing an application for flex. I am using the flex APIs/components, hereby binding my application to the flex platform. There is then no gain, only pain, in using a framework, which completely abstracts out that chosen platform.</p>
<h2>Then What?</h2>
<p>Is puremvc bad then? Hell no! Let me reiterate: Tt gets the job done. It solves the problem. Which problem? The problem of keeping an architecture on your code! You get a split-up of view, model and application logic. Shelves to place you code on.</p>
<p>I just think it could be done better.</p>
<p>Back when I started using puremvc, it was &#8220;the best&#8221; around, as I saw it. But others have come to. Most notably, <a href="http://mate.asfusion.com/">Mate</a> has had some great press lately. I think it is great, but also think <a href="http://www.techper.net/2008/09/10/mate-the-good-the-bad-and-the-ugly/">it has drawbacks</a>.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/412130024" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/10/05/4-things-to-hate-about-puremvc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Are You Using IntelliJ IDEA Flex Support?</title>
		<link>http://www.techper.net/2008/09/16/are-you-using-intellij-idea-flex-support/</link>
		<comments>http://www.techper.net/2008/09/16/are-you-using-intellij-idea-flex-support/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 19:45:30 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Rich Internet Applications]]></category>

		<category><![CDATA[Tools]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[flexbuilder]]></category>

		<category><![CDATA[IDEA]]></category>

		<category><![CDATA[jetbrains]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=141</guid>
		<description><![CDATA[Or am I one of the few people on the planet, who punishes myself with this half-baked support for flex that IntelliJ IDEA has, instead of just jumping the dreaded FlexBuilder ship, before I sink myself?
Okay, that was a bit harsh, it just seems to me, that there isn&#8217;t a day, without a new issue [...]]]></description>
			<content:encoded><![CDATA[<p>Or am I one of the few people on the planet, who punishes myself with this half-baked support for flex that <a href="http://www.jetbrains.com/">IntelliJ IDEA</a> has, instead of just jumping the dreaded <a href="http://www.adobe.com/products/flex/features/flex_builder/">FlexBuilder</a> ship, before I sink myself?</p>
<p>Okay, that was a bit harsh, it just seems to me, that there isn&#8217;t a day, without a new issue to be reported in the <a href="http://www.jetbrains.net/jira">JetBrains Jira</a> with respect to flex support.</p>
<p>Here are some of my current complains, and the list is far from complete:</p>
<ul>
<li>It doesn&#8217;t have proper, working refactoring, for even simple things like rename method or class or <a href="http://www.jetbrains.net/jira/browse/IDEA-19537">move</a>, except for the vanilla cases, where all is private</li>
<li>There seem to be problems with what I would expect as <a href="http://www.jetbrains.net/jira/browse/IDEA-19534">basic stuff</a>, like <a href="http://www.jetbrains.net/jira/browse/IDEA-19617">warnings on completely correct expressions</a></li>
<li>Auto-importing classes has never really worked satisfying yet, there is <a href="http://www.jetbrains.net/jira/browse/IDEA-18832">currently no support for completion in import statements</a> and organize imports <a href="http://www.jetbrains.net/jira/browse/IDEA-19536">organizes nothing</a></li>
<li>Import from maven poms is <a href="http://www.jetbrains.net/jira/browse/IDEADEV-29711">lacking</a> just about all functionality</li>
<li>The <a href="http://www.jetbrains.net/jira/browse/IDEA-19242">debugger does not work</a></li>
</ul>
<p>And I am not talking about the current 7.x release of IDEA, which only have the slightest hint of something called flex in it. No, I am talking about the latest and greatest <a href="http://www.jetbrains.net/confluence/display/IDEADEV/Diana+EAP">EAP releases of the upcoming v8 of IDEA</a>.</p>
<p>Even though I battle with this stuff every day, I just so much want IDEA to succeed on this one, because I love the IDE, and I am sure, that if they put enough focus into it, they could do a way better job than Adobe on FlexBuilder. That said, I am not sure they will succeed on this one. Why? Because I am seriously doubting, that we are thar many users out there, of the flex support in IDEA.</p>
<p>When I look at issues reported in their Jira related to flex support, there seems to be a core of very few people, who actively give feedback on this. And more than that, nearly all, if not all, the issues are assigned to the same JetBrains developer. Now, he <em>is</em> working on it, because I get some of my issues fixed and closed from time to time, which is nice. There just seems to be so long a road, until even the basic stuff is there.</p>
<p>Sorry to be such a bitch, but it is starting to get on my nerves. So, how many are we, using or wanting to use the flex support in IDEA?</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/394489216" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/09/16/are-you-using-intellij-idea-flex-support/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash and Flex APIs Lack in Quality</title>
		<link>http://www.techper.net/2008/09/11/flash-and-flex-apis-lack-in-quality/</link>
		<comments>http://www.techper.net/2008/09/11/flash-and-flex-apis-lack-in-quality/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 21:05:42 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[as3]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=135</guid>
		<description><![CDATA[Coming from long term Java programming, I can see that I have gotten used to very good api design. It is not, that JavaSE and JavaEE doesn&#8217;t have their corners of bad api design. But working with flash and flex, I seem to come across strange and bad api design a bit too often.
The other [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from long term Java programming, I can see that I have gotten used to very good api design. It is not, that JavaSE and JavaEE doesn&#8217;t have their corners of bad api design. But working with flash and flex, I seem to come across strange and bad api design a bit too often.</p>
<p>The other day, I noticed that the <a href="http://livedocs.adobe.com/flex/3/langref/flash/events/ErrorEvent.html">flash.events.ErrorEvent</a> actually inherits from <a href="http://livedocs.adobe.com/flex/3/langref/flash/events/TextEvent.html">flash.events.TextEvent</a>. What the f*** happened there? I guess this is an prime example of using inheritance as a means to reuse, instead of as a means to express some static, is-a relationship in a model.</p>
<p>To see what I mean, read the <a href="http://livedocs.adobe.com/flex/3/langref/flash/events/TextEvent.html">documentation for the TextEvent class</a>:</p>
<blockquote><p>An object dispatches a TextEvent object when a user enters text in a text field or clicks   a hyperlink in an HTML-enabled text field. There are two types of text events: TextEvent.LINK and TextEvent.TEXT_INPUT.</p></blockquote>
<p>Okay then, a TextEvent is something about a user, that has done something in a UI, that has produced some text, which the application shall know about. Now, let us take a look at the <a href="http://livedocs.adobe.com/flex/3/langref/flash/events/ErrorEvent.html">documentation for the ErrorEvent class</a>:</p>
<blockquote><p>An object dispatches an ErrorEvent object when an error causes a network operation to fail.  There is only one type of error event: ErrorEvent.ERROR.</p></blockquote>
<p>That is a <em>completely different thing</em> than a TextEvent. There is no chance, that saying &#8220;An ErrorEvent is also a TextEvent&#8221; could be true.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/390010460" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/09/11/flash-and-flex-apis-lack-in-quality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Are AS3 Number Variables Real Objects or Not?</title>
		<link>http://www.techper.net/2008/09/11/are-as3-number-variables-real-objects-or-not/</link>
		<comments>http://www.techper.net/2008/09/11/are-as3-number-variables-real-objects-or-not/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 20:27:05 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[as3]]></category>

		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=133</guid>
		<description><![CDATA[I am confused. Is the Number class really a class, that I can create instances of and expect to have reference semantics etc. like the rest of the classes in ActionScript3?
Given this AS3 code:


var foo : Number = null;
trace(&#34;foo=&#34;+foo);

The compiler outputs a warning saying &#8220;null used where a Number value was expected&#8220;, but it does [...]]]></description>
			<content:encoded><![CDATA[<p>I am confused. Is the <a href="http://livedocs.adobe.com/flex/3/langref/Number.html">Number</a> class really a class, that I can create instances of and expect to have reference semantics etc. like the rest of the classes in <a href="http://livedocs.adobe.com/flex/3/langref/">ActionScript3</a>?</p>
<p>Given this AS3 code:</p>
<pre name="code" class="javascript">

var foo : Number = null;
trace(&quot;foo=&quot;+foo);
</pre>
<p>The compiler outputs a warning saying &#8220;<tt>null used where a Number value was expected</tt>&#8220;, but it <em>does</em> compile. The trace outputs &#8220;<tt>foo=0</tt>&#8220;. Hmm, okay then, <tt>foo</tt> must be an instance of a Number class. If I change the code to have no initializer for <tt>foo</tt>, like this:</p>
<pre name="code" class="javascript">

var foo : Number;
trace(&quot;foo=&quot;+foo);
</pre>
<p>The output of the trace will read &#8220;<tt>foo=NaN</tt>&#8220;, which is as expected, as this is the default value of <a href="http://livedocs.adobe.com/flex/3/langref/Number.html">Number</a> variables.</p>
<p>But wait, this AS3 code:</p>
<pre name="code" class="javascript">

if (foo == null) {
trace(&quot;oops, does not compile&quot;);
}
</pre>
<p>Actually <em>fails</em> compilation. The compiler complains about &#8220;<tt>Comparison between a value with static type Number and a possibly unrelated type Null</tt>&#8220;. So, I can <em>assign</em> <tt>null</tt> to <a href="http://livedocs.adobe.com/flex/3/langref/Number.html">Number</a>, albeit with a warning, but I cannot <em>compare</em> with <tt>null</tt>. Okay then, <tt>foo</tt> must then <em>not</em> be a real reference to an object.</p>
<p>But wait again, the <a href="http://livedocs.adobe.com/flex/3/langref/Number.html">documentation</a> says that <a href="http://livedocs.adobe.com/flex/3/langref/Number.html">Number</a> is a &#8220;<tt>public final class Number</tt>&#8220;, which extends <tt>Object</tt>. But I cannot compare instances of it with <tt>null</tt>. Hugh!?</p>
<p>I think I am actually supposed to use the global function <a href="http://livedocs.adobe.com/flex/3/langref/package.html#isNaN()">isNaN()</a>, to determine stuff like this. You might be alarmed to hear then, that <a href="http://livedocs.adobe.com/flex/3/langref/package.html#isNaN()">isNaN()</a> applied on a Number typed variable, which have previously been assigned <tt>null</tt>, will return <tt>false</tt>.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/389983068" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/09/11/are-as3-number-variables-real-objects-or-not/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mate - The Good, the Bad and the Ugly</title>
		<link>http://www.techper.net/2008/09/10/mate-the-good-the-bad-and-the-ugly/</link>
		<comments>http://www.techper.net/2008/09/10/mate-the-good-the-bad-and-the-ugly/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 19:52:42 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Rich Internet Applications]]></category>

		<category><![CDATA[cairngorm]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mate]]></category>

		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=127</guid>
		<description><![CDATA[Lately, the new Mate flex framework by asfusion has caused quite a stir in the flex community, as a contender to the established frameworks of Cairngorm and PureMVC. Most of the comments on Mate that I have seen has been quite positive, which I think is well deserved. Mate offers a new way of doing [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, the new <a title="Flex Framework - Mate" href="http://mate.asfusion.com/">Mate</a> flex framework by <a href="http://www.asfusion.com/">asfusion</a> has caused <a href="http://www.infoq.com/news/2008/06/mate-flex-framework-alpha">quite</a> a <a href="http://www.flashmagazine.com/reviews/detail/mate_event_driven_framework_for_flex/">stir</a> in the flex community, as a contender to the established frameworks of <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm">Cairngorm</a> and <a href="http://www.puremvc.org/">PureMVC</a>. Most of the comments on Mate that I have seen has been quite positive, which I think is well deserved. Mate offers a new way of doing things, when compared to Cairngorm and PureMVC.</p>
<p>In my opinion, there are <em>downsides to Mate</em>, and I think one needs to consider these too, before blundering out in a new flex framework.</p>
<p>So, on with &#8220;Il buono, il brutto, il cattivo&#8221;.</p>
<h2>The Good</h2>
<p>Here are the main benefits I see in Mate.</p>
<h3>1. Acknowledges Its Flex Heritage</h3>
<p>Mate is a <em>flex</em> framework, meaning it does not try to hide or abstract access to flex apis. It uses normal flex events as communication mechanism, and depends heavily on the flex apis in general. This is something it shares with Cairngorm, but stand in clear contrast to PureMVC. PureMVC has gone to great lengths, to abstract out any access to the flex apis, in the process inventing its own event-like system in the form of &#8220;notifications&#8221;. This makes the PureMVC framework itself portable to other platforms, but only puts extra burden on the developer, which have chosen flex as the platform.</p>
<h3>2. Builds Upon Dependency Injection</h3>
<p>Mate utilize <a href="http://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a> (DI), which is a programming pattern I have come to like, and use day in and day out, when doing Java development. Using DI promotes louse coupling between classes and subsystems and makes for a more flexible codebase. What DI in Mate should give me, is mxml and application logic, which does <em>not</em> depend directly on the Mate apis. I like that.</p>
<h3>3. Simple, Uncluttered View</h3>
<p>Using Mate, the mxml view definitions become really simple an uncluttered with anything but the view code. This is partly due to the above description on dependency injection, as Mate is able to inject into the view, when it needs data. This is something Mate shares with PureMVC, but not with Cairngorm. PureMVC also makes for pretty simple mxml view definitions, but at a higher cost, using Mediators and extra levels of abstraction.</p>
<h2>The Bad</h2>
<p>That was some of the main benefits, I have seen with Mate. Now on to what I do <em>not</em> like about Mate.</p>
<h3>1. Too Much Magic</h3>
<p>In short: There seems to be too much magic happening behind the scenes. Now, I should be a little careful here, because this might be due to me not knowing the intricate details of the framework yet. On the other hand, I recal previous experiences with Tapestry v3+4, where in-depth knowledge of how the server-side playback of a request works inside Tapestry, was needed to understand how to use stuff like ActionLinks. Maybe some of it can be taken care of with better documentation, maybe not. My main point is, that you should be able to use the framework, without knowing intricate details about how it works beneath.</p>
<p>So, where is the magic? It is in the <a href="http://mate.asfusion.com/page/documentation/tags/eventmap">EventMap</a>, where one wires up the whole application with various xml tags. And we shall get to that right now in the next section.</p>
<h3>2. Programming in XML</h3>
<p>Mate has something called an <a href="http://mate.asfusion.com/page/documentation/tags/eventmap">EventMap</a>, a place where one wires up the application. You can think of it, as the place where flex events from the UI is mapped to application logic, but also where processing code and remote calls execute and return results and data back to the view.</p>
<p>The EventMap is all done in XML, and is where the dependency injection is defined, as in which UI components get which things injected as a result of what. What I do <em>not</em> like about the EventMap is how it looks like application code, &#8230; just in XML. Take a look at this example:</p>
<pre name="code" class="xml">

&lt;EventHandlers type=&quot;{FlexEvent.APPLICATION_COMPLETE}&quot;&gt;
   &lt;HTTPServiceInvoker instance=&quot;{employeesService}&quot;&gt;
      &lt;resultHandlers&gt;
         &lt;MethodInvoker generator=&quot;{EmployeeParser}&quot; method=&quot;loadEmployeesFromXML&quot; arguments=&quot;{resultObject}&quot; /&gt;
         &lt;MethodInvoker generator=&quot;{EmployeeManager}&quot; method=&quot;saveEmpoyeeList&quot; arguments=&quot;{lastReturn}&quot; /&gt;
      &lt;/resultHandlers&gt;
   &lt;/HTTPServiceInvoker&gt;
&lt;/EventHandlers&gt;
</pre>
<p>Which is something like when a <tt>FlexEvent.APPLICATION_COMPLETE</tt> event is fired, the application shall call some remote service (the <tt>HTTPServiceInvoker</tt> part), and the result of that shall be parsed by an instance of <tt>EmployeeParser</tt> through its method <tt>loadEmployeesFromXML</tt>,&#8230;. </p>
<p>Shit, I thought I would never have to see something like <a title="Jelly xml programming" href="http://commons.apache.org/jelly/">Jelly</a> again. Programming in XML quickly leaves you up shit creek without a paddle. I hate that!</p>
<h3>3. Nullifies The Power of AS3 Compile-Time Type Checking</h3>
<p>Okay, granted, I do not think it completely nullifies all type-checking. But the xml EventMap is not understood by the compiler, as the mxml code is, hence no type-checking will be done by the compiler on that part.</p>
<p>As an example, when data-binding a property of a component to some other property or variable using an expression like <tt>fooProperty={bar}</tt>, the mxml-compiler will generate as3 code which does the binding, and the generated code includes type-information, that will make the compilation fail, if the types do not match.</p>
<p>Not so with all the &#8220;code&#8221; in the EventMaps.</p>
<h2>The Ugly</h2>
<p>And on to the ugly part. This is mostly for fun, as I happened to peak into the code of Mate and saw this:</p>
<pre name="code" class="javascript">

public function createInstance(template:Class, p:Array):Object
{
   var newInstantce:Object;
   if(!p || p.length == 0)
   {
      newInstantce = new template();
   }
   else
   {
      // ugly way to call a constructor.
      // if someone knows a better way please let me know (nahuel at asfusion dot com).
      switch(p.length)
      {
         case 1:newInstantce = new template(p[0]); break;
         case 2:newInstantce = new template(p[0], p[1]); break;
         case 3:newInstantce = new template(p[0], p[1], p[2]); break;
         case 4:newInstantce = new template(p[0], p[1], p[2], p[3]); break;
         case 5:newInstantce = new template(p[0], p[1], p[2], p[3], p[4]); break;
         case 6:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5]); break;
         case 7:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6]); break;
         case 8:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); break;
         case 9:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]); break;
         case 10:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); break;
         case 11:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); break;
         case 12:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11]); break;
         case 13:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]); break;
         case 14:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13]); break;
         case 15:newInstantce = new template(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14]); break;
      }
   }
   return newInstantce;
}
</pre>
<p> <img src='http://www.techper.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Anyway, I do not know a better way in as3 myself. Just thought it was funny code.</p>
<h2>But It Is Great</h2>
<p>&#8230; to see something new and innovating in the flex MVC space, and Mate is it. I just think, that it still can be done better.</p>
<p>If you want to learn more about Mate, you should go to <a href="http://www.asfusion.com/">asfusions</a> <a href="http://mate.asfusion.com/">site about Mate</a>. In addition to <a href="http://mate.asfusion.com/page/documentation">some Mate documentation</a>, they have <a href="http://mate.asfusion.com/forums/">forums about Mate</a>, and it looks like they are good at providing answers to peoples problems.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/388969185" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/09/10/mate-the-good-the-bad-and-the-ugly/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making a Java WebApp Return Proper SOAP Fault Responses</title>
		<link>http://www.techper.net/2008/08/29/making-a-java-webapp-return-proper-soap-fault-responses/</link>
		<comments>http://www.techper.net/2008/08/29/making-a-java-webapp-return-proper-soap-fault-responses/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 18:10:47 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[soap]]></category>

		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=116</guid>
		<description><![CDATA[In several projects I have been co-developing, we had a webapp as part of the system, which exposed a webservice API as integration end-point to the system. The sole content of that webapp is the webservice, and as such, the web.xml contained only the mount of the webservice servlet (like CXF or Axis) and not [...]]]></description>
			<content:encoded><![CDATA[<p>In several projects I have been co-developing, we had a webapp as part of the system, which exposed a webservice API as integration end-point to the system. The sole content of that webapp is the webservice, and as such, the <tt>web.xml</tt> contained only the mount of the webservice servlet (like CXF or Axis) and not much more.</p>
<h2>The Problem</h2>
<p>If this webapp is hit on an URL that does not exist, the webservice servlet does not even get hit, and the container produces a 404 html page. If some internal server error happen before the webservice servlet is hit, the container generates a 500 html page. If the client calling the webservice does not produce proper authentication tokens, the container generates a 401 html page, again before the webservice servlet is reached.</p>
<p>In all these cases, the webservice engine, Axis, CXF or their cousins, won&#8217;t be able to produce a proper SOAP fault message. If the client program that calls the webservice, trigger any of the above described situations, the response cannot be parsed properly as a SOAP response. Because the response is html (or nothing/empty).</p>
<p>This is not very SOAP like. Luckily, the solution is simple.</p>
<h2>The Solution</h2>
<p>In <tt>web.xml</tt>, you can both map server response codes to specific response pages and map certain extensions to HTTP response content-type setting. Let&#8217;s solve the problem for the 401 situation, where authentication failed:</p>
<p><strong><span style="text-decoration: underline;">Step 1: Create a static SOAP response</span></strong></p>
<p>For the 401 problem, we will create a file named <tt>401.soap</tt> and place it inside the webapp in the <tt>/soap-error-responses</tt> directory. The file shall contain this static xml:</p>
<pre name="code" class="xml">

&lt;env:Envelope xmlns:env=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
	&lt;env:Body&gt;
		&lt;env:Fault&gt;
			&lt;faultcode&gt;env:Server&lt;/faultcode&gt;
			&lt;faultstring&gt;401:Unauthorized&lt;/faultstring&gt;
		&lt;/env:Fault&gt;
	&lt;/env:Body&gt;
&lt;/env:Envelope&gt;
</pre>
<p><strong><span style="text-decoration: underline;">Step 2: Map the error-code to the static file</span></strong></p>
<p>Inside <tt>web.xml</tt>, you add this mapping:</p>
<pre name="code" class="xml">

&lt;error-page&gt;
  &lt;error-code&gt;401&lt;/error-code&gt;
  &lt;location&gt;/soap-error-responses/401.soap&lt;/location&gt;
&lt;/error-page&gt;
</pre>
<p>This will make the container return your static response in the case of a 401 response code.</p>
<p><strong><span style="text-decoration: underline;">Step 3: Map the .soap extension to a content-type</span></strong></p>
<p>A SOAP response should be sent with HTTP content-type <tt>text/xml</tt>. To ensure this for the <tt>.soap</tt> files, you put the below mime-mapping element into your <tt>web.xml</tt> file:</p>
<pre name="code" class="xml">

&lt;mime-mapping&gt;
  &lt;extension&gt;soap&lt;/extension&gt;
  &lt;mime-type&gt;text/xml&lt;/mime-type&gt;
&lt;/mime-mapping&gt;
</pre>
<p>And you are done.</p>
<p>One thing about this solution, as also mentioned in the beginning, is that it will be okay for a webapp which contains nothing but a webservice service. On the other hand, if the webapp also contains a regular web application with html and jsp files, it will be a problem that 401, 404, 500,&#8230; are mapped to SOAP fault codes. The browser will be disappointed <img src='http://www.techper.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Another thing to note is, that there is nothing stopping you from using dynamically generated response files, like jsp files. One caveat though, the source of a response like 500 (internal server error), could be things like out-of-memory, out-of-disk-space or out-of-file-handles, all errors that most likely will prevent the container from processing a dynamic jsp files too. So, maybe better stay with the static ones.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/378283140" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/29/making-a-java-webapp-return-proper-soap-fault-responses/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Do Not Fear JavaScript, Embrace It</title>
		<link>http://www.techper.net/2008/08/28/do-not-fear-javascript-embrace-it/</link>
		<comments>http://www.techper.net/2008/08/28/do-not-fear-javascript-embrace-it/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 20:17:05 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=122</guid>
		<description><![CDATA[JavaScript is everywhere. And I nearly missed the boat.
I think it started for real with libraries like prototype and script.aculo.us, and then just accellerated from there on into Dojo, MooTools and jQuery. And last, Google published the AJAX Libraries API, to ease loading of JavaScript libraries into your application.
All the cool web applications on the [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript is <a href="http://code.google.com/apis/ajaxlibs/">everywhere</a>. And I nearly missed the boat.</p>
<p>I think it started for real with libraries like <a title="Prototype JS Lib" href="http://www.prototypejs.org/">prototype</a> and <a title="script.aculo.us js lib" href="http://script.aculo.us/">script.aculo.us</a>, and then just accellerated from there on into <a title="dojo js lib" href="http://dojotoolkit.org/">Dojo</a>, <a title="MooTools js lib" href="http://mootools.net/">MooTools</a> and <a title="jQuery js lib" href="http://jquery.com/">jQuery</a>. And last, Google published the <a href="http://code.google.com/apis/ajaxlibs/">AJAX Libraries API</a>, to ease loading of JavaScript libraries into your application.</p>
<p>All the cool web applications on the net seems to use javascript heavily. Mashups depend on javascript heavily. Browsers are getting good at javascript.</p>
<p>And it is spreading. Through <a title="Rhino JavaScript" href="http://www.mozilla.org/rhino/">Rhino</a>, JavaScript became one of the supported scripting languages that can be called from Java using the <a href="http://jcp.org/en/jsr/detail?id=223">Java6 script engine</a>. And there is <a title="ActionScript 3" href="http://livedocs.adobe.com/flex/3/langref/index.html">ActionScript3</a>, which I like writing UI logic in when doing the <a href="http://www.adobe.com/products/flex/">flex</a> dance.</p>
<p>Up until lately, I had a grudge against JavaScript. Mostly because my initial experiments with JavaScript was in browsers to manipulate the DOM, validate html input etc. All done in now old and gone browsers, with lousy JavaScript support. After fighting with it back then on several occations, I built up that grudge. But I cannot go on like that.</p>
<p>I need to embrace JavaScript. I have started work on it with ActionScript3, but I need to do more than that. Or I <em>will</em> miss the boat.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/377434619" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/28/do-not-fear-javascript-embrace-it/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Need for java.lang.Thread and java.sql is Gone</title>
		<link>http://www.techper.net/2008/08/28/the-need-for-javalangthread-and-javasql-is-gone/</link>
		<comments>http://www.techper.net/2008/08/28/the-need-for-javalangthread-and-javasql-is-gone/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 19:55:06 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[jdbc]]></category>

		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=119</guid>
		<description><![CDATA[At least for the application developer.
Back in the days of Java1, two cool parts of this new platform was the threading apis and the JDBC apis. These APIs have both had immense success. But I think we, as application developers, should forget about them. I know I mostly have.
There are good reasons, that these apis [...]]]></description>
			<content:encoded><![CDATA[<p>At least for the application developer.</p>
<p>Back in the days of Java1, two cool parts of this new platform was the threading apis and the JDBC apis. These APIs have both had immense success. But I think we, as application developers, should forget about them. I know I mostly have.</p>
<p>There are good reasons, that these apis were cool and became popular and much used.</p>
<p>The JDBC apis were a giant leap in how easy, it suddenly was to connect to and query a relational database. And with the common JDBC api, you could just swap the driver and connect to another database. With the threading apis this was even more true. Coming from C, parallel programming was done with multiple processes and various IPC techniques like sockets or shared memory. Suddenly, there was an easy to use api, with Thread as abstraction level.</p>
<p>Before the success of application servers like Weblogic and Tomcat, back in the days where Weblogic was named Tengah, we all wrote our own server applications, using stuff like Thread pools and dispatching work into threads by ourselves.</p>
<p>But this is no more. When reading <a href="http://www.amazon.com/gp/product/0321356683?ie=UTF8&amp;tag=tepe0d-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321356683">Effective Java</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=tepe0d-20&amp;l=as2&amp;o=1&amp;a=0321356683" border="0" alt="" width="1" height="1" /> (again), I came across all the advice on how to do parallel programming. And I came to think of, that it has been a really long time, since I used the threading apis myself directly. And the same is true for the JDBC apis. I know intimately how they work, and I am glad for that, but I don&#8217;t like working with them anymore. They are a way too low abstraction level.</p>
<p>Doing applications on the web, the container shall be the one using those apis. Not the application developer. Doing application development, we should use higher abstractions like JPA, to enable better modelling and talking in the language of the model when coding.</p>
<p>What do you think? Is there any need for application developers to use these libraries anymore, except for rarely written software?</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/377420058" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/28/the-need-for-javalangthread-and-javasql-is-gone/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Effective Java Second Edition is Also Worth a Read</title>
		<link>http://www.techper.net/2008/08/27/effective-java-second-edition-is-also-worth-a-read/</link>
		<comments>http://www.techper.net/2008/08/27/effective-java-second-edition-is-also-worth-a-read/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 20:54:20 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[book]]></category>

		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=108</guid>
		<description><![CDATA[A long time ago, I read the first Effective Java book by Joshua Bloch, and, as many others, I loved it. Great book! Not long ago, Joshua Bloch finished a revised second edition of Effective Java, and I just finished reading it.
When I ordered the book, I was unsure if it would be a waste [...]]]></description>
			<content:encoded><![CDATA[<p>A long time ago, I read the first Effective Java book by <a href="http://en.wikipedia.org/wiki/Joshua_Bloch">Joshua Bloch</a>, and, as many others, I loved it. Great book! Not long ago, Joshua Bloch finished a revised <a href="http://www.amazon.com/gp/product/0321356683?ie=UTF8&amp;tag=tepe0d-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321356683">second edition of Effective Java</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=tepe0d-20&amp;l=as2&amp;o=1&amp;a=0321356683" border="0" alt="" width="1" height="1" />, and I just finished reading it.</p>
<p>When I ordered the book, I was unsure if it would be a waste of time. Was there really so much new to say about the Java platform, since then? After all, this book is all about best practices and common idioms for programming on the Java platform. How many new such could there be?</p>
<p>Well, quite a few it turned out.</p>
<p>There are completely new chapters, like the 37 pages on generics and the 33 pages on enums and annotations, as these are language features added in Java5.</p>
<p>In addition to this, a great deal of the old items have been heavily revised, to accomodate the new features, as there are now better ways to do things. One example is the advice to use enums for singletons. Another is the advice to prefer Executors over working with threads and to prefer concurrency utilities like <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html">CountDownLatch</a>, <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CyclicBarrier.html">CyclicBarrier</a>, etc. over <tt>wait</tt> and <tt>notify</tt>. All new stuff from the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-frame.html">java.util.concurrent</a> package.</p>
<p>I can only say, that <a href="http://www.amazon.com/gp/product/0321356683?ie=UTF8&amp;tag=tepe0d-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321356683">second edition</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=tepe0d-20&amp;l=as2&amp;o=1&amp;a=0321356683" border="0" alt="" width="1" height="1" /> is a must-read too.</p>
<p>Next up for me is <a href="http://www.amazon.com/gp/product/032133678X?ie=UTF8&#038;tag=tepe0d-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=032133678X">Java Puzzlers</a><img src="http://www.assoc-amazon.com/e/ir?t=tepe0d-20&#038;l=as2&#038;o=1&#038;a=032133678X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, which I never got around to reading.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/376506284" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/27/effective-java-second-edition-is-also-worth-a-read/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Applet Caching and the Control Panel on Linux</title>
		<link>http://www.techper.net/2008/08/25/applet-caching-and-the-control-panel-on-linux/</link>
		<comments>http://www.techper.net/2008/08/25/applet-caching-and-the-control-panel-on-linux/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 14:38:40 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[applet]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=104</guid>
		<description><![CDATA[The Sun Java applet plugin will cache applets outside the browser cache, in its own cache directory. Clearing the cache in the browser will not clear the applet cache, which can be irritating when you need to be sure, that a fresh copy of a given applet is loaded.
What you need to do, is clear [...]]]></description>
			<content:encoded><![CDATA[<p>The Sun Java applet plugin will <em>cache applets outside the browser cache</em>, in its own cache directory. Clearing the cache in the browser will not clear the applet cache, which can be irritating when you need to be sure, that a fresh copy of a given applet is loaded.</p>
<p>What you need to do, is clear the cache through the Java Control Panel, which can be hard to locate on Linux (on Windows it is placed in Control Panel-&gt;Java). Depending on your distro and how Java was installed, you might be lucky and find a link to the Control Panel inside the menues somewhere (like in System-&gt;Preferences or something like that).</p>
<p>When installing Java manually with a tar.gz, and the Sun Java Plugin manually by <a title="Installing Sun Java Plugin in mozilla" href="http://plugindoc.mozdev.org/faqs/java.html#Linux">this method</a>, where you yourself symbolic link from the the plugins directory to the JRE Java Plugin .so file, finding the Control Panel can be harder.</p>
<p>Luckily, if you know what to look for, it ain&#8217;t hard at all.</p>
<p>Inside either the SDK bin directory or inside the JRE bin directory, you will find a binary named <tt>ControlPanel</tt> (actually, it is a shell script, but whatever). Executing this yields this:</p>
<p><a href="http://www.techper.net/blog/wp-content/uploads/2008/08/console-temp-inet-files.png"><img class="aligncenter size-medium wp-image-105" title="Applet ControlPanel" src="http://www.techper.net/blog/wp-content/uploads/2008/08/console-temp-inet-files-284x300.png" alt="" width="284" height="300" /></a></p>
<p>And clicking the &#8220;Delete files&#8221; button will let you delete applets (and Java Web Start applications installed/cached).</p>
<p>In addition, clicking &#8220;Settings&#8221; will show you where the cache is placed (<tt>$HOME/.java/&#8230;</tt>), which makes it easy for you to clear the cache later with a simple remove.</p>
<p>As a little side-note. When developing or debugging applets, it can be nice to have the Java Plugin console window open when the plugin loads. This can be enabled in the Control Panel, on the &#8220;Advanced&#8221; tab, like this:</p>
<p><a href="http://www.techper.net/blog/wp-content/uploads/2008/08/applet-console-enable.png"><img class="aligncenter size-medium wp-image-106" title="Java Applet console show" src="http://www.techper.net/blog/wp-content/uploads/2008/08/applet-console-enable-284x300.png" alt="" width="284" height="300" /></a></p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/374315369" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/25/applet-caching-and-the-control-panel-on-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrade Maven POM Versions Recursively</title>
		<link>http://www.techper.net/2008/08/24/upgrade-maven-pom-versions-recursively/</link>
		<comments>http://www.techper.net/2008/08/24/upgrade-maven-pom-versions-recursively/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 08:39:50 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<category><![CDATA[maven]]></category>

		<category><![CDATA[pom]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=86</guid>
		<description><![CDATA[More often than not, my projects end up as multi-module maven builds, with a top-level pom.xml in the trunk directory and sub pom.xml files in each module. For big projects, I even end up with more that two levels of POM inheritance. All this adds up to how many pom.xml files the project contains, and [...]]]></description>
			<content:encoded><![CDATA[<p>More often than not, my projects end up as multi-module maven builds, with a top-level <tt>pom.xml</tt> in the trunk directory and sub <tt>pom.xml</tt> files in each module. For big projects, I even end up with more that two levels of POM inheritance. All this adds up to how many <tt>pom.xml</tt> files the project contains, and to the burden of updating the version in each of them.</p>
<p>This is why we created this little find+perl one-liner on my current project, to enable a quick and easy <tt>pom.xml</tt> version element upgrade. Here is the one-liner:</p>
<pre><code>find . -name "pom.xml" -type f -exec \
  perl -0777 -pi -e \
    's#(&lt;project.*?&lt;version&gt;)1.9-SNAPSHOT&lt;/version&gt;#${1}1.9.0&lt;/version&gt;#s' {} \;</code></pre>
<p>The above line upgrades from version <tt>1.9-SNAPSHOT</tt> to a final <tt>1.9.0</tt>, which is what we do when preparing a release where <tt>SNAPSHOT</tt> was used on trunk and a real final version number is to be used for the release.</p>
<p>Here is a bit of explanation of the one-liner:</p>
<ul>
<li> The <tt>find</tt> finds <em>files</em> only (<tt>-type f</tt>) with the name <tt>pom.xml</tt> recursively and executes the perl command-line on each</li>
<li>The perl option <tt>-0777</tt> sets the input record delimiter character (<tt>$/</tt>) to a non-existing character, to slurp all of the file into one long string, which enables us to match and replace into a single long line</li>
<li>The <tt>-p</tt> option loops all files</li>
<li>The <tt>-i</tt> does inplace editing of files (aka: The replace on the match is done directly into the file matched in)</li>
<li>And finally, the <tt>/s</tt> modifier on the end of the pattern makes it a single match and in combination with <tt>-0777</tt> also substitution</li>
</ul>
<p>So, why do this, when we have the <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven release plugin</a>? Because the maven release plugin scares me! Have you seen all it does with your repo and all? Take a look at the actions done by the <a href="http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html">release:prepare goal</a>. These actions includes changing poms, committing changes, tagging, changing poms again, &#8230; I want to be more in control than that <img src='http://www.techper.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/373305250" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/24/upgrade-maven-pom-versions-recursively/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaFX is Dead, Long Live JavaFX</title>
		<link>http://www.techper.net/2008/08/22/javafx-is-dead-long-live-javafx/</link>
		<comments>http://www.techper.net/2008/08/22/javafx-is-dead-long-live-javafx/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 20:16:48 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Rich Internet Applications]]></category>

		<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=98</guid>
		<description><![CDATA[So, it seems JavaFX isn&#8217;t dead yet after all.
Now that Sun has released a preview SDK of JavaFX over at javafx.com, they must be thinking that it is soon ready for the world. I have previously talked about javafx as being forever unfinished, and this was my opinion of it still.
But today, I set out [...]]]></description>
			<content:encoded><![CDATA[<p>So, it seems JavaFX isn&#8217;t <a href="http://www.techper.net/2008/07/09/javafx-a-forever-unfinished-ria-technology/">dead</a> yet after all.</p>
<p>Now that Sun has released a <a href="http://javafx.com/">preview SDK of JavaFX over at javafx.com</a>, they must be thinking that it is soon ready for the world. I have previously talked about javafx as being <a href="http://www.techper.net/2008/07/09/javafx-a-forever-unfinished-ria-technology/">forever unfinished</a>, and this was my opinion of it still.</p>
<p>But today, I set out to try the preview SDK, and it kind off changed my mind.</p>
<p>Starting out, I had to both install a latest and greatest <a href="http://java.sun.com/javase/downloads/ea/6u10/6u10RC.jsp">Java6Update10 release candidate</a> <em>and</em> the dreaded Netbeans IDE (which by far was the worst hurdle to overcome). But from there on, things just worked. I followed a couple of tutorials, and built my own Clock JavaFX application stone by stone. And I most say, that even Netbeans did a good job in helping me.</p>
<p>What stunned me a bit, was the feeling of quality and readiness of the JavaFX technology. It just worked.</p>
<p>Here is a bit of what I noted down, when working with it. I might compare a bit with flex/air on the way too.</p>
<h2>The Language</h2>
<ul>
<li>The syntax for defining UI declaratively looks like crap. To me, it is not even the slightest bit intuitive and easy to read. Only positive thing is, that it <em>is</em> easier than gluing up a Swing application in plain Java code. Why on earth have they dreamt up a new syntax, when xml is here for such things? Flex wins here.</li>
<li>The language for scripting looks much nicer. It seems to be close to actionscript and javascript syntax and it supports stuff like attributes and data binding in the language. Nice!</li>
<li>Dead cool feature is of course the ability to mix and match real Java code right into the application. JavaFX wins bigtime over Flex/AIR here.</li>
<li>JavaFX supports multiple inheritance - why on earth that? It gives the compiler extra work, as it compiles into Java bytecode, which does not support this.</li>
</ul>
<h2>Tooling</h2>
<ul>
<li>I guess this must be Netbeans for now. Not the coolest thing on the planet. Them having dreamt up a completely new syntax, instead of going with xml for declarative UI, will require more work for competing IDEs to catch up.</li>
</ul>
<h2>Components</h2>
<ul>
<li>At first, JavaFX seems to be centered around the rich media part (Frame, Stage, Animations, Shapes, Transformations, &#8230;)</li>
<li>But of course, Java has the complete Swing apis, with a lot of components to support forms (Buttons, Tables, Checkbox, &#8230;). These are components in the Flex world, an integral part of Flex/AIR framework. In JavaFX, they are just there already, because of the complete integration with the rest of the Java platform.</li>
<li>One can turn the above argument on its head though. Cause flash has had stuff like scenes, stages, animations and transformations for a lot of years. This is new stuff on the Java platform, brought about by JavaFX.</li>
</ul>
<h2>Platform</h2>
<ul>
<li>Well, fx source compiles to JVM bytecode, of course</li>
<li>From here on, &#8220;everything&#8221; is possible</li>
<li>Target execution platforms includes: Desktop application using JRE, applets in the browser, mobile platforms (cell phones and tvs in the common profile only)</li>
</ul>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/372155286" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/22/javafx-is-dead-long-live-javafx/feed/</wfw:commentRss>
		</item>
		<item>
		<title>On Registering Your JDK and Being Honest</title>
		<link>http://www.techper.net/2008/08/22/on-registering-your-jdk-and-being-honest/</link>
		<comments>http://www.techper.net/2008/08/22/on-registering-your-jdk-and-being-honest/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 19:35:53 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=96</guid>
		<description><![CDATA[I installed a new JDK today on my windows box. A Java6update10-RC. When done installing, the installer opens up a web page at Sun, asking me to &#8220;register my jdk&#8221;. To justify such registration, Sun lists these 4 areas, where this should benefit me:

Notification of new versions, patches, and updates
Special offers on Sun developer products, [...]]]></description>
			<content:encoded><![CDATA[<p>I installed a new JDK today on my windows box. A Java6update10-RC. When done installing, the installer opens up a web page at Sun, asking me to &#8220;register my jdk&#8221;. To justify such registration, Sun lists these 4 areas, where this should benefit me:</p>
<ul>
<li>Notification of new versions, patches, and updates</li>
<li>Special offers on Sun developer products, services and training</li>
<li>Access to early releases and documentation</li>
<li>Ability to track and manage your registered products and systems on the <a href="https://inventory.sun.com/scportal/">Sun Inventory site</a></li>
</ul>
<p>Let&#8217;s take a closer look at these 4 &#8220;nice&#8221;, extra things, Sun will give me, if I register:</p>
<p>Notifications I already get, really annoying, from the popup balloons on the windows task bar about a new new JDK ready for me. Cannot even say no to them.</p>
<p>Then there are the &#8220;Special offers on Sun developer products, services and training&#8221;, which to me is other words for .. SPAM.</p>
<p>Of course, I would like &#8220;Access to early releases and documentation&#8221;, &#8230; which can be accessed anyway, without the registration, right.</p>
<p>And last, the &#8220;Ability to track and manage your registered products and systems on the <a href="https://inventory.sun.com/scportal/">Sun Inventory site</a>&#8220;. So I can go and login at Sun, to see what I have installed on my own laptop?</p>
<p>What the f&#8230;</p>
<p>How about calling it what it is. Sun wants some information about JDK installations. Please ask nicely and honest for it then!</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/372128150" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/22/on-registering-your-jdk-and-being-honest/feed/</wfw:commentRss>
		</item>
		<item>
		<title>System.currentTimeMillis, System.nanoTime and Their Resolution</title>
		<link>http://www.techper.net/2008/08/10/systemcurrenttimemillis-systemnanotime-and-their-resolution/</link>
		<comments>http://www.techper.net/2008/08/10/systemcurrenttimemillis-systemnanotime-and-their-resolution/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 13:40:42 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=89</guid>
		<description><![CDATA[When reading about Robust Java Benchmarking, I came across some things I had not thought about myself. It turns out, that even though System.currentTimeMillis() has the unit of milliseconds, the precision with which the method can return, is quite different on various operating systems.
Brent Boyer explains that Windows XP has a granularity of 15 ms, [...]]]></description>
			<content:encoded><![CDATA[<p>When reading about <a href="http://www.ibm.com/developerworks/java/library/j-benchmark1.html">Robust Java Benchmarking</a>, I came across some things I had not thought about myself. It turns out, that even though <a title="Java System.currentTimeMillis" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()">System.currentTimeMillis()</a> has the unit of milliseconds, the precision with which the method can return, is quite different on various operating systems.</p>
<p>Brent Boyer explains that Windows XP has a granularity of 15 ms, while Linux with a 2.6 kernel have a much finer grained precision of 1 ms. For many purposes, I guess this is no problem. I know I have not had a problem with it before.</p>
<p>What I did not know is, that the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#nanoTime()">System.nanoTime</a> call (available from Java5 and on) should be the one used for timing intervals. In addition to being nano-based, this call does not work as a &#8220;wall clock&#8221; as <a title="Java System.currentTimeMillis" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()">System.currentTimeMillis()</a> do, in that it only measures elapsed time in an interval. The <a title="Java System.currentTimeMillis" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()">System.currentTimeMillis()</a> call tries to reflect a &#8220;wall clock&#8221; time, as milliseconds since January 1, 1970. If the clock is drifting or being set by tools like <a href="http://www.ntp.org/">NTP daemons</a>, this will skew the results of <a title="Java System.currentTimeMillis" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()">System.currentTimeMillis()</a>.</p>
<p>Coincidentally, I was reading a chapter on concurrency in <a href="http://www.amazon.com/gp/product/0321356683?ie=UTF8&amp;tag=tepe0d-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321356683">Effective Java (2nd Edition) (The Java Series)</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=tepe0d-20&amp;l=as2&amp;o=1&amp;a=0321356683" border="0" alt="" width="1" height="1" /> by <a href="http://en.wikipedia.org/wiki/Joshua_Bloch">Joshua Bloch</a>, in which he states:</p>
<blockquote><p>For interval timing, always use System.nanoTime in preference to System.currentTimeMillis</p></blockquote>
<p>I do still have my thoughts about these two methods. When I read the javadoc for the new <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#nanoTime()">System.nanoTime</a> call, I do not really feel at ease using it:</p>
<blockquote><p>&#8230;The value returned represents nanoseconds since some fixed but  arbitrary time (perhaps in the future, so values may be  negative).  This method provides nanosecond precision, but not  necessarily nanosecond accuracy. No guarantees are made about  how frequently values change&#8230;.</p></blockquote>
<p>Note the &#8220;perhaps in the future&#8221; and &#8220;values may be negative&#8221;. Hmmm!</p>
<p>This just goes to show, that it is really hard, to provide a virtual platform, that is supposed to look and act equal on all platforms.</p>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/361088695" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/10/systemcurrenttimemillis-systemnanotime-and-their-resolution/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Guice - Agile Lightweight Dependency Injection Framework</title>
		<link>http://www.techper.net/2008/08/06/google-guice-agile-lightweight-dependency-injection-framework/</link>
		<comments>http://www.techper.net/2008/08/06/google-guice-agile-lightweight-dependency-injection-framework/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:29:54 +0000</pubDate>
		<dc:creator>polesen</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[book]]></category>

		<category><![CDATA[guice]]></category>

		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.techper.net/?p=83</guid>
		<description><![CDATA[This is a book review post. Apress presented me with the opportunity to review one of their books, and I opted for Google Guice - Agile Lightweight Dependency Injection Framework by Robbie Vanbrabrant, as I could learn something about Guice in the process. And learned something I did.
General Stuff
I read the e-book version (pdf), so [...]]]></description>
			<content:encoded><![CDATA[<p>This is a book review post. <a href="http://www.apress.com/">Apress</a> presented me with the opportunity to review one of their books, and I opted for <a href="http://www.apress.com/book/view/9781590599976">Google Guice - Agile Lightweight Dependency Injection Framework</a> by <a href="http://garbagecollected.org/">Robbie Vanbrabrant</a>, as I could learn something about <a href="http://code.google.com/p/google-guice/">Guice</a> in the process. And learned something I did.</p>
<h2>General Stuff</h2>
<p>I read the e-book version (pdf), so I cannot tell you anything about the quality of the book itself. As a little side note, I find e-books harder to read, maybe because I cannot (easily) take it with me to the toilet.</p>
<p>The overall tone in the book is to the point and a bit fun. If you do not like a little joke or a funny way to express something, you might get a little irritated. On the other hand, it is not as if it destroys the meaning, and it is actually funny. At least I liked it!</p>
<p>The book is very much to the point, which I like, as it helps me get faster to the real stuff. There is so much to catch up on in the programming world, so no need to read a lot of unneccessary bullshit. To the point. Nice. The book does not provide much explanation of basic Java stuff. Good, but know your Java and Java5 workings, before going with this book.</p>
<p>When the book describes something that can be done in more than one way, there is always good advice on when to use which and why. This is exactly the kind of information I like to get out of a book. Not just a publication of the API, but in-depth advice on how to use the api and how not to (or what the implications are for doing it the way you do).</p>
<p>There are good spin-offs from reading this book. There are links to people who elaborate on ideas introduced (or mainstreamed) in guice. For instance, this was my first entry into <a title="Super Type Tokens" href="http://gafter.blogspot.com/2006/12/super-type-tokens.html">TypeLiterals</a> (or TypeReferences). Also, I got a pointer (again) to <a title="ServiceLoader" href="http://java.sun.com/javase/6/docs/api/java/util/ServiceLoader.html">ServiceLoader</a> in Java6, which we all need to know about.</p>
<h2>Chapter by Chapter</h2>
<p>Here, I will give you my opinion on each chapter.</p>
<h3>Chapter 1: Setting the Stage</h3>
<ul>
<li>A good and <em>short</em> introduction to dependency injection</li>
<li>I was pleased that the intro on DI was nice and short. If you new nothing at all about DI, there could have been a little more info on this, but it gets the point out.</li>
</ul>
<h3>Chapter 2+3</h3>
<p>A good introduction and explanation of the core Guice functionality - aka: how all the injection stuff works</p>
<ul>
<li> Know your Java(5) beforehand</li>
<li>You will learn how to bootstrap guice, use guice annotations to inject stuff and how to wire it up with modules or annotations</li>
<li>All other sorts and stuff like: Injecting properties, static injection, custom scopes, using web scopes, organizing bootstrapping into several modules, &#8230;</li>
</ul>
<h3>Chapter 4: AOP</h3>
<ul>
<li> Guice supports method interception only (80% of the use cases in AOP are using 20% of the AOP features possible in Java)</li>
<li>Guice uses aopalliance.jar, which makes for a common api to AOP from the framework (aka: You can reuse the spring tx interceptor, if you like)</li>
<li>Shows how simple AOP can actually be, when packaged correctly</li>
<li>Of course, this is also due to limiting in functionality provided, just like EJB3 does</li>
</ul>
<h3>Chapter 5: Integration with the Web</h3>
<ul>
<li> How to bootstrap guice in a web application (the usual context listener stuff)</li>
<li>How to inject on servlets, plugin for struts2, wicket</li>
<li>I learned that guice 1.0 is very basic in its support for web integration</li>
<li>I also learned, that <a href="http://www.wideplay.com/">warp</a> provides extra stuff for web integration (amongst others)</li>
<li>You will have to do some initial digging, to see how well guice integration is supported for your favourite web framework</li>
</ul>
<h3>Chapter 6: Practical Guice</h3>
<ul>
<li> A practical example of how to configure guice with struts2, warp persist, JPA, and hibernate to build a real world web-stack application with transactions and database access</li>
<li>Really good, binds all the previous theory together in a practical example</li>
</ul>
<h3>Chapter 7: Guice Recipes</h3>
<ul>
<li> &#8220;..best practices and commonly asked questions&#8221;</li>
<li>Interesting stuff, that you are sure to be interested in, if you plan on using guice for real</li>
</ul>
<h3>Chapter 8: The Future</h3>
<ul>
<li>A look into what coming versions of guice might bring</li>
</ul>
<h2>Conclusion</h2>
<p>Overall, I think <a href="http://www.apress.com/book/view/9781590599976">the book</a> is good and certainly worth the money. Two questions that I would expect <em>any</em> book on <a href="http://code.google.com/p/google-guice/">google guice</a> to answer are:</p>
<ol>
<li>Why use guide instead of <a href="http://www.springframework.org/">spring</a>? and</li>
<li>What about the services provided by spring - like transactions?</li>
</ol>
<p>And I got an answer for these questions by reading this book:</p>
<ol>
<li>The last part of chapter 2, &#8220;Debunking Myths&#8221;, answers this in a good way. There is definitely a room for both Spring and Guice. They are not the same, even though they overlap. Guice is &#8220;just&#8221; a DI framework. In addition to this there are some other good points on their differences, and why you might chose one over the other.</li>
<li>Go <a href="http://www.wideplay.com/">warp@wideplay</a></li>
</ol>
<ol></ol>
<p>In addition to this, here is some cool stuff about guice, that I learned from reading the book:</p>
<ul>
<li>The way that all things are done in &#8220;plain&#8221; Java code (some of the config is not that plain, namely TypeLiterals). With a good IDE, this can safe you lots of building/running. Though IDEA has good support for spring, it has excellent support for Java.</li>
<li>Guice supports circular dependencies (for all bindings, that bind to an interface)</li>
</ul>
<img src="http://feeds.feedburner.com/~r/TechPer/~4/357735413" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.techper.net/2008/08/06/google-guice-agile-lightweight-dependency-injection-framework/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
