Meera Subbarao has a Bachelors degree in Electronics and Communication Engineering and seventeen years of software programming experience around the globe, from Bangalore,India to Dubai,United Arab Emirates, to the United States. She has spent the past six years at DataSource, Inc. in Maryland and has been working on J2EE technologies exclusively for the last six years. She is a Sun Certified Java Programmer as well as a Sun Certified Web Component Developer. Meera is also the Team Leader for the Javalobby/dzone book review team.
| Author: | Chris Richardson |
|---|---|
| Publisher: | Manning Publications |
| PubDate: | January 2006 |
| Reviewer: | Meera Subbarao |
POJOs in Action describes how POJOs and lightweight frameworks such as Spring, Hibernate, JDO, iBatis make it easier and faster to develop testable and maintainable applications. You will also learn how to apply test-driven development and object design to enterprise Java applications. This book is all about implementing enterprise applications using design patterns and lightweight frameworks.
This book is for developers as well as architects who are experienced in developing enterprise applications in Java using EJB framework and want to know how to use POJOs and lightweight frameworks effectively.
This book consists of four parts. Part 1 which has 2 chapters is an overview of POJOs and lightweight frameworks. Part 2 has 5 chapters in which you will learn about a combination of options to design applications with POJOs and lightweight frameworks. In Part 3 you will learn about other approaches for designing the business and database tiers. Part 4's 3 chapter's looks at some important database-relates issues we normally encounter when developing enterprise Java applications. I should also mention that this book is not a complete reference for any of the frameworks like Spring, Hibernate, iBATIS etc.
Chapter 1 starts with a brief history of EJB. Next the author uses an example of transfer of money between two bank accounts, a typical EJB 2 application architecture scenario and shows many of the criticisms of the EJB Specification, discusses about the short comings of procedural design and why J2EE encourages developers to write procedural code and later explains how EJB 3 is a step in the right direction. The next few sections give an overview of how to use POJOs and lightweight frameworks to redesign the money transfer service and make it easier to develop, test and maintain.
Chapter 2 describes five design decisions for the business and persistence tiers, each decision having multiple options, and each option having its benefits and drawbacks. These decisions will play a critical role in helping you to decide between a POJO approach and a heavyweight EJB 2 approach. Throughout this chapter you will definitely see that the Author is a strong advocate of the object-oriented approach. In the last section the author gives an example (Food to Go application) of how a development team goes about making the five design decisions introduced earlier in the chapter. I read this chapter several times and have many post-it notes all over.
In chapter 3 you will see how to organize business logic as a domain model using test-driven approach and testing with mock objects. In this chapter, you will learn about Domain Model design pattern and how if fits into the application's architecture and its relationship with the presentation tier and the persistence framework. The chapter continues with the Domain model-based business logic for the Food to Go application. The author stresses the importance of refactoring your code, the benefits of using JUnit, and ways to simplify and speed up tests with mock objects.
Chapter 4 describes how to persist the domain model you created in the previous chapter using an object/relational mapping (ORM) framework. The author shows you how to map the classes and relationships of an object model to a database schema. You will get to know the key features of ORM frameworks and get an overview of the popular ORM frameworks, Hibernate and JDO. In the section about testing, the author makes a comparison between flossing and testing which made me giggle (page 132). As in all the chapters, the author describes various strategies for testing. At the end of the chapter, you will also see how to optimize the performance of an application that uses JDO and Hibernate.
Chapter 5 focuses on persisting a domain model with JDO 2.0, testing the JDO persistence layer, using Spring's JDO support classes and at the ned Tuning a JDO application. Since I am mainly a Hibernate user, I just went through this chapter.
Chapter 6 describes how to use Hibernate 3 to persist a domain model using the previously developed Food to Go domain model. The author describes in this chapter the power as well as the limitations of Hibernate. I agree with the author that if you need more information about Hibernate, Hibernate in Action is again the best book around.
Chapter 7 covers encapsulating the business logic with a POJO façade. You will see the benefits and drawbacks of using a POJO façade. You will also learn how to use Spring to manager transactions and persistence framework connections. Later sections show you how to design, implement, and test a POJO façade using the same FOOD to Go application.
Chapter 8 presents an alternate approach for the POJO façade and directly exposing the domain model to the presentation tier using the Exposed Domain Model pattern. To be honest I learned about this pattern in this book, and it is indeed very interesting. Don't miss the section with the benefits and drawbacks of this pattern.
As the author writes" I'm a great fan of using object-oriented design and ORM frameworks. But sometimes this approach doesn't make sense" I agree with the author 100%. I have used the Transaction script pattern several times in many projects which had complex SQL queries. In chapter 9 you will learn implementing the business logic using procedural design and accessing the database using iBATIS. I should also mention that I did learn how to use iBATIS from this chapter.
Until now, the book had focused on lightweight alternatives to EJB. EJB 3 being a whole lot improvement from EJB2, where session beans, entity beans, and message-driven beans are POJOs, deployment is more simpler are discussed in this chapter. Chapter 10 covers persisting a domain model with entity beans, implementing facades and integrating with Spring and EJB dependency using EJB 3.
Chapter 11 describes how to implement search screens that allows users to enter search criteria and page through the matching results. It also presents some main design issues: implementing a paging mechanism, dynamic paged queries using iBATIS, JDO and Hibernate. You will also learn when to use Hibernate and JDO native SQL queries.
Chapter 12 covers using optimistic locking and pessimistic locking solutions, handling three different concurrency mechanisms and how to use them in iBATIS, JDO and Hibernate and also how an application can recover from a database concurrency failure with Spring.
Chapter 13 the last chapter explains why you need to use the optimistic Offline Lock and Pessimistic Offline Lock patterns. As in all chapters, the author explains the benefits and drawbacks of each pattern, and explores these patterns in the context of iBATIS, JDO, and Hibernate.
| Relevance | |
|---|---|
| Readability | |
| Overall | |
Chris Richardson has done an outstanding job; this book deserves 5 out of 5. I wish I could have given more. Once I started reading the book, it was hard for me to put it down. This book teaches you when to use and when not to use each of the frameworks while many other books blindly advocate the use of their favorite frameworks. It is a must have book for every Java developer as well as architect. This is an excellent book, go get it; should be in your library.
1. http://www.manning.com/crichardson/