Aspect-Oriented

by Gregor Kiczales

Origin

The founder of aspect-oriented programming (AOP) is Gregor Kiczales. In the 1990s, he and his team developed the concept of aspects and created the AspectJ language, which extended object-oriented programming (OOP) to better modularize code.

Historical Context

AOP emerged as a response to difficulties in code organization caused by cross-cutting concerns—behavior that affects many modules in a program, such as logging, security management, and error handling. In object-oriented programming, such functions are often hard to isolate in a single place. Kiczales and his colleagues proposed isolating these concerns into separate modules (aspects), which are then “woven” into the main program logic.

Aspect-oriented programming (AOP) provides tools to separate cross-cutting concerns into distinct modules called aspects, which can interact with and complement the base program code.

All AOP languages offer ways to isolate cross-cutting concerns into individual entities. Since AspectJ pioneered this field, the concepts it introduced have spread to most AOP languages.

AOP provides solutions for handling cross-cutting concerns, such as logging, transaction management, or security, which typically affect many parts of a program. AspectJ, one of the first and most widely adopted tools, implements these concepts for the Java language.

Key Concepts in AOP

  • Aspect: A module or class that implements cross-cutting concerns. Aspects alter the behavior of the rest of the code by applying advice at specified join points defined by a pointcut.

    Aspects are the core elements in AOP that allow cross-cutting concerns to be injected into a program without modifying its source code. They can influence the program’s execution at specific points, ensuring flexibility and modularity.

  • Advice: Code to be executed at a join point. Advice can be executed before, after, or in place of a join point.

    Advice specifies what code should be executed at a join point. It can run before, after, or instead of the main code, allowing additional functionality to be added without changing the original code.

  • Join Point: A point in the execution of the program where advice can be applied. Many AOP implementations allow method calls and field accesses to be treated as join points.

    Join points are locations in the code where aspects can be applied. This can include method calls, field access, or even specific exceptions, providing precise control over where and how additional functionality is integrated.

  • Pointcut: A set of join points. The pointcut defines whether a given join point is appropriate for the given advice. The most convenient AOP implementations use the main language’s syntax (e.g., Java signatures in AspectJ) and allow reusing pointcuts through renaming and combining.

    Pointcuts group join points together and define when and where an aspect should be applied. This powerful tool manages aspects and allows for reusable, adaptable solutions.

  • Introduction: The ability to modify the structure of a class or change inheritance hierarchies to add aspect functionality to external code. Typically implemented via some meta-object protocol.

    Introduction allows aspects to change class structures, such as adding new methods or fields, thus enhancing the program while keeping the core code intact.

Examples of Languages

  • AspectJ
  • PostSharp (for C#)
  • Spring AOP

aspect-oriented paradigm


Buzzwords
strong-weak-ties programming social-group-dynamics mindmap platform-networks structural-functionalism rationalism structuration-theory cognitive-capital mediatisation-theory operationalization enterprise Babylon automation social-action marketplace AI actor-network ideas scrum discord cognition communication social-capital financial production semantic-gap aspect-oriented umwelt empiricism positivism gap actor-network-theory research complexity information imperative verification problem psychologism game-dev streaming systems-theory disciplinary-power multiple-worlds-theory teamwork theory systems elephant cloud knowledge-communication structure tools symbolic-interactionism babylon field-theory messengers element security network e-commerce mediation-market big-data fact information-society concept communities philosophy social-network elements development object service multimedia sociology paradigm distribution theories language lenses epistemology metaphor social-exchange functional deconstruction linguistics anthropology meaning apriorism institutionalization-theory analytics projects conceptualization concepts poststructuralism procedural knowledge hoare-triples domain semantics consumption-theory syntax capitalist-systems subject