<?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"
	>

<channel>
	<title>Blogging about Software Development &#187; j2se</title>
	<atom:link href="http://www.bloggingaboutjava.org/category/java/j2se/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bloggingaboutjava.org</link>
	<description>Blogging about Software Development</description>
	<pubDate>Wed, 03 Dec 2008 15:09:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Java 1.4 is officially obsolete</title>
		<link>http://www.bloggingaboutjava.org/2008/11/java-14-is-officially-obsolete/</link>
		<comments>http://www.bloggingaboutjava.org/2008/11/java-14-is-officially-obsolete/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 13:37:52 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/?p=417</guid>
		<description><![CDATA[Sun&#8217;s Java 1.4 has quietly gone end-of-life since 30 October; see Sun&#8217;s Java SE 1.4.2 page:
J2SE 1.4.2 is in its Java Technology End of Life (EOL) transition period. The EOL transition period began Dec, 11 2006 and will complete October 30th, 2008, when J2SE 1.4.2 will have reached its End of Service Life (EOSL).
This doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Sun&#8217;s Java 1.4 has quietly gone end-of-life since 30 October; see <a title="Sun Java SE 1.4.2" href="http://java.sun.com/j2se/1.4.2/">Sun&#8217;s Java SE 1.4.2 page</a>:</p>
<blockquote><p><strong>J2SE 1.4.2 is in its Java Technology End of Life (EOL) transition period</strong>. The EOL transition period began Dec, 11 2006 and will complete October 30th, 2008, when J2SE 1.4.2 will have reached its End of Service Life (EOSL).</p></blockquote>
<p>This doesn&#8217;t mean that Sun doesn&#8217;t support Java 1.4 anymore - with Sun&#8217;s <a title="Java SE for Business" href="http://www.sun.com/software/javaseforbusiness/index.jsp">Java SE for Business</a> you can get up to 15 years of support for older Java versions.</p>
<p>However, if you&#8217;re on a project that still uses Java 1.4 you should really upgrade to Java 6, if you have any say into which Java version is being used. Besides the new features added in Java 5 and 6, you&#8217;ll enjoy the <a href="http://java.sun.com/performance/reference/whitepapers/6_performance.html">performance enhancements</a> and bug fixes.</p>
<p>If you&#8217;re a Java programmer and you still didn&#8217;t learn the new Java 5 features&#8230; then you&#8217;re in trouble.</p>
<p>The SCJP exam for Java 1.4 has been discontinued this month.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2008/11/java-14-is-officially-obsolete/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Closures for Java, is it really a good idea?</title>
		<link>http://www.bloggingaboutjava.org/2008/06/closures-for-java-is-it-really-a-good-idea/</link>
		<comments>http://www.bloggingaboutjava.org/2008/06/closures-for-java-is-it-really-a-good-idea/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 17:17:11 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/?p=351</guid>
		<description><![CDATA[There&#8217;s a very good article on JavaWorld by Klaus Kreft and Angelika Langer (the latter is the author of the well-known Java Generics FAQ) with the title Understanding the closures debate. I heard about this article on JavaPosse episode 194, and it&#8217;s also being discussed on Artima.
I knew that there were proposals to add closures [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a very good article on JavaWorld by Klaus Kreft and Angelika Langer (the latter is the author of the well-known <a href="http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html">Java Generics FAQ</a>) with the title <a href="http://www.javaworld.com/javaworld/jw-06-2008/jw-06-closures.html">Understanding the closures debate</a>. I heard about this article on <a href="http://javaposse.com/index.php?post_id=353281">JavaPosse episode 194</a>, and it&#8217;s also being <a href="http://www.artima.com/forums/flat.jsp?forum=270&amp;thread=233108">discussed on Artima</a>.</p>
<p>I knew that there were proposals to add closures to Java, but I hadn&#8217;t yet looked into the details of the proposals. The article explains very clearly what closures are exactly and gives a good overview of the three main proposals that there are today: CICE + ARM, BGGA and FCM + JCA. Read the article if you want to know what the alphabet soup means exactly. In short:</p>
<ul>
<li>CICE + ARM, proposed by Joshua Bloch and others, is not much more than a new, shorter syntax for anonymous inner classes.</li>
<li>BGGA, proposed by Gilad Bracha, Neal Gafter, James Gosling, and Peter von der Ahé, is the most ambitious proposal and almost makes Java a <a href="http://en.wikipedia.org/wiki/Functional_programming">functional programming language</a>.</li>
<li>FCM, proposed by Stephen Colebourne and Stefan Schulz, also adds functional programming paradigms but doesn&#8217;t go as far as BGGA in some aspects.</li>
</ul>
<p><span id="more-351"></span>What&#8217;s so controversial about adding closures to Java? Adding any new feature to the programming language makes it more complex. There are people who fear that adding a powerful but complicated feature such as closures might make Java too complex - which means that people will turn away from Java in favour of easier programming languages. This <a href="http://www.parleys.com/display/PARLEYS/Home#slide=1;talk=5210267;title=The%20Closures%20Controversy">talk by Joshua Bloch</a> from JavaPolis 2007 makes clear how complicated Java could become if BGGA closures would be added.</p>
<p>So, the question is, is it really such as good idea to add closures to the Java programming language? I&#8217;m not sure that it is worth the trouble. After reading the article and seeing Bloch&#8217;s talk, I&#8217;m convinced that adding far-reaching closures such as BGGA and FCM will not be so great. What I especially don&#8217;t like in the BGGA proposal are the non-local returns: a return statement in a closure means you&#8217;re returning from the method that the closure is called in, not from the closure itself. This makes code very confusing and hard to understand.</p>
<p>I can see how CICE closures would be useful and at least it looks like that proposal is a lot simpler than the other two. But regardless of how much complexity closures would add to Java, there are reasons for me to doubt whether it&#8217;s a good idea at all to add closures to Java.</p>
<p>Java is an <a href="http://en.wikipedia.org/wiki/Imperative_programming">imperative programming language</a>. Because of this, Java programmers generally use an imperative programming style. For example, we write a loop like this:</p>
<pre>List&lt;String&gt; names = ...;

for (String name : names) {
    System.out.println(name);
}</pre>
<p>Adding closures will encourage a functional programming style, which is completely different from the imperative style. In the functional style, you&#8217;d write a loop very differently; you&#8217;d call a forEach method on the collection, passing it a closure to execute on each element of the collection (this is what it would look like with BGGA closures):</p>
<pre>List&lt;String&gt; names = ...;

names.forEach({ String name =&gt; System.out.println(name); });</pre>
<p>What are the consequences of this? Does this mean that for example there are going to be lots of new methods (such as the forEach() method shown above) in Java&#8217;s collections API to support this style of programming? That would bloat the collections API. Can you imagine what a mess you would get if you&#8217;re working on a project with multiple developers where some developers prefer the imperative style and others the functional style?</p>
<p>I&#8217;m not opposed to the concept of closures itself, they work very well in other programming languages such as Ruby. The difference is, however, that Ruby has had closures since the beginning, so that Ruby&#8217;s standard library was designed to work with closures from the start. If (part of) the standard Java library, such as the collections API, which was designed for the imperative programming style, is going to be extended to add support for closures, it will just grow into a complicated and bloated piece of patchwork.</p>
<p>The cost of adding a new feature to the programming language is very high. Millions of Java developers around the world will need to invest time and money to learn the new feature. The authors of the thousands of libraries and frameworks will need to think about the consequences for their products. And closures is not just another minor feature, it will add a whole new programming paradigm to Java. Are closures really worth all that effort? So far, I haven&#8217;t heard any convincing reason why it would be a good idea to add closures to Java. Sure, they are a cool and powerful feature. But how are closures going to make things easier for me as a Java programmer? I&#8217;m not convinced that they are worth the extra complexity and API bloat that they will add to Java.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2008/06/closures-for-java-is-it-really-a-good-idea/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TheServerSide Europe, third day</title>
		<link>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-third-day/</link>
		<comments>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-third-day/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 14:25:19 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Events]]></category>

		<category><![CDATA[J2ee]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[RIA]]></category>

		<category><![CDATA[Scripting]]></category>

		<category><![CDATA[TheServerSide Symposium Europe]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/?p=332</guid>
		<description><![CDATA[ The third and last day of the conference. The first session I went to this morning was a very interesting one, &#8220;The Busy Java Developer&#8217;s Guide to Scala&#8221; by Ted Neward. He explained the basics of the Scala programming language. Scala is a new and very interesting programming language that combines object oriented and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://www.bloggingaboutjava.org/cms/wordpress2/wp-content/uploads/2008/06/serverside.jpg" alt="" align="left" /> The third and last day of the conference. The first session I went to this morning was a very interesting one, &#8220;The Busy Java Developer&#8217;s Guide to Scala&#8221; by <a href="http://www.tedneward.com">Ted Neward</a>. He explained the basics of the <a href="http://www.scala-lang.org/">Scala programming language</a>. Scala is a new and very interesting programming language that combines object oriented and functional programming. The name is a contraction of &#8220;Scalable Language&#8221;. It runs on the JVM and interoperates very easily with Java - you can use Java classes seamlessly in Scala. I&#8217;ve looked at Scala before, but there was one interesting thing Ted showed which I didn&#8217;t know yet and which would also be an interesting feature to put into Java: You can put import statements not only at the top of a source file, but also inside classes or even inside methods. By doing this, you limit the scope of the import statement.</p>
<p><span id="more-332"></span></p>
<p>For example (note, the &#8220;import BigDecimal._&#8221; is the same as &#8220;import static java.math.BigDecimal.*&#8221; in Java):</p>
<p><code>object HelloWorld {<br />
def main(args : Array[String]) = {<br />
// Import BigDecimal into the scope of this block of code<br />
import java.math.BigDecimal, BigDecimal._</p>
<p>val a = ONE.add(ONE);<br />
println(&#8221;One plus one is: &#8221; + a)<br />
}<br />
}</code></p>
<p><a href="http://lamp.epfl.ch/~odersky/">Martin Odersky</a>, the inventor of Scala, is currently busy writing a book of which a pre-print version is available at <a href="http://www.artima.com/">Artima</a>. At the moment, Scala is not yet ready for prime time (there are still some funky bugs in the compiler and some rough edges in the language itself, and IDE support is not yet complete), but there&#8217;s a good chance that this is going to be an important new programming language in the next two or three years.</p>
<p>The second session I went to today was &#8220;Distributed Computing and MapReduce: Technology Selection, Implementation and Deployment Made Easy&#8221; by Eugene Ciurana. He explained what <a href="http://en.wikipedia.org/wiki/MapReduce">MapReduce</a> is - an algorithm for processing large amounts of data efficiently in two steps (&#8221;map&#8221; and &#8220;reduce&#8221;). The idea came from Google. Eugene explains how it&#8217;s used in the company where he works to analyze log files from webservers, to find out from which countries people are accessing their website. There are a number of implementations of MapReduce available, for example the open source <a href="http://hadoop.apache.org">Hadoop</a> from Apache and commercial products from for example GigaSpaces, GridGain and Terracotta. He also used <a href="http://mule.mulesource.org/display/MULE/Home">Mule</a> (see also this <a href="http://www.theserverside.com/tt/articles/article.tss?l=CaseStudyMule">case study</a> from Eugene).</p>
<p>My third session of today was &#8220;Performance Tuning a Web Shop with Open Source Tools&#8221; by Jeroen Borgers of Xebia. Often, when developers have to solve a performance problem, they make a guess about what&#8217;s wrong with the application and try to fix that, but in reality the only way to know what&#8217;s really wrong is by measuring instead of guessing. Jeroen talked about a project in which he used tools such as <a href="http://jakarta.apache.org/jmeter/index.html">JMeter</a> and <a href="http://jamonapi.sourceforge.net/">JAMon</a> to measure performance, and <a href="http://sourceforge.net/projects/jarep">JARep</a>, a reporting tool for application performance data that he wrote himself.</p>
<p>After lunch I went to &#8220;How to Choose your Java Web Framework&#8221; by Shashank Tiwari. It&#8217;s a question that ofcourse interests a lot of developers, because there are hundreds of frameworks and it&#8217;s not easy to determine which one you should use. Besides discussing the characteristics of the most popular frameworks he also talked about whether you should use a framework at all, because there are also some disadvantages: you&#8217;ll have to deal with a learning curve, for simple applications a framework can unnecessarily complicate things, it can cause infrastructure bloat, and it presents challenges for testing and maintenance. Ofcourse he didn&#8217;t come up with a perfect recipe for choosing a framework. He finished with two conclusions: For simple applications, it doesn&#8217;t matter a lot which framework you choose (or if you use a framework at all), so you shouldn&#8217;t waste much time on it; for larger applications, that are part of a bigger system, it&#8217;s probably best to go for a &#8220;full stack&#8221; solution such as Spring or JBoss Seam, because you&#8217;ll have less integration problems in your project.</p>
<p>The last session I went to was &#8220;Real Google Web Toolkit Applications&#8221; by Jeff Dwyer. <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> is a web application framework by Google which allows you to program in Java, as if you&#8217;re writing a Swing desktop application. It compiles your Java code into a web application with JavaScript. He showed how GWT works by looking at a real-world example application which integrates GWT with Spring MVC. GWT is one of those things that&#8217;s on my list of things to look at sometime.</p>
<p>So, it was an interesting conference, I&#8217;ve learned a number of new things and got some new ideas. Thanks to <a href="http://www.javaranch.com">JavaRanch</a> for giving me a free ticket for this conference!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-third-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TheServerSide Europe, second day</title>
		<link>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-second-day/</link>
		<comments>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-second-day/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 16:34:47 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Events]]></category>

		<category><![CDATA[J2ee]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[RIA]]></category>

		<category><![CDATA[Scripting]]></category>

		<category><![CDATA[TheServerSide Symposium Europe]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/?p=331</guid>
		<description><![CDATA[ The first keynote of today was &#8220;Language-Oriented Computing: Shifting Paradigms&#8221; by Neal Ford. It was a good presentation (with nice slides), mainly about domain-specific languages. See also Martin Fowler&#8217;s page on DSLs.
At 9:10 I went to &#8220;Spring 2.5 On the Way to 3.0&#8243; by Jürgen Höller (one of the main committers on the Spring [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://www.bloggingaboutjava.org/cms/wordpress2/wp-content/uploads/2008/06/serverside.jpg" alt="" align="left" /> The first keynote of today was &#8220;Language-Oriented Computing: Shifting Paradigms&#8221; by <a href="http://javasymposium.techtarget.com/europe/speakers.html#NFord">Neal Ford</a>. It was a good presentation (with nice slides), mainly about <a href="http://en.wikipedia.org/wiki/Domain-specific_language">domain-specific languages</a>. See also <a href="http://martinfowler.com/bliki/DomainSpecificLanguage.html">Martin Fowler&#8217;s page on DSLs</a>.</p>
<p>At 9:10 I went to &#8220;Spring 2.5 On the Way to 3.0&#8243; by Jürgen Höller (one of the main committers on the Spring framework). He explained some new features in Spring 2.5, and went quite deep into the technical details of the @Autowired and other annotations - which was quite boring. He spent so much time on talking about those details that he had almost no time left to talk about 3.0. Spring 3.0 will be for Java 5 and newer only, and some new features that it will have are an expression language, support for REST and some preparation to support servlets 3.0. I wonder why they&#8217;re going to give it version number 3.0 instead of 2.6, since it didn&#8217;t sound like it would be a lot different from the current Spring 2.5.</p>
<p><span id="more-331"></span></p>
<p>The next session I attended was &#8220;Groovy in the Enterprise: Case Studies&#8221; by Guillaume Laforge. As the title suggested, he showed some examples of where and how Groovy has been used by companies. He discussed a number of use cases, such as: using Groovy as a developer tool (for example for testing or extending Ant or Maven), using Groovy to extend your applications (for example by using the Java scripting API to run Groovy scripts from within your application), using Groovy to create a DSL and using Groovy and Grails for web development. There was some overlap with his presentation about Grails that I attended yesterday.</p>
<p>At 11:40 there was an expert panel session titled &#8220;Languages: The Next Generation&#8221; with Ola Bini, Ted Neward and Guillaume Laforge. They discussed about the programming languages that are currently popular or that get a lot of attention. I found the session a bit disappointing, I had expected more. The panel didn&#8217;t come up with a clear answer or vision about what the next generation of programming languages is going to be. The only conclusion they came to was that Java is here to stay and that other languages such as Groovy, JRuby and Scala will be important additional languages, but they&#8217;re not going to completely replace Java.</p>
<p>After lunch I went to &#8220;Lifecycle APM: Monitor, Diagnose and Prevent Performance Issues&#8221; by Alois Reitbauer (from <a href="http://www.dynatrace.com">dynaTrace</a>). This session was a &#8220;vendor tech brief&#8221;, so there was some marketing talk, about dynaTrace&#8217;s tool that allows you to follow transactions through a whole chain of systems (so that you can monitor and debug performance of the system).</p>
<p>At 13:50 I went to &#8220;JRuby on Rails: Web Development Evolved&#8221; by <a href="http://ola-bini.blogspot.com/">Ola Bini</a>. He spent a lot of time on explaining the Ruby programming language, and had unfortunately not a lot of time left to explain how Rails works on JRuby, which was what I was interested in (I&#8217;ve already used Ruby for some time, so the intro to Ruby was not so interesting for me). Anyway, <a href="http://www.ruby-lang.org">Ruby</a> is an interesting, easy to learn and easy to use programming language, and I&#8217;d recommend any Java developer who wants to learn some other language to have a look at it.</p>
<p>The next session I went to was &#8220;Concurrency &amp; High Performance&#8221; by <a href="http://kirk.blog-city.com/">Kirk Pepperdine</a>. He&#8217;s a well-known guy in the field of high-performance and concurrent programming in Java. Writing software that efficiently uses multi-core processors is not easy, but it&#8217;s becoming more and more important with the current trend of multi-core processors. One of the things Kirk mentioned was the fork/join framework that will be <a href="http://www.infoq.com/news/2007/07/concurrency-java-se-7">added in Java SE 7</a>. One book that I want to read someday soon is <a href="http://www.amazon.co.uk/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1213883530&amp;sr=1-1">Java Concurrency in Practice</a>, I&#8217;ve heard that it&#8217;s a very good book.</p>
<p>At the end of the afternoon there were &#8220;fireside chats&#8221;, which were sessions in which a few people did some short demos and then discussed among each other and with the audience about the things they demonstrated. I went to the fireside chat titled &#8220;Zero Turnaround in Java development&#8221;, which was about developing in Java in such a way that you don&#8217;t have to go through stop / recompile / redeploy / start cycles all the time. Guillaume Laforge showed how you can edit your Groovy web application on the fly. Geert Bevin showed how the <a href="http://rifers.org/">RIFE framework</a> supports the same thing, and Jevgeni Kabanov (from <a href="http://www.zeroturnaround.com/">ZeroTurnaround</a>) showed his (commercial) tool JavaRebel, which is a JVM plugin that allows you to reload classes in a running JVM. They discussed about the use and limitations of their tools and answered questions from the audience.</p>
<p>I arrived here late in the evening last Tuesday and I&#8217;ve hardly been outside the hotel (the conference is held at the hotel), so I haven&#8217;t seen Prague yet. Tonight there&#8217;s a &#8220;meet a stranger&#8221; dinner - you could put your name on one of five lists, and you&#8217;re going out to dinner with the other people on the list. So I&#8217;m going to a restaurant in the center of the city tonight with a few other people to have traditional Czech food.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-second-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TheServerSide Europe, first day</title>
		<link>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-first-day/</link>
		<comments>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-first-day/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 06:23:20 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Events]]></category>

		<category><![CDATA[J2ee]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[RIA]]></category>

		<category><![CDATA[Scripting]]></category>

		<category><![CDATA[TheServerSide Symposium Europe]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/?p=325</guid>
		<description><![CDATA[I am in Prague, at the TheServerSide Java Symposium Europe. It&#8217;s a conference much like other conferences about Java, but not as big (there are about 300 attendees) and with a focus on server-side Java technology (although non-Java stuff such as Adobe Flex and AIR, Groovy and JRuby also get some attention).
The first day started [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://www.bloggingaboutjava.org/cms/wordpress2/wp-content/uploads/2008/06/serverside.jpg" alt="" align="left" />I am in Prague, at the <a href="http://javasymposium.techtarget.com/europe/index.html">TheServerSide Java Symposium Europe</a>. It&#8217;s a conference much like other conferences about Java, but not as big (there are about 300 attendees) and with a focus on server-side Java technology (although non-Java stuff such as Adobe Flex and AIR, Groovy and JRuby also get some attention).</p>
<p>The first day started early at 8:00 AM with a keynote by <a href="http://www.javapolis.com/confluence/display/~stephan/Home">Stephan Janssen</a> from <a href="http://www.bejug.org">BeJUG</a> (famous for organising <a href="http://www.javapolis.com">JavaPolis</a>, which has now been renamed to Javoxx). His keynote was about different RIA (Rich Internet Applications) technologies. He gave an overview of the different choices that you have for the client side, server side and data protocols to communicate between the two (HTML, XML, JSON, Hessian, &#8230;). He demonstrated his <a href="http://www.parleys.com">Parleys</a> website, which is an AIR multimedia-application (have a look, it&#8217;s a very interesting website with lots of presentations with video and slides from the past few JavaPolises and other conferences). Besides the AIR version, he also had an implementation of the Parleys website done in <a href="http://code.google.com/webtoolkit/">GWT</a> and also one done in <a href="http://java.sun.com/javafx/">JavaFX</a>. He calls JavaScript &#8220;VoodooScript&#8221; because writing an application in JavaScript and DHTML requires black magic to make it work in all the webbrowsers that people might use.</p>
<p><span id="more-325"></span>After the keynote I went to a session titled &#8220;Integrating JPA and Hibernate with Rich Internet Applications&#8221; by <a href="http://shanky.org/">Shashank Tiwari</a> (from <a href="http://www.saventech.com">Saven Technologies</a>). He talked about using Hibernate (as an implementation of JPA, the Java Persistence API) on the server for a client written with Adobe Flex. There are different ways to do this, you can use LCDS (Lifecycle Data Services, a product by Adobe) or an open source alternative such as <a href="http://www.graniteds.org">GraniteDS</a> or <a href="http://code.google.com/p/dphibernate/">dpHibernate</a>. He gave an idea of how you could use those libraries by showing some examples of configuration files. I found this talk not the most interesting one I&#8217;ve seen on the first day (probably because the topic wasn&#8217;t really relevant to my current job).</p>
<p>The third session I went to was &#8220;Monitoring, Management and Troubleshooting in the Java SE 6 Platform&#8221; by Jean-Francois Denise (from Sun). He first talked about <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">JMX</a> and how to write MBeans or MXBeans for your application so that you can monitor and manage your application with a tool like JConsole. Besides JConsole, Java SE 6 comes with a whole list of other useful tools, such as: jinfo, jstat, jstack, jps, jmap and jhat. Sun is working on a new tool, <a href="https://visualvm.dev.java.net/">jvisualvm</a>, which looks like a new and improved version of JConsole, which Jean-Francois demonstrated. This was an interesting session, and it reminded me of JMX and all those tools. I think JMX is a very useful API that people unfortunately often overlook; it&#8217;s not that hard to write MBeans and tools like JConsole can be very useful as a simple memory profiler and for managing running Java processes.</p>
<p>Next was another keynote, &#8220;Getting Ready for the Cloud&#8221;, by Nati Shalom from GigaSpaces. I was afraid that this was going to be not much more than a marketing talk, but it wasn&#8217;t really. Nati talked about cloud computing: instead of having a few big servers, you have a large amount of smaller computers to do the work. This has certain benefits for scalability.</p>
<p>The first session after lunch that I wanted to attend was &#8220;Comparing Dependency Injection Frameworks&#8221;, but a few minutes after the talk was supposed to start, it was announced that the presenter wasn&#8217;t there. So I went to &#8220;SOA Using Service Component Architecture&#8221; instead, by Mike Keith. This session was about SCA and <a href="http://www.osoa.org/">Open SOA</a>. SCA is a set of specifications about components and their interfaces for using in a service oriented architecture. It specifies components that have input and output interfaces, properties to configure them and how they can be wired together. There are also specifications for how SCA is implemented using for example Java, webservices, C++, PHP and other technologies. In Java, you can use annotations to specify a component and its interfaces and properties. The good thing about SCA is that it makes it possible to wire together service components that are implemented in different technologies, because the components will have a standard interface.</p>
<p>The next session I went to was &#8220;Simplifying Java EE Development with Grails&#8221; by Guillaume Laforge. It was a straightforward presentation about Groovy and Grails. Grails is a web framework and a set of tools that enables you to quickly build a (CRUD) web application, just like Rails (for Ruby). I&#8217;ve played with Ruby and Rails myself, but I haven&#8217;t really looked at Groovy and Grails much yet. Looks like an interesting language and framework to have a look at when I have time.</p>
<p>The last session of the first day that I went to was &#8220;Better Enterprise Software with the Spring Portfolio&#8221; by Eberhard Wolff (from <a href="http://www.springsource.com/">SpringSource</a>). He talked about a case study in which he used different Spring technologies, such as Spring Beans, Spring Webservices and Spring Batch. The Spring framework really tries to be a big framework which you can use for almost anything, and its popularity shows its success. While watching this session I thought back about the session about SCA, because there seemed to be some overlap in the way that you declare components with annotations in the way that SCA specifies and in how you declare and configure different kinds of components with annotations in Spring.</p>
<p>And now the first day is already over. I always feel that time goes by very quickly at conferences.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2008/06/theserverside-europe-first-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Metric Driven Software Development ?</title>
		<link>http://www.bloggingaboutjava.org/2007/11/metric-driven-software-development/</link>
		<comments>http://www.bloggingaboutjava.org/2007/11/metric-driven-software-development/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 15:17:47 +0000</pubDate>
		<dc:creator>Arjen van Schie</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Methodologies]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/cms/wordpress/2007/11/metric-driven-software-development/</guid>
		<description><![CDATA[In my last blog I already mentioned the role of software metrics in my graduation assignment. Software metrics are indicators for the quality of the source of a program. For example, one of the most well known metrics is McCabe&#8217;s cyclomatic complexity. This metric gives an indication of the complexity of a method or module/class. [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fwww.bloggingaboutjava.org%2Fcms%2Fwordpress%2F2007%2F11%2Fprogramming-with-meta-data-an-example-for-concurrency%2F&amp;ei=Gh84R732C5a40gS_5bHmDA&amp;usg=AFQjCNFvsEeu75GFIwKhwJXdXghKcMAQMQ&amp;sig2=CqxCJJqWlWvjD8pkWY4YqA">my last blog</a> I already mentioned the role of <a href="http://en.wikipedia.org/wiki/Software_metric">software metrics</a> in my graduation assignment. Software metrics are indicators for the quality of the source of a program. For example, one of the most well known metrics is <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">McCabe&#8217;s cyclomatic complexity</a>. This metric gives an indication of the complexity of a method or module/class. To calculate this complexity it uses the number of control-flows within this module.<br />
Other well known metrics are described by Chidamber and Kemerer, <a href="http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf"><em>A Metrics Suite for Object Oriented Design</em></a><a href="http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf">.</a> These metrics can play a great role in source-code reviewing; for instance to give an indication of the classes that will be hard to maintain and understand.</p>
<p>For my assignment I used metrics to evaluate the modularity, encapsulation and complexity of different implementations of the same concurrency functionalities.The modularity, encapsulation and complexity gave an indication of their maintainability.</p>
<p>The fact that more and more tools for software metrics are released and used is a good thing, because evaluating source-code and refactoring the &#8216;bad&#8217; code can be of great importance for a good evolution of a software product (to keep it maintainable).<br />
But it should not be used as a &#8216;development method&#8217;, lately I see other developers write their code in a way to get optimal results on one or two of these metrics. This is what I would like to call <em>metric driven development</em> and should be avoided. <em>Why ?</em><br />
Well because software metrics are <strong><em>indicators</em></strong> no more no less, a program for which metrics show good complexity metrics indicates the code is easy to understand, but does not guarantee it !</p>
<p>Software with good metric values can still be &#8216;bad&#8217;. For example, brainlessly refactoring for good metrics might hurt the shared abstraction levels of the methods or their cohesiveness. Which are also important source-code characteristics <a href="http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1196261911&amp;sr=1-1">according to McConnell</a>, and therefore making it doubtful that the refactoring was of any help to the project.</p>
<p>A second reason would be that optimizing code for some metrics will likely hurt the other metrics. For example when minimizing the number of lines of code in a method, one might extract new methods, resulting in a larger amount of methods per object and probably larger amount of lines per class.</p>
<p>So my personal advice would be to use software metrics only in the way they where meant to be: to evaluate a piece of software and to realize that it&#8217;s just a tool to <strong><em>indicate</em></strong> software quality not a <strong><em>guarantee</em></strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2007/11/metric-driven-software-development/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s just common(s) sense</title>
		<link>http://www.bloggingaboutjava.org/2006/04/its-just-commons-sense/</link>
		<comments>http://www.bloggingaboutjava.org/2006/04/its-just-commons-sense/#comments</comments>
		<pubDate>Mon, 03 Apr 2006 07:59:51 +0000</pubDate>
		<dc:creator>Emil van Galen</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/cms/wordpress/?p=83</guid>
		<description><![CDATA[Most java projects use a bunch of common classes for various things.
Because this functionality is so common, we tend to copy these common classes from one of our earlier projects.
Instead of just copying some &#8216;legacy&#8217; snippets from previous projects, it might be a more sensibly thing to use the (Apache) Jakarta Commons libraries instead.
One of [...]]]></description>
			<content:encoded><![CDATA[<p>Most java projects use a bunch of common classes for various things.<br />
Because this functionality is so common, we tend to copy these common classes from one of our earlier projects.<br />
Instead of just copying some &#8216;legacy&#8217; snippets from previous projects, it might be a more sensibly thing to use the (Apache) Jakarta Commons libraries instead.<br />
One of the jakarta commons should be mandatory for each Java project: Commons Lang</p>
<p>The commons lang contains all kind of utility classes that will make you think why it is not part of the standard Java lang(uage).</p>
<p>One of the most handy features of the Commons Lang are the Builder classes to easily create toString, equals and hashCode implementations for a class. All these builder classes are smart enough to detail with null and array arguments, so you don&#8217;t have to.</p>
<p>Another handy class is the StringUtils class that contains a whole bunch of string functionality like isEmpy / isBlank, trimming, replacing, chomp / chop etc.</p>
<p>When coding I like to aggressively enforce my constructor / method pre-conditions by throwing and IllegalArgumentException when any argument value is not according to a  pre-condition. The Validation class will help you with that. It contains utility methods to easily check if the supplied argument isTrue, notEmpty and notNull. Furthermore for a collection / array you can easily validate if there are no null element and that all elements are of a certain type.</p>
<p>There last class I would like to mention is the Enum / ValuedEnum base class.<br />
By extending from this class you can easily create a enum class in Java 1.4 (in Java 5 you should use the new enum language functionality).</p>
<p>I would advise any Java programmer to have a (short) look at the <a href="http://jakarta.apache.org/commons/lang/api-release/index.html">Javadocs</a> of Commons Lang, because besides the features I described above there are a lot more gems to be discovered.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2006/04/its-just-commons-sense/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java generics quirks</title>
		<link>http://www.bloggingaboutjava.org/2006/01/java-generics-quirks/</link>
		<comments>http://www.bloggingaboutjava.org/2006/01/java-generics-quirks/#comments</comments>
		<pubDate>Mon, 16 Jan 2006 10:31:37 +0000</pubDate>
		<dc:creator>Jesper de Jong</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/cms/wordpress/?p=76</guid>
		<description><![CDATA[One of the major new features of Java 5.0 is generics. The main purpose of generics is to provide you with a way to make type safe collections, for example, you can specify that your List contains only String objects. The obvious advantages are that the compiler can check at compile time that nothing else [...]]]></description>
			<content:encoded><![CDATA[<p>One of the major new features of Java 5.0 is <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html">generics</a>. The main purpose of generics is to provide you with a way to make type safe collections, for example, you can specify that your List contains only String objects. The obvious advantages are that the compiler can check at compile time that nothing else than String objects are stored in the List and that you can eliminate a lot of type casts from your source code.<br />
<code><br />
// Old style, not type safe<br />
List names = new ArrayList();<br />
names.add("Jesper");<br />
names.add(new Integer(123));  // not what you meant, but no error or warning<br />
</code><code><br />
// Java 5.0, using generics<br />
List&lt;String&gt; names = new ArrayList&lt;String&gt;();<br />
names.add("Jesper");<br />
names.add(new Integer(123));  // compiler error<br />
</code></p>
<p>That seems simple enough, but if you study generics in more detail, you will discover that there are some strange limitations that don&#8217;t look obvious at first sight.</p>
<p>For example, here is one limitation of generics I would like to highlight: You cannot create an array whose component type is a concrete parameterized type. An example to explain what this means:<br />
<code><br />
// An array of a list of strings. This is illegal, but why?<br />
List&lt;String&gt;[] data = new ArrayList&lt;String&gt;[10];<br />
</code></p>
<p>At first sight, this looks perfectly reasonable. But if you try to compile this, you get an error message, and it isn&#8217;t very helpful either:<br />
<code><br />
Jesper.java:6: generic array creation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;String&gt;[] data = new ArrayList&lt;String&gt;[10];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br />
1 error<br />
</code></p>
<p>The compiler just tells you that you can&#8217;t do this, but it doesn&#8217;t give a hint why. To understand why this is illegal, we have to know a few things about arrays and generics in Java.</p>
<p>First of all, arrays are <em>covariant</em>, which means that an array of supertype references is a supertype of an array of subtype references. For example, Object[] is a supertype of String[], and a string array can be accessed through a reference variable of type Object[].<br />
<code><br />
Object[] example = new String[10];  // ok<br />
example[0] = &#8220;Hello World!&#8221;;<br />
</code></p>
<p>Arrays also carry runtime type information about their component type. At runtime, when you assign a value to an array element, an <em>array store check</em> is performed to check that you&#8217;re not storing a value in the array that&#8217;s not compatible with its component type. If the check fails, an ArrayStoreException is thrown.<br />
<code><br />
Object[] example = new String[10];<br />
example[0] = new Long(123);  // compiles, but throws ArrayStoreException at runtime<br />
</code></p>
<p>That still doesn&#8217;t explain why arrays of concrete parameterized types are illegal. There&#8217;s one more thing we have to understand, and that is the process of <em>type erasure</em>.</p>
<p>When you compile Java source code in which generic types are used, the compiler does the extra type checks and then translates the code into plain old Java code without generics. If you would decompile the byte code, you would see that the generics have disappeared. So for example List&lt;String&gt; and List&lt;Integer&gt; would both look like the plain old List in the byte code - the information about the generics has been lost by the process of type erasure. The following example illustrates this:<br />
<code><br />
List&lt;String&gt; names = new ArrayList&lt;String&gt;();<br />
List&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;();<br />
</code><code><br />
System.out.println("Runtime type of 'names': " + names.getClass().getName());<br />
System.out.println("Runtime type of 'values': " + values.getClass().getName());<br />
</code></p>
<p>The output of this piece of code is:<br />
<code><br />
Runtime type of 'names': java.util.ArrayList<br />
Runtime type of 'values': java.util.ArrayList<br />
</code></p>
<p>As you see, both look like plain old ArrayList at runtime. I won&#8217;t go into the details here of how and why the compiler handles generics using type erasure.</p>
<p>So here comes the catch. The combination of how arrays work (covariance and runtime type information about the component type) and type erasure for generic types creates a problem when you want to create an array of a concrete parameterized type.</p>
<p>Because of type erasure, there is no exact type information available for the generic type at runtime, so that the array store check doesn&#8217;t work, and an unacceptable situation occurs. Here&#8217;s an example.<br />
<code><br />
List&lt;String&gt;[] data = new ArrayList&lt;String&gt;[10];  // illegal, but assume that this would be ok<br />
</code><code><br />
Object[] objArr = data;<br />
objArr[0] = new ArrayList&lt;Integer&gt;();  // should fail, but would succeed<br />
</code><code><br />
List&lt;String&gt; firstList = data[0];  // would fail with ClassCastException, but there&#8217;s no cast!<br />
</code></p>
<p>Because of type erasure, List&lt;String&gt; looks like a plain List and ArrayList&lt;Integer&gt; looks like a plain ArrayList at runtime. The array store check would succeed, because ArrayList is a subtype of List. Ofcourse we now end up in an unacceptable situation - the first element of the array now contains an ArrayList&lt;Integer&gt;, which shouldn&#8217;t be possible.</p>
<p>To avoid this problem, the Java language engineers at Sun simply decided to make arrays of concrete parameterized types illegal.</p>
<p>Isn&#8217;t it ugly that a construct that looks perfectly reasonable (you can make an array of any type, so why not of a concrete parameterized type?) is made illegal essentially because of the way the compiler treats generics? In other words, the language has a hole now because of the implementation details of the compiler.</p>
<p>This is just one of the quirks that you find when you look at generics in depth. You can find a lot of detailed information about generics in <a href="http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html">Angelika Langer&#8217;s Java Generics FAQ</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2006/01/java-generics-quirks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ThreadLocal is your friend</title>
		<link>http://www.bloggingaboutjava.org/2005/12/threadlocal-is-your-friend/</link>
		<comments>http://www.bloggingaboutjava.org/2005/12/threadlocal-is-your-friend/#comments</comments>
		<pubDate>Thu, 22 Dec 2005 10:48:43 +0000</pubDate>
		<dc:creator>Klaas van der Ploeg</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[j2se]]></category>

		<guid isPermaLink="false">http://www.bloggingaboutjava.org/cms/wordpress/?p=74</guid>
		<description><![CDATA[Some years ago I found out about this class being very usefull in your application. You never used a ThreadLocal? I&#8217;ll explain the concept and provide some examples.
So what&#8217;s the difference between a thread-local variable and a normal variable? When a thread accesses a thread-local variable it has its own independently initialized copy of the [...]]]></description>
			<content:encoded><![CDATA[<p>Some years ago I found out about this class being very usefull in your application. You never used a <code>ThreadLocal</code>? I&#8217;ll explain the concept and provide some examples.<br />
So what&#8217;s the difference between a thread-local variable and a normal variable? When a thread accesses a thread-local variable it has its own independently initialized copy of the variable. Each thread holds an implicit reference to its copy as long as the thread is alive. So when the thread goes away, all of its thread-local instances are subject to gc.<br />
You typically use an anonymous inner class to provide an initial value (if any) using an appropriate constructor and return the newly constructed object.</p>
<p>You can use this <code>ThreadLocal</code> in several situations:</p>
<p><strong>To keep state with a thread (user-id, transaction-id, logging-id)</strong><br />
Log4j uses this for the <a href="http://logging.apache.org/log4j/docs/api/org/apache/log4j/NDC.html">NDC</a> (Nested Diagnostic Contexts) feature, you surely need this if you ever want to be able to debug a heavily used production application (some more info <a href="http://www.javaworld.com/javaworld/jw-11-2000/jw-1122-log4j-p3.html">here</a>).<br />
My current project uses ThreadLocals to trace incoming and outgoing messages (XML via JMS). When we receive a message we put a <a href="http://mathworld.wolfram.com/PseudorandomNumber.html">pseudorandom</a> 44-bit number into the thread-local variable. Important events (exceptions, any outgoing messages, result of processing) are logged with the value of the thread-local variable. This way we correlate events in the main log of the application.</p>
<p><strong>To cache objects which you need frequently</strong><br />
Another way of using a <code>ThreadLocal</code> is for performance optimalization. You can imagine that there are certain objects which are relatively expensive to initialize, but are not threadsafe. Examples of these objects are XML <code>DocumentBuilder</code>s (with XSD validation), and <code>SimpleDateFormat</code> (needs a <code>Calendar</code> instance).<br />
When you put the <code>SimpleDateFormat</code> in a thread-local variable, you don&#8217;t have to create a local one for every format operation you need to do (we need them quite often), but still are safe with concurrent processing. Implement this as:</p>
<pre>
public class DateUtil {
   private static final ThreadLocal datetimeFormatter = new ThreadLocal() {
      protected Object initialValue() {
         return new SimpleDateFormat(&quot;yyyyMMdd HHmm&quot;);
      }
   };
   public static String toDateTime(Date d) {
      SimpleDateFormat sdf = (SimpleDateFormat) datetimeFormatter.get();
      return sdf.format(d);
   }
}
</pre>
<p><strong>Watch out</strong><br />
Be careful, do not use thread-local variables as instance variables. Although it is not explicitly stated as such in the SDK API docs, they <a href="http://www.me.umn.edu/~shivane/blogs/cafefeed/2004/06/of-non-static-threadlocals-and-memory.html">will cause problems</a> when you don&#8217;t use them as static variables. Note that this is <a href="http://jroller.com/page/tackline/20050310#fixing_threadlocal">still an issue</a> in 1.5.</p>
<p>For you J2<strong>E</strong>E-addicted, these objects can also be held as instance variable in a SLSB (because they&#8217;re accessed by one thread at a time), but I tell you, there are still situations you don&#8217;t want to create a Enterprise Bean <img src='http://www.bloggingaboutjava.org/cms/wordpress2/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggingaboutjava.org/2005/12/threadlocal-is-your-friend/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
