Book Review – Beginning POJOs – From Novice To Professional – by Brian Sam-Bodden published by Apress

22 May, 2006 (18:22) | General | By: Thomas

Begpojos

 

In all the hype surrounding Web 2.0 , AJAX and all the other front end changes that have been picked up by the general web developing populace it is easy to overlook some of the changes that have happened in the middle tier and back-end. Changes like the increasing prevalence of light-weight frameworks and ideas such as POJO’s. What in the world is a POJO you ask? The following comes straight from WikiPedia and really hits the nail on the head: “…POJO is an acronym for Plain Old Java Object, and is favored by advocates of the idea that the simpler the design, the better. The name is used to emphasize that the object in question is not somehow special but an ordinary Java Object, in particular not an EJB (before EJB 3, that is). “

Programmers interested in POJO’s want to avoid all the complexity of Enterprise Session Beans in favor of much simpler designs that work in concert with lightweight frameworks such as Hibernate and Spring. Is it a prerequisite to include these frameworks? No! Not at all. It just happens that many people feel the potential of increased productivity is worth it.

It should be noted that I have been working on a web application framework in .NET that borrows heavily from some of the ideas presented in this book, which means that Brian Sam-Bodden is in my mind something of a kindred spirit. I’m pre-disposed to like his subject matter. Unlike the architecture laid out by Brian, my work has taken a different turn. Largely due to the invaluable insight of my good friend Dan, we have forsaken the usage of external mapping devices such as Hibernat or in our case NHibernate and have again thanks to Dan’s creativity the benefits of a very lightweight MVC action framework. Something thats unheard of in the .NET world. In our case, objects are called POCOs – plain old CLR objects – and similar to POJOS contain very little intelligence in and of themselves. Business rules and intelligence has been relegated to Interfaces and Services similar to the Dependency of Injection discussed in this book.

“Beginning POJO’s” was a complete pleasure to read. It teaches a way of Java based development that is very much up to date and cutting edge. From Hibernate to JBoss, Spring and Tapestry many of the current thinking in Java web development is represented. Brian Sam-Bodden is at the top of his game. Rarely have I seen a better discussion of a “beginning” topic category. Brian walks the reader through the process of using POJOs from step 1 – setting up Eclipse – all the way to the finished product. Of course, this being a beginning level book, there are plenty of topics that can stand further discussions but somehow Brian manages to cover just the right amount of detail for my taste. And to show you that even an experienced programmer can learn something from a beginners book here is what Brian had to say about composite primary keys in database tables:

“.. When choosing a primary key for a table, especially if you know that the table will be used in an object-oriented system by an ORM tool, use surrogate primary keys whenever possible. Surrogate keys are small, simple keys that have no business meaning are normally not updated or even seen by users, They provide an audit trail, result in small indices, make joins easier to write and faster to execute and are more resilient to business changes (because they have no business meaning) ….”

YES ! THAT’S THE STUFF.

I suppose if you ever had to wrestle with a system that uses composite pk’s you might be cheering at reading a statement like that yourself. In the present day environment of automation, ORM tools and various productivity frameworks you cannot expect the same results with composite PK’s and trust me I am the first to have argued against automatically increasing integer fields when they were introduced in MS Access (before SQL Server had them!!!). But in this day and age surrogate keys are very necessary.

Anyway, I could go on and on about “Beginning POJO’s” but I won’t. This book has earned my praise and recommendation. Go check it out and see if you like it as well. Trust me the basic principles discussed can apply to .NET development. You know LINQ is coming right? Have you ever compared LINQ to Hibernate. Very similar! External mapping files used to describe ORM mappings. So check it out.

And Brian …. good job  you really know your stuff!

 

Comments

Comment from Brian Sam-Bodden
Time August 8, 2006 at 9:43 am

Thanks for the kind review. I’m glad to hear that the book is coming across as it was intended. Would you mind posting your review to Amazon?

Regards,
Brian

Write a comment

You need to login to post comments!