GeeCON Prague 2014*
The moose likes Other Application Frameworks and the fly likes Starting Seam over Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Starting Seam over Spring" Watch "Starting Seam over Spring" New topic
Author

Starting Seam over Spring

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Recently i started learning spring, just looking for help from ranchers in choosing below 2 options
i) Stop Spring time being, learn Seam and continue with spring.
ii) Finish the spring and start Seam.

Note : Am not interested in parallel learning in this case.

Guys, please mention the reason for your suggestion.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

This is highly depends on what you already know.
Familiar with JSF, JPA, EJB3, Hibernate? go with Seam
Familiar with JSF, JPA, Hibernate, MVC framework? go with Spring
Yes, both of them are sharing many things, so why not to learn them both?
Dan Allen
Author
Ranch Hand

Joined: Mar 05, 2003
Posts: 164
Before I state my response, I want to say that I am a huge fan of both Seam and Spring and before I learned Seam, I was heavily involved in Spring. They are both great pieces of engineering and you simply cannot replace one or the other in a weekend.

Now, on to my response.

One of the things I don't like about Spring, especially for new developers learning it, is that it you don't learn anything about the underlying technologies. It tries to baby you so much that in the end, you couldn't tell an interviewer what the heck you were using. All you can say is that you have this magic bit of XML and somehow it all works. You also use the Hibernate Session or JPA EntityManager completely wrong.

Seam on the other hand connects you with the technologies. It doesn't hide them under a blanket of XML. You inject the Hibernate Session or JPA EntityManager directly into your class and are prodded to interact with it, learn it, get to know it. Seam also makes you starkly aware of context and the life cycle of your objects. In Spring, you just stuff everything in application scope and forget about the creation of objects. In Seam, objects come and go as you need them, sticking around for a whole use case if the need arises.

Is Seam easier then Spring? No. Is Spring easier than Seam? No. Why would I say that? Because both are integration frameworks and there are a lot of intricacies to learn about both.

Will you love Seam more? Hey, I'm done with Spring at this point unless I need it. Many readers of Seam in Action are too. You will quickly realize that Seam is a lot more human and has a lot more power. But that is me being a bit biased.


Dan Allen | http://mojavelinux.com | Author of Seam in Action - http://mojavelinux.com/seaminaction
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

I think Spring 2.5 employs annotations for DI, no more XML...
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 467
I think Spring 2.5 employs annotations for DI, no more XML

Yes, This is true

I don't like about Spring, especially for new developers learning it, is that it you don't learn anything about the underlying technologies. It tries to baby you so much that in the end, you couldn't tell an interviewer what the heck you were using.


I don't know whether I should agree or disagree with you here. One of the main objectives of spring is making the developer focus more on the business logic, and not on the normal repetitive pieces of code. When I need to execute a query on a database using JDBC, I have to open a connection, create a Statement/Prepared Statement, create Result Set, execute the query, close Result Set, close Statement and close Connection. With Spring's JDBCTemplate, I just execute the query and get it in a Result Set. Same with hibernate; you don't have to handle sessions and transactions yourself. This reduces your code-base a lot, and make your code more readable, maintainable and business centric.

On the other hand, if the developers and really that experienced, I'll have to agree with you that they'll be working on stuff without understanding the underlying technologies.


Visit my blog: http://jnassef.blogspot.com/
Dan Allen
Author
Ranch Hand

Joined: Mar 05, 2003
Posts: 164
I think Spring 2.5 employs annotations for DI, no more XML


I'm sorry to say, but the annotation support in Spring is a hack. Okay, that's being a little harsh and unreasonable. But it really wasn't done right, not like Guice, Web Beans, or even Seam. They try to use the Java EE annotations outside of a Java EE environment which makes absolutely no sense because that just further confuses developers about what those annotations are for. Plus, Spring uses static injection, which completely breaks the purpose of these annotations, which is to inject thread-bound resources.

In Seam, all injections are dynamic, which means they happen on each method call. So Spring cannot escape it's legacy, even with annotations. And frankly, autowiring is just wrong. Give that to any newbie developer and that person will be lost for days.

Don't get me wrong, I still like Spring. But now you have to mentally cut out some features of Spring because they are outdated.
Dan Allen
Author
Ranch Hand

Joined: Mar 05, 2003
Posts: 164
I don't know whether I should agree or disagree with you here. One of the main objectives of spring is making the developer focus more on the business logic, and not on the normal repetitive pieces of code. When I need to execute a query on a database using JDBC, I have to open a connection, create a Statement/Prepared Statement, create Result Set, execute the query, close Result Set, close Statement and close Connection. With Spring's JDBCTemplate, I just execute the query and get it in a Result Set. Same with hibernate; you don't have to handle sessions and transactions yourself. This reduces your code-base a lot, and make your code more readable, maintainable and business centric.


Yes, I agree with you here. Even Seam achieves this "low-level hiding", so I'm not against it. I guess where the problem comes in is that all you get in Spring is a method that says "here, write stuff in here and everything else is taken care of" but then makes it really difficult to override that stuff that is taken care of. I guess where it gets out of control is with the AOP crap wiring transactions around things and you never really learn what you are doing in that regard. You just copy-paste some magic AOP XML defintion from some website and pray it all works. Forbidden it is that you touch a resource like a transaction or persistence manager.

On top of all this, JpaTemplate and HibernateTemplate treat the persistence context entirely wrong. I this problem in chapter 9.

Again, there is great stuff in Spring, from the API level. It's just that it tries to treat you too much like a novice programmer at times. Sometimes, that is good. Sometimes, it's not good.
 
GeeCON Prague 2014
 
subject: Starting Seam over Spring