concept implementation in category aspectj

appears as: n implementation, implementation, implementation, implementations, implementations, The implementation
AspectJ in Action, Second Edition

This is an excerpt from Manning's book AspectJ in Action, Second Edition.

If complexity is the problem, modularization is the solution. By breaking the problem into more manageable pieces, you have a better shot at implementing each piece. When you’re faced with complex software requirements, you’re likely to break those into multiple parts such as business functionality, data access, and presentation logic. We call each of these functionalities concerns of the system. In a banking system, you may be concerned with customer management, account management, and loan management. You may also have an implementation of data access and the web layer. We call these core concerns because they form the core functionality of the system. Other concerns, such as security, logging, resource pooling, caching, performance monitoring, concurrency control, and transaction management, cut across—or crosscut—many other modules. We call these functionalities crosscutting concerns.

For core concerns, object-oriented programming (OOP), the dominant methodology employed today, does a good job. You can immediately see a class such as LoanManagementService implementing business logic and AccountRepository implementing data access. But what about crosscutting concerns? Wouldn’t it be nice if you could implement a module that you identify as Security, Auditing, or PerformanceMonitor? You can’t do that with OOP alone. Instead, OOP forces you to fuse the implementation of these functionalities in many modules. This is where aspect-oriented programming (AOP) helps.

Figure 1.6. An AOP language implementation that provides a weaver in the form of a compiler. The compiler takes the implementation of the core and crosscutting concerns and weaves them together to form the final system.

An AOP system may also be able to push the weaving process close to execution of the system. If the implementation of AOP is Java-based, a special class loader or a virtual machine (VM) agent can perform the weaving. Such an implementation first loads the byte code for the aspects, weaves them into the classes as they’re being loaded, and supplies those woven versions of the classes to the underlying VM.

Figure 1.6. An AOP language implementation that provides a weaver in the form of a compiler. The compiler takes the implementation of the core and crosscutting concerns and weaves them together to form the final system.
Listing 9.1. Stub implementation of InventoryService
package ajia.service.impl; import ajia.service.InventoryService; import ajia.domain.Product; public class InventoryServiceStubImpl implements InventoryService { public void addProduct(Product product, int quantity) { System.out.println("InventoryServiceImpl.addProduct " + product.getName() + " " + quantity); } public void removeProduct(Product product, int quantity) { System.out.println("InventoryServiceImpl.removeProduct " + product.getName() + " " + quantity); } public boolean isProductAvailable(Product product, int quantity) { System.out.println("InventoryServiceImpl.isProductAvailable " + product.getName() + " " + quantity); return true; } }