Chapter 1. Introducing AOP
Listing 1.1. A simple program that calls service methods in sequence
Listing 1.2. Example of refactoring using DI instead of AOP
Listing 1.3. Use of the decorator pattern in pseudocode
Listing 1.4. Using AOP instead of DI for cross-cutting concerns
Listing 1.5. Pseudocode example of an extremely simple AddressBookService
Listing 1.6. Pseudocode example with argument checking split out using AOP
Listing 1.7. Encapsulated and reusable code
Chapter 2. Acme Car Rental
Listing 2.1. An implementation of the accrual service
Listing 2.2. A simple Console application to test the business logic
Listing 2.3. Accrue code, now with logging
Listing 2.4. Redeem code, now with logging
Listing 2.5. Accrue with defensive programming
Listing 2.6. Redeem with defensive programming
Listing 2.7. Accrue with a transaction
Listing 2.8. Redeem with a transaction
Listing 2.9. Accrue with transaction and retries
Listing 2.10. Redeem with transaction and retries
Listing 2.11. Accrue with exception handling
Listing 2.12. Redeem with exception handling
Listing 2.13. Redemption service refactored with DI
Listing 2.14. Accrual service refactored with DI
Listing 2.15. Combined exception handler and transaction handler
Listing 2.16. An aggregate service for orchestrating two services
Listing 2.17. Accrue method’s defensive programming and logging
Listing 2.18. A method boundary aspect to handle logging
Listing 2.19. Applying the logging aspect to the Accrue and Redeem methods