Spring 2.5 Aspect-Oriented Programming Book Review
Buy it now
One Minute Bottom Line
|Spring 2.5 Aspect-Oriented Programming is a good and unique work and it is highly recommended for developers who are focused (or would like to focus) on Spring AOP!|
Chapter 1: Understanding AOP Concepts
The first chapter is a wide introduction to all the main concepts that you need to know in approaching AOP. All these components are described with their own definitions and their basic implementation examples.
There is an detailed description about crosscutting concerns implemented using Object-Oriented Programming (OOP) and using AOP. I have appreciated the exploration about code scattering and code tangling with examples.
I think in this way it could be more easy understand for everyone:
- what AOP do for you and for your code quality (obviously only for all the code involved in using AOP)
- if AOP can help you in some modules of your application
The adoption of AOP usually is not 100% adoption, but partial within applications or legacy systems that have already been developed - it may have been nice to have a section dedicated to this.
Chapter 2: Spring AOP Components
In this chapter all the Spring components for AOP are described and shown in a structured way with examples.
The most important AOP components described are: Aspect, Joinpoint, Advice and Pointcut.
The other compontents described are Matchers and Advisors and we find here how to define the behaviour of your required aspect: when and where the aspect action must be executed.
Chapter 3: Spring AOP Proxies
This chapter has describes how to implement proxies, starting from JDK proxy implementations (based on explicit use of the Reflection package). Then we find a paragraph about how to implement proxies programmatically using Spring AOP with ProxyFactoryBean (using Interceptors).
But the most interesting way, and the most used way by developers because it is adopted by many Enterprise products too, is to create proxies with Autoproxy definitions.
There are paragraphes dedicated to Autoproxy with AspectJ, annotation and XML Schema.
So I think that this chapter can be considered the real core of the book, there are very useful snippets that you can try on your application.
Chapter 4: AspectJ Support
In this chapter you can find all the features supported by Spring AOP dedicated to AspectJ, all the annotations and how to use this extension in a Spring context. All the selection modes to inject aspects are described with different selection policies: method name, type of argument, type of return, declared exceptions, hierarchy and annotations.
Chapter 5: Design with AOP
In this chapter the main AOP design solutions are described as well. The main goals described for AOP adoption are the following: concurrency, transparent caching and security. There is a complete example about how to implement all of these solutions with all the test classes too.
About the security solution we find the description of different definition types to implement the verification of authentication and authorization: using interceptors, using pointcuts or using annotations.
With all these possibilities developers can choose the best way for their application code and architecture: usually again using an XML configuration or a programmatic way.
Chapter 6: Domain-Driven Design
In this chapter we find a well done introduction to the Domain-Driven Design (DDD) explaining the different approach of this pattern focused on classes roles and responsibility. The goal of DDD is to create applications without big service classes but with many little classes to match the domain.
Here we find a description for the main roles usually associated to classes that are managed by business logic to contribute on different operations (entity, value objects, factories, etc...).
Follow one of the big examples of the book to show an application implemented with DDD showing all the test classes too.
All these concepts allow developers to learn how to prepare their applications to IoC to create more debuggable and testable applications implementing easily Dependency Injection (DI).
Chapter 7: Tests and AOP
All this chapter is dedicated to showing how to test your Spring application using AOP. We find a complete sample of a test suite with all the code commented. For this chapter I confess that I would have preferred more methodological details rather than all this source code.
Chapter 8: Develop with AOP Tools
This final chapter is dedicated to show how to setup the working environment for Spring AOP, so I think it can be useful only for developers that never used Spring Framework. So we find the installation instructions for the following products and frameworks: Spring and Spring IDE, Eclipse, AspectJ Development Tools, Apache Tomcat and PostgreSQL. I have appreciated effort for having described all these procedures for different operating systems (Windows, Mac OS X and Linux).
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)