I have read 3 books, here is what I thought of them, briefly:
- Spring: A Developer's Notebook, by O'Reilly: I enjoyed reading that book, because it is well written and has a good structure. It explains what is dependency injection by doing it without Spring, with Spring. But for a more complete understanding, I would recommend Fowler article. There is an interesting chapter on Swing with Spring. Minor drawbacks is that it does not talk about Spring Timers and has very little on Remoting. But I would recommend that book.
- Spring In Action, by Manning: I was disappointed by that one, because there is not much more information than in O'Reilly, it is a bit less practical to use. While it is a bit more detailed than O'Reilly, I did not find the extra information very useful in general. Remoting is better covered here than in O'Reilly, but there is nothing on Swing.
- Professional Java Development With The Sring Frampework, by Wrox: I liked that one better than Manning, but again information inside is very similar. I find the explanations more complete. Inversion Of Control is well presented (it is even comparing constructor injection with method injection). It gives examples of alternatives to XML configuration. Remoting is covered in greater details than Manning. I would recommend it over Manning anytime, and if it included a Swing chapter, I would recommend it over O'Reilly as well.
Those books showed me Spring could be useful in some projects:
- if you want remoting.
- if you want to promote clean code, then you can promote the "Spring way". It is a good one.
- if you want to use JSF. Spring makes JSF easy and natural to use.
I am not convinced about Spring when it comes to:
- JDBC or database use: while Spring has a well done framework, Hibernate or iBatis have a very good API that makes Spring abstraction useless.
- MVC: it is does seem that much better than alternatives, nor much less intrusive (OK you can test it easily). Anyway I am not that big a fan of web MVC after having seen real world .NET projects without strict MVC well maintainable. I find the JSF backing beans at least as good and more flexible. Continuation frameworks are interesting too, but I am worried of their performance impact and scalability.
- Transactions: I just don't think manual transactions are that bad or ugly or less maintainable. But using Spring for them is not necessarily a bad idea either.
Categories: java, spring, book, review
Those books showed me Swing could be useful in some projects:
ReplyDeleteYou surely mean Spring not Swing. :)
>Spring does not seem to make use of >any JDK 1.5 new features.
ReplyDeleteSee the @Transactional annotation for demaracting transactions in source metadata. See the @ManagedResource annotation for describing JMX management metadata.
Spring supports 1.5 nicely, it just does it in away where it still runs on 1.3 because that is important to its customer base.
>JDBC or database use: while Spring >has a well done framework, Hibernate >or iBatis have a very good API that >makes Spring abstraction useless.
ReplyDeleteORM is not appropriate for all types of database access. iBatis does not allow execution of adhoc SQL.
Spring JDBC exists to make it easy to execute adhoc, one-liner SQL calls against a datasource in the context of a transaction.
That's a very valid need.
I updated the post about JDK 1.5 support. I will add a comparison with the good Spring Reference Book later.
ReplyDeleteAbout Spring JDBC, both Hibernate and iBatis allows you to write 1 line SQL calls against a datasource. You do need other lines for transaction demarcation, which I consider a good thing. And even that I suppose could be taken care of using the right annotations.
Sorry but I have to disagree with your comments that Spring is useless for database use, especially in the case of JDBC. For JDBC the only thing you really need to be concerned about is your SQL...Spring handles most of the other stuff for you which is good. Why should I write that stuff if its already being done by a well-tested framework?
ReplyDeleteIts very useful to use the Spring templates for Hibenate, IBATIS, etc. for the very same reasons. How can you argue about common exception handling regardless of the ORM tool you happen to be using? Or ease of transaction handling? I don't know why you'd want to write transaction handling code on your own if there is a well-written, well-tested, framework out there that already does it. Spend time on the stuff that matters...not the glue.
Jason