March 2006 Archives

Bill Siggelkow

AddThis Social Bookmark Button

I was recently given the unenviable task of providing my manager with a spreadsheet listing all the code artificacts (.java files, xml files, JSPs, etc.) that my team was working on. The list should include, among other things, all the source files under my src directory, JSPs under the web directory, and XML configuration files under web/WEB-INF. But it should exclude things like generated source code, .class files, and jar files.

My desktop at the client site runs Windows, so I thought I would try out the dir command. That got me nowhere. Then I jumped into cygwin and tried ls -R. Of course, this listed everything under my project directory, including the CVS directories and their contents. Plus, the file listing didn’t specify the full path. If I was going to use this output to create my spreadsheet it would take quite a lot of cutting, pasting, and deleting to make it suitable for the spreadsheet — there had to be a better way.

Steve Anglin

AddThis Social Bookmark Button

Here is my coverage of TheServerSide Java Symposium, held in Las Vegas, NV from Mar 23 thru Mar 25:

Thu Mar 23 Sessions Attended

Advanced Testing Techniques with TestNG: TestNG is a recent open source lightweight testing framework built on annotations that offers advanced testing functionalities such as test groups, method parameters, dependent methods and time-outs. This presentation offered a short introduction to TestNG as well as examined some testing scenarios typically encountered by programmers in various software areas and how TestNG does seemingly help create elegant and simple testing designs and serves as a viable testing alternative to unit testing.

RAD That Ain’t Bad: Domain Driven Development with Trails: The open source lightweight Trails framework aims to take a new approach to Rapid Application Development in Java using proven frameworks like Spring, Tapestry, and Hibernate. By eliminating redundant steps in the development process and stressing convention over configuration, Trails can greatly accelerate development of RDBMS persistent web applications. In this session, the speaker gave a real Trails application in a few minutes, and then dived into the details of how Trails works. While Trails seems quite powerful, it’s still nascent as it relies only on heavy integration and use of Tapestry along with Spring. You can’t use other Web frameworks like Spring MVC, Struts, etc. If you’re already using Spring, I think Trails becomes superfluous, imo. While configuration with Spring may take longer initially, it should be smooth sailing with Spring, which also caters naturally to Domain Driven Development anyway. Trails currently is an extra layer, but long-term may be different. We’ll see. Trails is an open source project on Java.net.

Spring Update: What’s New and Cool in Spring 2: Spring 2 is a major release that makes the open source lightweight Spring Framework both more powerful and easier to use. In this presentation, Rod Johnson surveyed the new features of Spring 2, before focusing on two of the most important: the introduction of extensible XML configuration, and significant enhancements to Spring AOP. Spring 2 allows Spring configuration to be enhanced with custom XML tags, which can provide valuable abstraction for repeated or complex configuration tasks. Rod showed how to define new tags, and how this capability would benefit all Spring users. Spring 2 makes Spring AOP both simpler and far more powerful, and marks a major milestone for AOP in general. In conjunction with AspectJ 5, Spring 2 provides a complete roadmap for AOP usage, from dynamic proxies up to full use of AspectJ weaving, using the same programming model. It becomes possible to use the powerful AspectJ pointcut expression language in Spring AOP, as in AspectJ. Spring AOP can even run AspectJ annotation-style aspects within its proxy based runtime, with the same low cost of adoption as Spring AOP. For more, visit SpringFramework.org.

Fri Mar 24 Sessions Attended

Introduction to JBoss Seam: JBoss’ Gavin King talks about EJB 3 and JSF as they are perhaps the most exciting new developments in the Java EE 5 platform. Seam is an innovative new open source lightweight enterprise Java EE 5 application framework that integrates the EJB 3.0 component model with JSF as a presentation tier. Seam builds upon the standard extension points provided by both specifications and provides a set of Java Annotations that extends the standard annotations defined by the EJB specification. In addition, Seam introduces several innovative new ideas: managed conversations, declarative and contextual application state management, bijection - a generalization of the notion of inversion of control and integrated business process management. As King illustrated, JBoss Seam seemingly tackles all these problems, and provides a uniform model for stateful components in Java EE 5. For more, check out JBoss.org.

Apache Geronimo Prime-time: the open source, and now becoming lightweight, Apache Geronimo is the latest open source application server to achieve J2EE 1.4 certification, making it ready for prime time in the Enterprise. It is now a real contender in the open source application server market and offers a unique architecture making different open-source projects pluggable and capable of building customized stacks. This session by author Jeff Genender presented an overview of Apache Geronimo, its architecture, its major open source components, how it works, and how to configure and use the application server. This covered Geronimo’s different concepts such as the kernel, GBeans, deployment and different configurations, and running the application server. Apache Geronimo 2 is also in the early works, which will allow Java EE 5 deployment once Geronimo is Java EE 5 certified. Lastly, Apache Geronimo is IoC compliant, and can currently deploy Spring-based developed applications. For more, go to the Geronimo.Apache.org site.

Sat Mar 25 Keynote and Sessions Attended

Keynote Panel: Enterprise Java Trends with Rod Johnson, Bruce Tate, Floyd Marinescu, and more…

“The Web-tier is broken… In 3 years, (Java-based) Web frameworks will be obsolete.” — Rod Johnson
“Java is in trouble on the low end.” — Bruce Tate

These quotes were an admission that Java is not best for all things. It’s best for the core domain model, but in terms of the Web-tier, Java just does not offer enough of a lightweight solution or flexibility as PHP and Ruby (on Rails) offers, currently. That’s why we are starting to see Spring lead the way with integration offerings to Java-based scripting languages. The need for Java-based scripting is clearly growing in demand according to the keynote panel. Rod represented the moderate view. Bruce Tate tood the more extreme view that Java is just not right at all now and that’s why Java developers should move to Ruby on Rails. And Floyd Marinescu represented the other side and most likely the JBoss view that Java isn’t broken in the Web-tier as much as Rod and Bruce may make of it.

And the sessions started up again with Persistence with iBATIS - Hands On: In this session, iBATIS lead Clinton Begin actually used only a Java IDE and real-world examples to demonstrate how iBATIS is used to create an effective persistence layer for your application. There were no code snippets here, the persistence layer was seemingly coded and tested from scratch. Seemingly, iBATIS is easy to learn and use. It’s one to watch, but Hibernate is still the leading adopted persistence framework, followed by the big potential that the Java Persistence API (JPA) in EJB 3 offers. However, Spring does use and integrate iBATIS along with Hibernate.

Building Quality Applications with Ajax Frameworks: According to Dion Almaer and Justin Gehtland, Ajax techniques can lend tremendous richness to your Web UIs. But Ajax can be tedious and difficult to implement from scratch. Fortunately, there are a number of powerful frameworks that can make it much easier to do Ajax, including some that integrate with Java-based Web frameworks. This session demonstrated (through live coding): The popular Prototype, Dojo, MochiKit, DWR and Scriptaculous Ajax frameworks, each of which offers unique abilities to enhance your applications. These frameworks can be used with any server-side framework and their use with Struts and JavaServer Faces applications. This talk also discussed the state of Ajax support for JavaServer Faces via third-party JSF components and JSF-specific frameworks. Lastly, they showed how to easily add amazing Ajax effects to Java-based Web application.

Java Persistence API: One of the key results of the work on EJB 3.0 has been the introduction of a new, standard API for Java persistence and object/relational mapping. This work initially began as part of the EJB 3.0 and, in response to the urging of the Java community, has been expanded to include use in Java SE environments (”outside the Java EE container”). The talk covered key aspects of the Java Persistence API, including use of the EntityManager API, persistence units and persistence contexts, object/relational mapping using Java metadata annotations, extensions to EJB QL, and use of Java Persistence in Java SE environments. Also, from the show in general, we learned that an open source JPA effort, OpenJPA, is perhaps being accepted as a proposal into the Apache Software Foundation, and will go into the Apache incubator. IBM, Spring, BEA and others are apparently planning on backing this open source effort.

And I ended the show by perusing XQuery for Java Geeks by Jason Hunter and Bruce Tate’s Beyond Java session, which focused more or less on Ruby on Rails. All in all, it was a good show. If you missed it, you have another chance as TSS Java Symposium goes overseas to Barcelona, Spain. For more, visit TheServerSide.com and/or TechTarget.com.

Tim O

AddThis Social Bookmark Button

Most programmers develop in cycles. Code, Compile, Test, Repeat. Depending on your process, you might add stages like Test, Code, Compile, Document, Deploy, Verify, Commit, but, as a rule of thumb, the programs of highest quality are usually those that are not a chore to develop. The ability to execute code immediately creates an efficient feedback mechanism that increases quality. If your cycle is quick, you’ll be able to debug and correct bugs faster than if you are constantly having to wait minutes to see if your current set of changes works. A long development cycle is similar to the experience one has trying to use a command line editor over a 300 baud modem - the time lag between typing and reading what you’ve typed causes speed and quality issues.

Ruby, Perl, Python…scripting languages are technologies with very quick development cycles. In a scripting language, you can make a change to your code and run it immediately. Compiled languages such as C, C#, and Java have slightly slower development cycles because they require compilation, but if you make the right choices you can attain a quick development cycle in Java. For example, the Sysdeo Tomcat plugin uses a custom classloader that allows you to modify your servlet code on the fly without having to restart your servlet container, and there are various approaches to speeding up Java development cycles using swappable ClassLoaders and the like. But, don’t let anyone tell you that a speedy development cycle is impossible with Java, it is possible, but usually not the norm.

There are times when one bad product selection or one misconfigured framework can ruin everything by introducing a huge span of dead time into your development cycle. Read more for a discussion of Development Cycle “Dead Time”, and how it can affect your approach to development.

Robert Cooper

AddThis Social Bookmark Button

I kind of want to do something different today. When I write I tend to write, in cliche blog form, in two modes: “Hey, look at this!” or “I’m going to be snarky and rant about this!” Today, I would kind of like to have a narrow conversation.

The advent of the invokedynamic JSR, as well as the continuing RoR vs whatever hype and framework proliferation in Java has brought a question to the forefront: where is Java going? I have some ideas that I would like to express. This isn’t necessarily a highly structured treatise, but more of a braindump.

However, I would like to hear what other people would like to see. I don’t mean this as an exploration of other programming models or an academic conversation in language design. Rather I would like people to look at (a) what tools are they using all the time that should just be there, and (b) what would really make your day to day life better, both of these taken in terms of the JSE — lets leave the web framework wars out of this for a little while.

Bill Siggelkow

AddThis Social Bookmark Button

I love programming. But I have reached the point in my life where the demands on my time, from my day job as a team lead to my night job as a team Dad, reduce my discretionary programming time to little snippets that I can seem to just grasp for 5 or 10 minutes here or there.

I have always loved research, too. And I have recently spent some quality time with two software tools that I enjoy — Maven2 and StatCVS.

If you like what Ant can do, than Maven can take you to another level. Granted is not without its own set of challenges, but I have come to believe that its benefits outweigh the costs. With Maven I frequently find myself saying “Wow! I didn’t know it could do that!”.

Dejan Bosanac

AddThis Social Bookmark Button

I tend to use XML-RPC to implement simple requirements for connecting applications. The reason is that it is a simple, straighforward remote-procedure protocol that has good-enough performance for most of such applications. Also, it is very wide-spread so you can find a stable implementation for whatever platform you need it (for example you can use it to connect Java and PHP applications).

When it comes to Java, I use the Apache XML-RPC library (http://ws.apache.org/xmlrpc/). Reasons: it’s been long time in development, it’s stable and I never had any problems with it.

Now, most of the applications that I write lately are based on the Spring framework, so obviously I needed an adapter (bean factory) for the Apache XML-RPC server. Since I haven’t found one, I had to write it by myself.

Robert Cooper

AddThis Social Bookmark Button

I have been kind of lax in posting some of these things, but there are some moderately interesting whippings of the dead horse this week.

Gosling had a sitdown with JDJ where he discussed the nature of Ruby and PHP. That, of course, smells of nerd holy war. Assaf takes him to task on his characterization of Ruby and PHP as single-purpose languages, Hansson says that versatility is overrated anyway, Artima dubs the whole thing moot but has a good discussion.

Also at Artima, a paper that explains that code generation is back, and it’s baaaad. It is a well written paper, but this kind of goes to the Model Driven Dev model which I have espoused for a while. I know code generation still gets a bit of a bad rap. HOWEVER, the author does miss that Hibernate, in fact, IS a code generator. It works by generating subclasses of your pojos to handle the mapping. What it does lack, however, is that first step as well as a more reasonable “convention over configuration” attitude.

The Great Web Framework Survey continues with RIFE. I have glanced at RIFE in the past, and it seems like a good system. It is very much a RAILS system with more of what I would call a “Java Flavor” — it is done like you do things in Java rather than trying to copy something else. I REALLY don’t like the fact that it has its own Velocity-style templating system. Why can’t use JSP/JSTL and some custom taglibs still escapes me. Of course, why JSP doesn’t have something equiv to RIFE’s ${v WEBAPP:ROOTURL/} is beyond me too :P.

(SP corrected. Thanks!)

Tim O

AddThis Social Bookmark Button

In the course of trying to make sense of the Maven repository, I threw together a quick application to search for Maven artifacts. It’s nothing special at the moment, but at least it is a start. MVN Registry currently allows you to search for artifacts. Type in “struts” or “weblogic”, and the search interface will retrieve every artifact that has a matching substring. The interface than links directly to the ibiblio.org m2 repository.

Enter at your own rish, http://www.mavenregistry.com is an alpha.

Steve Anglin

AddThis Social Bookmark Button

The forthcoming, 4th Annual TheServerSide Java Symposium will be held from March 23 to March 25, 2006 at Caesars Palace in Las Vegas, NV USA.

If you look at the conference schedule here, it is dedicated to the most important and emerging open source enterprise Java technologies as well as methodologies out there.

I certainly plan on attending. See you there.

Dejan Bosanac

AddThis Social Bookmark Button

This is the issue that I keep running into on various projects, so even if it seems obvious I think it is worth spending a post on it.

Some OR mapping frameworks tend to use batch update operations when dealing with the database. The “problem” that this approach introduces is that if any problem occurs during the update, a java.sql.BatchUpdateException exception will be thrown instead of the regular java.sql.SQLException. If we don’t handle BatchUpdateException properly the message it will give us will not be very useful.

Tim O

AddThis Social Bookmark Button

The Word of the Day today from Dictionary.com is “Contradistinction”. It means “Distinction by contrast”. Sample sentence: “Maven provides a comprehensive approach to software projects. It provides a declarative model that decouples build logic from a specific project. Maven encourages universal reuse of build logic across all projects — in contradistinction to Ant, which tends to be used as toolbox for scripting builds.

Tim O

AddThis Social Bookmark Button

Today on OnJava, there are two articles. The first, by OnJava’s Editor, Chris Adamson, is a good article - “What is Java?”. Basic, to the point, meeting a need that continues to exist as people continue to adopt Java. Contrary to what you might have been led to believe by recent high-profile blog posts. People continue to adopt Java for new systems, and there is a need to continually refresh introductory material.

The second article is innapropriate and misleading. It is titled “Storing an XML Document in Apache Xindice” by Deepak Vohra. Every once in a whlie, an article slips thorugh the “Radar”, and you’ll see an article that just doesn’t cut it. To publish a article about Xindice at this point is criminal negligence, it is like publishing an article about Apache JServ in 2006 and calling it new. Once upon a time, “Xindice” was considered “new” and “promising”, now the only appropriate term is “dead”. Want more convincing? Read more in this entry.

Technorati Tags: , , ,

Paul Browne

AddThis Social Bookmark Button

Related link: http://www.firstpartners.net/blog/location/dublin/2006/03/04/how-to-talk-about-a…

We’re giving a talk about ‘how to talk to your boss about agile‘ for the Irish .Net Developers Association next Tuesday in Buswells hotel Dublin.

More details (including the slides themselves, and a preview of what you are missing) are available on this blog post. The blog post also explains how 4 pictures of bridges can explain the difference between Ad-Hoc , Predictive, Agile and XP projects. No , really , you do want to check this out.

If you have any comments about what .Net developers could learn about agile from the Java community, please leave them here.

If you have any comments about what .Net developers could learn about agile from the Java community, please leave them here.

Tim O

AddThis Social Bookmark Button

Related link: http://maven.apache.org

Note: Remember I like Maven. I recommend Maven, now read the following harsh criticism….

Maven is touted as the project management tool to end all project manangement tools. I wrote as much in the Preface of Maven: A Developer’s Notebook, and while I think that Maven offers some great tools in the way of project builds and dependency management, the continued lack of project documentation is a constant obstacle to adoption. Take, for example, the problem that confronted me this last week. I was trying to customize the site that Maven generates because I was frustrated with the cookie-cutter text and boring Maven stylesheet. I had assumed that customizing a Maven Project Info report would be straightforward, but on my way to a solution I found a great gap in communication and documentation…I’ve decided that the best medicine for Maven is overly harsh criticism. :-) Read on…

All your base are belong to Maven?

Paul Browne

AddThis Social Bookmark Button

Related link: http://www.firstpartners.net/blog/technology/2006/03/01/web-20-and-enterprise-ja…

A while back I wrote an article for an O’Reilly sister site, Java.net , on Sprinkle Some Ajax Magic into your Struts Web Application. I’m going to repeat one thing I said in this article: while coding Ajax is cool, you really want to use a framework if you have the choice. If you don’t believe me , check out some of the podcasts on Ajaxian.com. When you listen to the problems that the Ajax frameworks have overcome (What if the ActiveX XmlHttpRequest Object is turned off? What if you want to do local storage? What if the user hits the back button?), you’ll be a convert to the ‘Frameworks are better’ approach. So which Ajax enabled framework should you use as an Enterprise Java developer?

Pre Ajax, the answer to ‘which Java presentation framework should I use?’ would have been Apache Struts. Not because it was technically better than any of the other frameworks (although feel free to leave your comment!) but because everybody else is using it. This meant
(a) using Struts is good for your client, as they can replace you if you get run over by a bus and
(b) using Struts is good for you, as you can take your Struts skills to your next piece of work.

However , in this strange new Ajax and Web 2.0 world, things are beginning to change. Javascript gone from ‘has been kiddie scripting language’ to ‘coolest thing on the planet’. User expectations about what Enterprise Web applications can are going through the roof as Web 2.0 enters the mainstream. What Java framework are you going to use to deliver these expectations?

With this in mind, I did some research on the Ajax Enabled Java frameworks that are currently (Feb 06) available. I tried to pick out the best ones (best for your career, and hopefully technically best) based on the following criteria:

  • Java - Web development frameworks with Ajax capability.
  • Rating based on technical capabilites, and which is most likely to be the ‘next Struts’ (i.e. become the defacto standard for Java-Web Development).
  • Rating is based partly on downloading and running the projects and partly on evaluation of what the websites / other people say.
  • Products must be available (at least partly) in open source form with a recognised open source licence - as these are most likely to get community traction.

Before we get into the list, there a couple of items that you may think are missing:

  • Whatever you may think of non-Java frameworks (e.g. Ruby on Rails, PHP with Ajax), these are not included here. The notion of Java being replaced by Language / Framework ‘X’ is an entirely different article.
  • The list also does not include several excellent ’server neutral’ frameworks such as BackBase, Dojo, Prototype, or JSON. While these frameworks are included with some of the toolsets listed below, we’re aiming to get an ‘out of the box’ toolkit for the Web tier of Enterprise Java applications.
  • You’ll also probably note that there are 3 implementations of the Java Server Faces (JSF) standard on this list - MyFaces , Ajax JSF and Struts (Shale).

Think I got the evaluation wrong? Leave your comments at the bottom of this post.

Ajax Java Web Presentation Frameworks

AjaxAnywhere Independent of Java framework (e.g. Struts, JSF or Spring). Closest in approach to Java.net Struts-Ajax Article. Good interim solution based on existing frameworks, but can’t see this being the main framework long term.
Apache Myfaces Apache implementation of JSF, including technology donated by Oracle from ADF / Oracle Fusion. Being Apache, will become one of the main JSF implementations in use. But is JSF the best way of doing your website?
App Fuse combines a lot of the leading frameworks (Struts, Dwr, Spring with JSF as an option) into one easy to use package. Already a very good ready to go package (for web , mid and business tiers) and the Appfuse team have a good track record in integrating the latest, most widely used frameworks.
Ajax JSF Ajax implementation of the Java Server Faces Specification. Good indication of what a full JSF Ajax implemention would be like, but implemented by only one brave developer!
Echo 2 Evolution of original Echo Framework, can run in any Servlet container. Original has cult following, but doubt if it will become the number 1 web framework.
DWR - Direct Web Remoting Acts as a proxy so that you can call Java Objects transparently from Javascript. Good solution, seems to have traction, even though it still forces you to write Javascript and keep objects in Synch with Java. Several other frameworks (e.g. Appfuse and Webwork (soon to be in Struts) integrate this.
JSP Controls Aims to be drop in (Ajax enabled) replacement for JSP Tags. Can be used both with simple JSP and other frameworks, but at the time of writing has less than 1000 downloads
JWIC Dynamically add Ajax to Java class based application - similar to Velocity concepts. A good simple framework, based on POJO’s but doesn’t (yet) seem to have much traction on sourceforge.
Struts The original, and to many, still the best. Many changes are afoot in the next version, including the integation with WebWork (which already has Ajax capabilities) and the move to the JSF compatible (’Shale’) Struts aims to be backwards compatible, and the forthcoming JSF and Ajax capabilities look good. Pity there is no ‘offical’ milestone release yet.
Struts Layout Struts Tags, but with Ajax capabilities. Another good interim solution based on Struts, but is the Struts Event model suited for the Ajax world? (e.g. multiple events being raised from the ajax web page, instead of just the one (GET or POST) in the standard HTML model)
Swato Integration with Java Servlets through use of Servlet filters.Not a lot of documentation, nor a demo to encourage me to invest more time in it.
Tacos aimed at providing Ajax for Tapestry
Tapestry is technically a good framework, just didn’t seem to get the traction Struts did. Not sure if adding Ajax is going to change that.
Webwork Will integrate with next version of Struts (as Model - called the ’struts action framework’). Strong contender, gives Ajax functionality through (integrated) DWR and Dojo.
WidgetDev Hybrid (Open-source/ commercial) Framework. (In my opinion) Not enough maturity / features to justify open source version with reduced features
zk8 XUL / XAML type framework , capable of being rendered in either Swing or HTMLGood Framework, might attract people who are familiar with extending Firefox using XUL, but can’t see XUL (no matter who much I think it is a good idea) being mainstream without a visual designer.

Conclusion
The New Struts is …. Struts. Some other framework may overtake Struts to become the new standard, but I would recommend the following Struts-related frameworks based on the following scenarios

Scenario 1: Adding Ajax to existing Struts Applications. Use AjaxAnywhere - closest to the approach taken in the article Sprinkle Some Ajax Magic into your Struts Web Application. Despite writing this article , I see the frameworks evolving rapidly to the point where you would only take such an approach for adding Ajax to ‘Legacy’ applications.

Scenario 2: Need Ajax Now for a new Java Application. Use Appfuse as it gives Struts, Ajax (with DWR) and the possiblity of JSF integration now, all ‘out of the box’. This fits in well with …

Scenario 3: Medium Term. Use an implementation of JSF (either MyFaces or whatever Appfuse promotes - probably Struts Shale). Struts Shale (JSF) has so far released only ‘overnight’ builds. Apache MyFaces (JSF) tool support and Ajax capabilities are likely to improve over time. Both Struts-Shale and MyFaces are likely to play well with AppFuse , making it a safe bet for investing your time checking it out.

Think I got the evaluation wrong? Leave your comments at the bottom of this post.

Advertisement