Home  TER Volume 14, Number 2: Richardson
Technology Electronic Reviews Volume 14, Number 2, December 2007
~ Return to more reviews in this issue
REVIEW OF: Chris Richardson. (2006). POJOs in action: Developing enterprise applications with lightweight frameworks. Greenwich: Manning Publications Co. (ISBN-13: 978-1932394580). 456 pp. $44.95. Reviewed by Jim Blansett.
POJOs in Action was written to teach Java developers simpler and faster ways to write enterprise Java applications. The author, Chris Richardson, is a developer, architect, and mentor, with over 20 years of experience. Although POJOs in Action is for the seasoned developer, it is still a practical guide that offers specific design alternatives illustrated through numerous code examples.
POJOs (Plain Old Java Objects) provide alternatives to traditional Enterprise Java development. Richardson readily points out, in what appears to be general agreement among the Java community, that Enterprise Java Beans (EJBs) can introduce more problems than they solve; they are often complex and difficult to maintain. With these problems in mind, Richardson set out to understand a way to develop enterprise applications that were easier to maintain and develop. POJOS in Action is the result of his search. This volume presents lessons in working with POJOS and open-source lightweight technologies, such as Hibernate, Spring, JDO, and iBATIS, Mr. Richardson goes out of his way to present options using several different approaches, including the more POJO compliant EJB 3. While one of the main purposes of POJOs in Action is to acquaint the reader with new, simpler, and faster ways to develop Enterprise Java applications, Richardson does not champion this approach to the exclusion of logical examination of enterprise needs. The author takes the reader through the process of making key design decisions in order to determine the best approach to use.
POJOs in Action is presented in 4 parts that contain a total of 13 chapters. Chapters are well-written and easy to follow, with section titles clearly marked and representative of the following content. Tables and diagrams are readily discernible at a glance. Specific coding sections are easily identified by a label that is offset to the right of the code and emboldened (e.g. Creates PendingOrder and test data), with an arrow, or bracket, designating the corresponding code.
Part 1 covers Chapters 1-3 and provides an overview of POJOs and lightweight frameworks. In Chapter 1, Richardson explains why developers have become disillusioned with EJBs and provides a brief history of problems that have been encountered. He explores a typical EJB 2 application architecture, while contrasting the use of POJOs in a lightweight environment. The EJB 2 approach is wed to a remote server that requires heavy EJB containers, while the lightweight frameworks are non-invasive and operate outside of the server to allow for quick testing of design decisions. Chapter 2 delves into design decisions when developing back-end logic of an enterprise Java application: When should a developer choose a heavyweight approach over a lightweight approach? How should the business logic be organized? How will database concurrency be handled? This chapter presents examples of business logic and database access decisions. It explores organization of business logic using a procedural design, as well as an object-oriented design. The procedural design relies on transaction scripts that centralize behavior and has code that can be difficult to understand and maintain. This type of design is created when using C, or other non object-oriented programming languages. Object-oriented design, on the other hand, uses a network of relatively small classes that interact. As an example of a business application using an object-oriented programming language (OOP), Richardson develops a Money Transfer application that has separate classes such as TransferServices, Account, OverdraftPolicy, and BankingTransactions. Each part can be addressed separately, rather than having to dig through all of the code to edit a specific part as with a procedural approach. This example appears again, in later sections, when it is used to provide further illustration using different approaches.
Part 2, Chapters 3-7, approaches business design using an object-oriented domain model. Chapter 3 describes how the POJO domain model is used. The reader learns about the structure of domain models and the benefits - and drawbacks - of using one. Richardson explains how to identify the domain models? classes, fields, and relationships by analyzing the application?s requirements and talking with the business? experts. The author explains the use of test-driving development techniques, the technique of using mock objects to test the domain model without a database, and develops a Place Order application to further demonstrate his lessons. Chapters 4-6 offer an overview of Object/Relational Mapping (ORM) frameworks and introduces Hibernate and JDO, within this context. He describes how to use the Spring ORM classes and JDO 2 (Sun ORM standard) to persist the domain model developed early in Part 2. He also takes this opportunity to explore some of the limitations of both Spring and JDO. Richardson ends this section with instruction on how to encapsulate the business logic with a POJO facade for easier development and testing.
Part 3, Chapters 8-10, offers alternative approaches to designing the business and persistence tiers of an enterprise application and delves into implementing business logic using a procedural design. The author describes how to develop procedural business logic and to structure it in a way that makes it easier to maintain. Chapter 8 dispenses with the business facade created in Part 2 while still providing ease of maintenance and use in working with detached items. Chapter 9 takes the reader away from object-oriented design and describes how to develop a procedural business logic that is structured for easy maintenance. Richardson takes care to steer the reader around pitfalls such as mixing database code with business logic. Again, the reader is exposed to the pros and cons on using each approach. As mentioned earlier, traditional approaches to Enterprise Java development provided code that was complex and difficult to maintain. Java developers have worked to incorporate some of the lightweight advantages into EJBs in the EJB 3 version. In Chapter 10, Richardson provides a comparison of EJB 3 with JDO, Hibernate, and Spring through working with the Money Transfer application created in Part 1. Richardson exposes a few significant limitations of EJB 3, as well as advantages. Finally, the author implements the session facade developed in Part 2 as an EJB 3 session bean.
Part 4, Chapters 11-13, addresses databases and concurrency issues. In Chapter 11, the reader learns how to implement dynamic paged queries using iBATIS, JDO, and Hibernate frameworks, as well as when to use the native SQL queries of Hibernate and JDO. In Chapter 12 Richardson explores concurrency issues encountered with a single user, and explains the use of serializable transactions, pessimistic and optimistic locking patterns, as well as when and how to use these options within iBATIS, JDO, Hibernate, and Spring. Finally, in Chapter 13, Richardson teaches the benefits and drawbacks of different approaches in handling concurrency issues across a sequence of transactions, concluding with an in-depth discussion of offline locking patterns.
Chris Richardson's POJOs in Action is a practical guide to using the new lightweight frameworks with POJOs. It gives the reader an overview of Hibernate, JDO, iBATIS, and Spring. More importantly, it defines the features of each with relation to the others. Although a fan of POJOs and lightweight technology, Richardson states that "every technology has both benefits and drawbacks," POJOs in Action teaches the reader when - and when not to - use each of these frameworks. Richardson suggests that, even with the rapid change in the world of Java application development, this volume will remain relevant for some time to come. POJOs in Action is well-written, easy to use, and would be an excellent addition to the library of individuals with an interest in this subject.
Jim Blansett is Information Resources Librarian in the McLure Education Library of the University of Alabama
Copyright 2007 by Jim Blansett. This document may be reproduced in whole or in part for noncommercial, educational, or scientific purposes, provided that the preceding copyright statement and source are clearly acknowledged. All other rights are reserved. For permission to reproduce or adapt this document or any part of it for commercial distribution, address requests to the author.
|
Technology Electronic Reviews (TER) is an irregular electronic serial publication of the Library and Information Technology Association, a division of the American Library Association, 50 E. Huron St., Chicago, IL 60611. The primary function of TER is to provide reviews of and pointers to a variety of print and electronic resources about information technology. Resources include books, articles, serials, discussion lists, training materials, bibliographies, and other items of interest to librarians and information technology professionals. The topics covered may include, but are not limited to, networking technologies and standards; hardware and software; operating systems; databases; specific programming languages; management tools and utilities; technical project management; training and personnel issues; library perspectives; and research and development.
Opinions expressed in this publication are those of the writers and do not necessarily represent the viewpoints of LITA, ALA, or organizations involved in the storage and/or distribution of the publication.
TER is distributed electronically via Internet. There is no subscription fee.
LITA provides its members, other ALA divisions and members, and the library and information science field as a whole with a forum for discussion, an environment for learning, and a program for action on the design, development, and implementation of automated and technological systems in the library and information science field.
LITA home page | TER home page |
|