Concept in Definition ABC
Miscellanea / / July 04, 2021
By Guillem Alsina González, in Jan. 2018
Modularity, that is, being able to divide a complex task into several interrelated but sufficiently independent components to so that they can be reused, both throughout the execution of the same program and in other developments, it is one of the "holy grails" of the programming.
That is why it should not surprise us that, throughout the years in which we enjoy science computing, several programming philosophies have appeared that seek to implement this philosophy reuse of code source and numerous programming languages that implement it.
One of these philosophies is object-oriented programming, and its evolution The natural thing that seeks to go one step further is Aspect Oriented Programming, AOP (aspect oriented programming)
We understand AOP as the way to design and structure the source code of an application computing, so that its various elements are encapsulated and well defined for later reuse.
Thanks to the AOP, the reading of the source code referring to an object (its definition and actions that we can perform with it) allows the reader to understand it as a whole without need a larger context, which helps, on the one hand, to reduce the repetition of source code and, on the other, to fully modularize the Applications.
The A of AOP corresponds to Aspect, and this denotes a functionality that is transversal to the entire application that will be implemented in a separate module from the most functional part of the program.
It is, conceptually, something that is used repeatedly and in different places in the source code of a app, and that it is encapsulated and isolated from the rest of the code in order, in this way, to be able to modify it without affecting the rest of the source code.
In this way, an aspect can be called from anywhere in the code without requiring knowledge of how it works internally on the part of the programmer, with which it is sewn AOP also facilitates the work of a team of developers, since some do not necessarily have to know the details of how the source code created by the developers works internally. the rest.
The Tip is the code implementation of an aspect.
It constitutes a module of the application, self-contained and that can both be called from different parts of the code of the same application for which it has been developed, as reused in other applications that must make use of the same aspect, since its encapsulation is total.
The reference to an aspect within the source code is called a Joint Point.
The point of attachment is a call to a method, which will be the advice. The only thing that differentiates it from another call conventional is the encapsulation of the call object.
It is a way of modifying the functionality of an application on a given element without having to perform changes in the source code, modifying some of its aspects (and, hence, the name of this philosophy and way of growth).
Being a programming philosophy, AOP can be carried out in existing languages, it is not necessary to create new languages.
There are, yes, frameworks that facilitate this task for existing languages, such as C ++ or PHP. This is the case of Spring for Java, AspectC ++ for C ++, or Aspyct AOP for Python.
Photo: Fotolia - Ainoa
Topics in AOP