Aspect oriented programming: Difference between revisions

Content added Content deleted
m (J: dada)
m (Looks like a draft task)
Line 1: Line 1:
{{draft task}}
= Background =
;Background

The main goal of Aspect Oriented Programming (AOP) is to keep all the code relating to a single feature in one module of code.
The main goal of Aspect Oriented Programming (AOP) is to keep all the code relating to a single feature in one module of code.


Line 19: Line 19:
AOP allows for a "separation of concerns" because new features are introduced as aspects tied to the execution of existing code, but without touching any of it, thereby keeping code bases completely separate. For instance, a mutex locking discipline can be added to a class without touching any of its code. An aspect identifies the methods that need locking, introduces the mutex variable into every instance of every instrumented class, and gains control around the invocations of the targetted methods to manage the mutex. Without AOP, the concern for locking is spread everywhere. Mutex lock/unlock calls have to be written or at the very least, methods have to be declared as synchronized, and this is repeated in every class that requires locking.
AOP allows for a "separation of concerns" because new features are introduced as aspects tied to the execution of existing code, but without touching any of it, thereby keeping code bases completely separate. For instance, a mutex locking discipline can be added to a class without touching any of its code. An aspect identifies the methods that need locking, introduces the mutex variable into every instance of every instrumented class, and gains control around the invocations of the targetted methods to manage the mutex. Without AOP, the concern for locking is spread everywhere. Mutex lock/unlock calls have to be written or at the very least, methods have to be declared as synchronized, and this is repeated in every class that requires locking.


= Task =
;Task

The task is to describe or show how, or to what extent, a given programming language implements, or is able to implement or simulate, Aspect Oriented Programming.
The task is to describe or show how, or to what extent, a given programming language implements, or is able to implement or simulate, Aspect Oriented Programming.


Line 117: Line 116:


I may have described a feature-oriented programming paradigm, or something related to modular programming. If so please feel free to rename or refactor the page!
I may have described a feature-oriented programming paradigm, or something related to modular programming. If so please feel free to rename or refactor the page!
__NOTOC__