The principles of aspect-oriented programming (AOP) have come a long way since its inception in the early 1990s. AOP is a novel paradigm for separating crosscutting concerns in object-oriented code into modularized units called aspects. This book provides a good introduction to AOP using AspectJ, a language extension to enable AOP for Java. The book is divided into four parts: an introduction to programming with AspectJ, an explanation of how AspectJ can be used in a real application, AspectJ language details, and a conclusion that focuses on best practices and traps to watch out for.
The first part of the book outlines the need for AOP, and provides a high-level introduction to the basics of AspectJ. The next section starts with a description of an application called AspectNews, which allows users to publish content. The book quickly moves into explaining how aspects can be used to solve common design considerations, like security and exception handling. The book provides concrete examples of how to enable logging, tracing, profiling, buffering, pooling, and caching using AOP. The author points out aspects that can be used during development and deployment. This segregation provides an insight into how to build other aspects, and where they might be applicable, for example, aspects that address manageability concerns. The next part of the book focuses on AspectJ language details. The author explains, in detail, the concepts of aspects, pointcuts, advices, and static crosscutting. Along with best practices, and caution points for using AspectJ, the book also contains appendices to describe the AspectJ application programming interface (API), and the AspectJ tools for compilation and document generation.
The book provides a very good introduction to the basics of AOP, as well as concrete examples of where it can be used in an application. The text is about 250 pages long, and includes ample sample code to facilitate a hands-on learning experience. The author has a lucid writing style, and is well organized.
The book does not contain, however, discussions of dynamic crosscutting and weaving concepts (compile-time, bytecode, and load-time). Some use cases to construct test cases using AOP would help illustrate other scenarios where AOP could be applied. Despite these minor drawbacks, the author’s conversational style definitely puts the reader at ease, and helps readers think about how they could apply the principles of AOP. The book would be useful to those who are thinking about how to use AOP in their applications; I would strongly recommend this book.