This book is a task-oriented solutions book that illustrates solutions to common programming problems using the Apache Jakarta Commons. Say the name Apache and many people will associate the name with a Web Server. Maybe some will associate Apache with other projects. What few do is associate Apache as an organization that helps developers create Open Source products. At the highest level is the Apache Software Foundation (ASF); below that are individual projects like the Apache Web Server, Extensible Markup Language (XML), and Jakarta.
The Jakarta and XML projects contain a number of Java-based projects, which include Web Servers, XML processors, and other useful solutions. Many of these solutions share components that allow you to do common things like logging, class instantiation, and serialization. Those common components are called the Commons, which is the focus of this book.
The Commons are reusable components created through using experience, not abstract thinking. When a developer wants to create a component, he typically evaluates the need, comes up with a design, and then implements it. The problem with this approach is that it may or may not solve the needs of the developer who is using the components. Another problem is that there are many different frameworks that do this. The difference between other frameworks and Commons components is that components from the Commons are based on experience and need.
For example, let's say somebody needs some logging routines. He will write the first version and think, "Hey, somebody else could use this." The code is then released to the Commons, but not the main Commons. The code is put into something called the Commons Sandbox, which is a pre-staging area that checks the need of the reusable code. In the Sandbox, the code will be inspected, tweaked, updated, and debated. Especially important in the Sandbox is that the code is truly reusable and used in many different projects. If a component in the Sandbox is popular and has gone through the teething stages, then it is promoted to a mainstream Commons component.
This teething and experimentation make a Commons component different from all other reusable component frameworks. A user of a Commons component knows that the component has been used elsewhere and solves a purpose in the best way that it can be solved .
You may be wondering how software engineering ties into the book. Engineering is the application of practical generic solutions to solve problems. In essence, this is what the Commons is all about. It is about being practical and pragmatic, and using proven solutions when solving common problems (such as creating objects, reading configuration files, and generating log messages).
Tying this back to the first sentence of the chapter, the focus of this book will be to present the components from the Commons that solve common problems. For example, when you're creating an object, what is the best way to create an object? The answer lies in Chapter 3, which shows several different strategies offered by the Commons. Another problem is how to effectively write components; this is covered in Chapter 4.
Throughout this book, we pick a problem theme and then show the solutions using components and strategies from the Commons. What is important to remember when you're reading the material is that all of the solutions presented are tried and tested , and work in the most efficient manner possible.
It is important that you read the book starting from the front to the back because the questions at the end of each chapter build on top of each other. The idea is to get you using the ideas presented in the chapter to solve a problem that is representative of a real-life programming scenario.