Better, Faster, Lighter Java
Chapter 1. The Inevitable Bloat
Section 1.1. Bloat Drivers
Section 1.2. Options
Section 1.3. Five Principles for Fighting the Bloat
Section 1.4. Summary
Chapter 2. Keep It Simple
Section 2.1. The Value of Simplicity
Section 2.2. Process and Simplicity
Section 2.3. Your Safety Net
Section 2.4. Summary
Chapter 3. Do One Thing, and Do It Well
Section 3.1. Understanding the Problem
Section 3.2. Distilling the Problem
Section 3.3. Layering Your Architecture
Section 3.4. Refactoring to Reduce Coupling
Section 3.5. Summary
Chapter 4. Strive for Transparency
Section 4.1. Benefits of Transparency
Section 4.2. Who's in Control?
Section 4.3. Alternatives to Transparency
Section 4.4. Reflection
Section 4.5. Injecting Code
Section 4.6. Generating Code
Section 4.7. Advanced Topics
Section 4.8. Summary
Chapter 5. You Are What You Eat
Section 5.1. Golden Hammers
Section 5.2. Understanding the Big Picture
Section 5.3. Considering Technical Requirements
Section 5.4. Summary
Chapter 6. Allow for Extension
Section 6.1. The Basics of Extension
Section 6.2. Tools for Extension
Section 6.3. Plug-In Models
Section 6.4. Who Is the Customer?
Section 6.5. Summary
Chapter 7. Hibernate
Section 7.1. The Lie
Section 7.2. What Is Hibernate?
Section 7.3. Using Your Persistent Model
Section 7.4. Evaluating Hibernate
Section 7.5. Summary
Chapter 8. Spring
Section 8.1. What Is Spring?
Section 8.2. Pet Store: A Counter-Example
Section 8.3. The Domain Model
Section 8.4. Adding Persistence
Section 8.5. Presentation
Section 8.6. Summary
Chapter 9. Simple Spider
Section 9.1. What Is the Spider?
Section 9.2. Examining the Requirements
Section 9.3. Planning for Development
Section 9.4. The Design
Section 9.5. The Configuration Service
Section 9.6. The Crawler/Indexer Service
Section 9.7. The Search Service
Section 9.8. The Console Interface
Section 9.9. The Web Service Interface
Section 9.10. Extending the Spider
Chapter 10. Extending jPetStore
Section 10.1. A Brief Look at the Existing Search Feature
Section 10.2. Replacing the Controller
Section 10.3. The User Interface (JSP)
Section 10.4. Setting Up the Indexer
Section 10.5. Making Use of the Configuration Service
Section 10.6. Adding Hibernate
Section 10.7. Summary
Chapter 11. Where Do We Go from Here?
Section 11.1. Technology
Section 11.2. Process
Section 11.3. Challenges
Section 11.4. Conclusion
Chapter 12. Bibliography
Section 12.1. Books
Section 12.2. Referenced Internet Sources
Section 12.3. Helpful Internet Sources
Section 12.4. Other References
This book consists of 11 chapters and a Bibliography:
- Chapter 1, The Inevitable Bloat
This chapter highlights the problems inherent in the large-scale enterprise Java frameworks that most programmers work with today. I will cover not only what's wrong with these bloated frameworks, but how they got that way. Finally, I will lay out the core principles we'll cover in the rest of the book.
- Chapter 2, Keep It Simple
Many programmers fall into the same trap, believing that the more complicated their code, the better it must be. In fact, simplicity is the hallmark of a well-written application. This chapter defines the principle of simplicity, while drawing a distinction between simple and simplistic. I will also examine the tools and processes that help you achieve simplicity, like JUnit, Ant, and Agile development.
- Chapter 3, Do One Thing, and Do It Well
Programmers need to resist the urge to solve huge problems all at once. Code that tries to do too much is often too entangled to be readable, much less maintainable. This chapter traces the path from being presented with a problem, to truly understanding the problem and its requirements, to finally solving the problem through multiple, simple, and targeted layers. It finally describes how to design your layers to avoid unnecessary coupling.
- Chapter 4, Strive for Transparency
The programming community has tried for years to solve the problem of cross-cutting concerns. Generic services, like logging or database persistence, are necessary for most applications but have little to do with the actual problem domain. This chapter examines the methods for providing these kinds of services without unnecessarily affecting the code that solves your business problem—that is, how to solve them transparently. The two main methods we examine are reflection and code generation.
- Chapter 5, You Are What You Eat
Every choice of technology or vendor you make is an embodiment of risk. When you choose to use Java, or log4j, or JBoss, or Struts, you are hitching yourself to their wagon. This chapter examines some of the reasons we choose certain technologies for our projects, some traditional choices that the marketplace has made (and why they may have been poor choices), and some strategies for making the right decisions for your project.
- Chapter 6, Allow for Extension
You simply can not know every use to which your application will be put when you write it. Any application that is worth the effort put into it will have a life outside the imagination of its authors. Your application needs to allow for extension after its release to the world. This chapter examines the techniques for providing extension points, from interfaces and inheritance to configuration and the plug-in model.
- Chapter 7, Hibernate
Hibernate is an open source persistence framework that provides transparent object-to-relational mapping. It is a straightforward and simple implementation that focuses on the job of persisting your domain objects so that they can in turn focus on solving the business problems at hand.
- Chapter 8, Spring
Spring is an open source application service provider framework on which to deploy enterprise applications. It has a simple, lightweight container for your objects, and provides access to a variety of core J2EE services. However, it does so without all the heavy requirements of standard J2EE frameworks, and with no intrusion into the design of your domain objects.
- Chapter 9, Simple Spider
Building on the principles this book espouses, this chapter examines the construction of a sample application, the Simple Spider. This application provides indexing and search capabilities for a web site by crawling its pages, indexing them with Lucene, and providing multiple interfaces for searching the results.
- Chapter 10, Extending jPetStore
Having built the Simple Spider, we now examine how easy it is to extend an application (the jPetstore sample from Chapter 8) if you follow the principles in this book. We replace the existing jPetstore search feature with the Simple Spider, then replace the persistence layer with Hibernate.
- Chapter 11, Where Do We Go from Here?
Finally, this chapter looks ahead to what is coming on the horizon, new trends and technologies that are here or just around the corner, and how the ideas in this book are part of a changing landscape in enterprise Java development.
- Bibliography
Contains a listing of resources and references.