- Building Microservices with Spring
- Dinesh Rajput Rajesh R V
- 112字
- 2021-07-02 14:54:12
Problems resolved by AOP
As stated earlier, aspects enable modularization of cross-cutting concerns. So if you are not using aspects, then modularization of some cross-cutting functionality is not possible. It tends to mix the cross-cutting functionality with the business modules. If you use a common object-oriented principle to reuse the common functionalities such as security, logging and transaction management, you need to use inheritance or composition. But here using inheritance can violate the single responsibility of SOLID principles and also increase object hierarchy. Also, the composition can be complicated to handle across the application. That means, failing to modularize cross-cutting concerns leads to two main problems as follows:
- Code tangling
- Code scattering