Tuesday, June 20, 2006


Last week marked the 1.0 release of JBoss Seam. This is the latest project from Hibernate founder Gavin King, and so I've been watching it closely over the past couple of months. I downloaded the 1.0 release and built its samples. None of them worked! This was very surprising. I went through the JBoss forums, and found the problem. Even though Seam 1.0 is GA, the version of JBoss that it needs is not. Luckily King posted a link to the beta installer. Once I used this version of the installer, the samples worked fine.

So what is Seam? I think the introduction given by King and other JBoss types is somewhat obtuse. They talk about a lot of different things that Seam involves, all tied around Annotated Pojo-components. Instead of talking about the cool things you can do with Seam, they should really talk about how easy it is to do some of these cool things. That's where its strength lies. Anything you can do with Seam you can do without Seam. It's that Seam makes some things easier.

Take a classic catalog example. You have a catalog of items. Each item has some info on it, name, price, description. You have two web pages, one for showing the list of items, one for adding a new item. With Seam, you would create two classes. One class for modeling the item and one class for providing an item service used by both pages.

For example, to get your catalog page to retrieve the catalog from the database, you would have some method like findItems() and would annotate it with @Factory("catalog") where "catalog" is some logical name for your list of items. Then you just tell your catalog page to use the "catalog" object (#{catalog} using JSF expression language) and Seam would automatically execute your findItems() method, which could initialize your "catalog" object using a query. 

Similarly you could have a saveNewItem() method ony our service, and then in your edit item page you have a button whose action is "itemService.saveNewItem" where "itemService" is just a logical name for your item service.

This is a really simple example, but that's the point. You can do really simple things, really easily. That may seem like a silly statement, but if you've ever tried to write a Struts app that used a Stateless Session EJB and an Entity EJB ... well then you might have moved on to PHP or Ruby on Rails. Well that's essentially what's going on in the example given above. Ok, so JSF and Struts are not really equivalent, but you get the point.

My biggest sore spot with Seam has always been its use of JSF. I'm not a big fan of JSF. I know it was intended to allow for easier WYSIWYG development, but that's of little solace to me. However, its component lifecycle makes it work well with EJB3 and that's how you get Seam.

As for all of Seam's many other features... the new AJAX support sounds promising. I haven't tried it out yet. Sounds very similar to DWR, in that operations on your Seam components (like the item service mentioned above) are exposed via JavaScript. It uses a remoting servlet for processing AJAX requests (maybe they really are using DWR.) One amusing thing I found was that the JS libraries come from the servlet. The developer has to do a lot of the AJAX themselves -- triggering a JS call on some event, handling that event to make a remote call, processing the result of the remote call by updating the page DOM. Seam, like DWR, just makes it easy to make the remote call and get the results back. Seems like with the integrated component model, better AJAX support should be possible.


Dylan Eales said...

Sample Assignment provides an all-year long Assignment provider. While providing the academic aid, we foresee ourselves to be known as the chosen one academic consultants like Nursing, IT, Law, Marketing, Economics, Accounting, Statistics, etc. are some of the subjects to name that we cater to the Australian students in. We were recently recognised as the most reliable and dependable assignment service, and also voted as the Numero Uno assignment provider for the past two years. The Online essay Typer have been using their past experience and knowledge in order to supply the students with HD grade assignments including dissertations, essays, thesis, reports, journals, reflections, case study analysis, etc. There are many companies in the industry which functioning at skyrocketed prices. Be it accounting assignment help, marketing or management assignment help, computer science assignment help, taxation assignment help; we proffer our expert guidance in all of the assignments.

Maria Garcia said...

All the students who are looking for a case study assignment help, please pay attention. My Assignment Services is a destination that thousands of students turn to when they are in need of an expert consultation. The team of experts delivering assignment help to the students are either master’s degree holders of have PhD doctorate. Therefore, every assignment that we have ever written is of supreme quality and international standard for global competition. Students who are searching for companies with “who can do my assignment for me, My Assignment Services is your destination. We have an expertise when it comes to writing original and unique answers and deliver the work under strict deadline on time. The assignment help melbourne with us is a service prepared keeping in mind the needs of the students. An affordable assignment provider from best experts is now available!