Why would you want to add another tool in the already-complex development environment of your team? The ultimate reason is: it will reduce development and maintenance cost of your applications. Let's see how.

Less of Lines of Code

Every line of code is a source of complexity and a potential source of problem. Every line of code costs money. Therefore, every line of code that does not contribute directly to the core concern of the program should be considered with great attention.

Non-functional requirements like transaction management, tracing, security, and exception handling, rarely add business value to the program. They are nevertheless important, since unreliable programs are of no business value at all.

As they are typically implemented by the repetition of the same pattern for the dozens and dozens of methods to which they apply, non-functional requirements generally result in numerous lines of codes.

With aspect-oriented programming, you can address non-functional requirements declaratively and simply remove these bad and expensive lines from your code.

Better Design

The problem with non-functional requirements is that their implementation is mangled in all methods implementing functional requirements. This severely violates the established principle of separation of concerns. With aspect-oriented programming, you could:

  • Improve feature localization: the implementation of transaction handling will be located in the transaction handling aspect, not in every business method.
  • Reduce component coupling: business code will not be directly coupled to the transaction handling implementation any more; it will be easier to change the transaction handler for another.
  • Improve skill set consistency in your team: a domain expert will not have to care about how to implement properly caching in a multithreaded context any more; he will just declare the business method cacheable.

Automate Pattern Implementation

Implementation Patterns are best practices learned by the community through experience. Patterns are often formalized in natural language as 'recipes' giving a solution to a given problem.

Aspect-oriented programming (AOP) makes it possible to encapsulate some of the best practices into executable code: instead of suggesting how to implement correctly exception handling, you may make a custom attribute out of it, and let it available to the team.

Comments are closed