Talk:Aspect-oriented programming

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science (Rated Start-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.


The article puts a lot of emphasis on the fact that a patent covering AOP exists without a good justification for such emphasis.

The article right now starts with: 'In computing, aspect-oriented programming (AOP) is a patented programming paradigm [...]'

Some problems with that:

  1. US-centric point of view. Only a US patent is cited. Those don't necessarily apply outside of US. Some jurisdictions outright prohibit software or idea patents.
  2. Questionable relevance. Many software and idea patents granted in US might be invalid or are held for defensive purposes and are unlikely to be pursued. A lot of concepts and algorithms are patented and if you wanted to be consistent, you'd have to start many articles on programming related subjects by mentioning that the subject is patented, which would be rather superfluous.

Then, in the criticism section there's: 'Firstly, aspect-oriented programming is patented, and thus not freely implementable.'

That looks like original research. The only citation is to the patent itself, which proves that it in fact exists. But claims as to how much of a problem it is in practice and whether it has actually impacted adoption of the technology -- all things which are implied by that statement -- go beyond the mere existence of a patent.

Unless there are sources showing actual impact of the patent on companies using AOP or providing AOP tools, the criticism part, and the mention at the top probably too, should be removed. (talk) 14:54, 17 August 2015 (UTC)

Jargon in the intro[edit]

"Introduced after object-oriented programming (OOP), it is a post-object-oriented programming paradigm." - The second half of the sentence repeats the first half, adds nothing further to the explanation, and uses unnecessary jargon "post-object-oriented programming paradigm" (I count 2-3 buzzwords in 5 words total); it should be either clarified or removed. Any thoughts? -- (talk) 14:38, 1 June 2009 (UTC)

Indeed, I found myself wondering if ""post-object-oriented-programming"" is some sort of joke or subtle negative commentary due to the obvious acronym. Nothing wrong with post-OOP, I guess, but it does seem like the intro to the article could be a lot more informative. -CS —Preceding unsigned comment added by (talk) 04:15, 2 June 2009 (UTC)


In the introduction there's a line that says "Because it is a paradigm that was introduced historically after OOP it is a Post-OOP or Post-object programming paradigm, and because it is the best known, it is sometimes confused with the entire class of paradigms." However the link from "Post-object" goes right back to this page, which doesn't agree with the aforementioned statement. (talk) 23:44, 8 February 2009 (UTC)

Comparison to other programming paradigms[edit]

Designers have considered alternative ways to achieve separation of code, such as C#'s partial types, but such approaches lack a quantification mechanism that allows reaching several join points of the code with one declarative statement.

Could someone please elaborate on how the 'partial' capability of C# could be used to achieve aspect-oriented effects? I'm not quite seeing it. All the partial keyword allows is for you to define a single class in n parts (and possibly n different files). How does this even approximate aspect-oriented programming?

Isn't CL/CLOS Aspect oriented because of Multimethods and method wrappers

Methinks AOP should be related to the concepts of a database trigger and event-driven programming. I don't see that connection being made in the current article text. By the way, there is a Google Techtalk from May 2006 with Gregor Kiczales titled Aspect Oriented Programming: Radical Research in Modularity --LA2 20:08, 4 July 2007 (UTC)

extension of the motivation example[edit]

I would suggest that somebody who knows AOP extend the example from the section "Motivation and basic concepts" to show what it might look like in AOP.

I totally agree. It would have been a great help for me also.oriOrimosenzon-signature.png 06:07, 11 September 2006 (UTC)
I agree too. This is something that the article MUST have.
  We must do some new section on disccution to poll about this subject?
  Maybe there is a reason for doing this but I think it must be done.

The article on Karl Lieberherr claims he introduced aspect-oriented programming. Maybe someone here could consolidate the two articles? Rvollmert 07:12, 2004 Aug 23 (UTC)

This is gibberish. Each piece of jargon is defined in terms of some other piece of jargon, never in plain English (or even in the jargon of object-oriented programming, which at least many people have heard of). 2004-11-28

This is a comment from the perspective of someone who doesn't know AOP, and is trying to learn a bit. First, thank you to the person who added the link to the "Attempt to explain AOP without buzzwords." Perhaps the wikipedia article could take some cues from that source? Second, with regard to the invention of AOP, the article says only "no one remembers exactly when". That may be true, but some sort of indication would be nice for those who don't even know which decade is the right one.

Just a minor observation - my expirience is that telecommunications applications' core concern isn't routing calls - it's billing, really bad example here.

I agree with most of these comments above that this description of AOP is too complicated, but, more importantly, fundamentally wrong. I believe that the article will have to be substantially rewritten to be correct. It would be my first article, so I may need some help. I have a good understanding of AOP, but I am just getting started with the Wikipedia. My major beef is that a concern is never properly defined and the relationship between crosscutting and non-crosscutting concerns is never explained. Many other beefs stem from this. --Andrew Eisenberg 20:51, 5 May 2005 (UTC)

I just want to clarify something: in the intro it is stated that "An aspect can alter the behavior of the base code", and that is, in my opinion error-inducing. In fact (and i'm talking about AspectJ here) an Aspect can advise itself or other aspects. This may be important, as it is a source of many doubts for those learning AOP. --Rui 5 July 2005 00:48 (UTC)

This page talks about Aspect-Oriented Programming in general, not AspectJ (at least until section 4). In AspectJ, it's certainly possible for aspects to advise themselves. However, that's not a requirement for AOP languages. Hyper/J, for example, only has a static joinpoint model and the hypermodules cannot make changes to themselves.
Conceptually, I think AOP is easiest to explain by keeping the base and aspect modules separate, although it is true that this rarely happens when coding using AOP. When writing the intro, I tried to keep the explanation simple, rather than complete. However, if you have any suggestions for the intro, please make the changes or put them in the talk section. --Andrew Eisenberg 7 July 2005 17:21 (UTC)
AspectJ comes tightly integrated with a powerful set of tools, 
called AJDT, which assist developers in the understanding of how
aspects and base code interact.

Not to nitpick, but isn't it loosely integrated, but very well supported?

You're right. I actually don't like that section 4 at all. There is already another article on AspectJ. And neither that article, nor section 4 here are all that good. What should happen is that section 4 simply becomes a link to the aspectJ article and that other article is updated. Any takers??? :-)--Andrew Eisenberg 23:53, 23 October 2005 (UTC)

This article contains 2 examples of standard java code and 0 examples of AO code... most unuseful.

Could someone add a discussion of aspect-oriented vs higher-order programming? The "other programming paradigms" touches on it very briefly. It seems like AOP is a special case of higher-order functions. Is there something else to it?

Another JavaScript implementation:

Dojo (, a toolkit I work on) has implemented full before, after, around, before-around, and after-around advice for JavaScript by way of the dojo.event.connect() API.

An article describing the API is at Discussion of AOP concepts begins about halfway through.

Perhaps someone else would feel comfortable adding it to the list of JS AOP implementations?

Is this correct ?[edit]

"AspectJ has two JPMs: pointcuts and advice, and inter-type declarations. Other aspect languages have different JPMs." 2 or 3 ?

Removed talk-like text[edit]

The following text (from the end of "Motivation and basic concepts") does not read like an article - it reads more like a discussion. It simply does not belong there as it is, so I have removed it. If it is useful and informative, please integrate it properly. Hairy Dude 20:12, 16 April 2006 (UTC)

Analogies from a newbie:

The use of this on methods seems to be similar to overriding a method in a subclass, but:

  • You can change multiple methods and/or classes in one definition;
  • You don't need access to the constructor / factory method to instantiate subclasses -- the existing classes are modified.

The use of this on variables / fields appears to be able to convert a plain old Java field into something like a "property" in C#, which is an accessor / mutator pair with syntactic sugar to look like a variable in an lvalue or rvalue context.

I'm sure I'm missing much of it, but perhaps this makes it more accessible?

Actually, I would think a better analogy in the Object Oriented world is the Visitor pattern. A Visitor encapsulates a specific behavior that could be entirely unrelated to the object that it is visiting; but at the same time, being able to inject that unrelated behavior into a method of that object. One difference I see between the Visitor pattern and AOP is that the visited object needs to know the interface of the Visitor and will also need to explicitly call the Visitor’s method.

Removing Tutorials[edit]

Why someone removed an easy tutorial to AOP ? It tooked someone days to do a simple tutoril , but some don't like others to benefit ? Alhoori 01:24, 21 May 2006 (UTC)

This has already been discussed in your talk page. OhNoitsJamieTalk 03:11, 21 May 2006 (UTC)
Is wikipedia a personal thing , so that you people can't decide whether the topics/links can remain or no ? How can I make vote on that ? Alhoori 09:15, 21 May 2006 (UTC)

Multiple Inheritance[edit]

Would it be accurate to consider the desire for multiple inheritance to be a desire for aspect-orientation? That is, If I have a drawable class and a shape class, I might make a class that inherits both to create a "drawable shape". —Ben FrantzDale 17:27, 13 June 2006 (UTC)

Adding example[edit]

IP address wrote

[It would be useful if these examples were concluded with a parallel example of the aspect-oriented solution to these cross-cutting problems in the same JAspect/Pseudo Java, so that readers some reference points as they read the descriptions below.]

under the "Motivation and basic concepts" header. I'm assuming that person simply didn't know about the talk pages, and so I removed the comment. However, I think question is still valid, although it was posted in the wronge place. It would be helpful--if possible--for somebody more knowledgable about AOP to post a solution to the problem raised. michaelb Talk to this user 15:29, 28 June 2006 (UTC)

sample code with AOP[edit]

The sample of transfer method shows clears where the problem is without AOP. Can someone provide an "after version" of the same method with AOP? Thanks.--Mongol 17:46, 1 August 2006 (UTC)

"Problems adopting" and weasel words[edit]

The hypothetical programmer in this section is a bit one-sided and I think the entire section should be rewritten. It also should probably be renamed "Criticisms of Aspect Oriented Programming", to go along with most other articles that use that naming. -- Davetron5000 17:50, 22 August 2006 (UTC)

Full ACK, "problems adopting" implies that there is nothing fundamentally wrong with AOP. I found the following paper, which criticizes AOP and should be mentioned: --Schoelle (talk) 18:06, 23 May 2009 (UTC)

Muddled Definition[edit]

The definition of AOP above the Contents break is muddled with concerns about AOP centric languages. The explanation dives into what are apparently language usage debates before the reader even understands what AOP is. Somewhat like getting into a C++/Java/C# debate when defining what Object Oriented programming is, I don't see why AspectJ and the like are even mentioned in the definition beyond "some languages built to support AOP are..." statements.

Something wrong with formating[edit]

This page (the actual article, and when editing the article), looks very odd in lynx. can't figure out why. (doesn't happen on other pages). user:Bawolff (I'm not logged in here) 05:48, 22 January 2007 (UTC)

AOP example?[edit]

The code has lost its elegance and simplicity because the various new concerns have become tangled with the basic functionality There should be an example of this program rewritten in a AOP language so we can see how AOP simplifies this kind of thing.

Proposed Example Application[edit]

-- Reacton on the text above by TjerkWol 17:43, 24 February 2007 (UTC)

Note that such a program much be large too see the advantages of AOP... Below is an example *program* without AOP in it:

Non AOP Program[edit]

abstract class TwoDShape {

int getX();
int getY();
double getArea();


abstract class Circel extends TwoDShape {
  int getRadius();

class Line extends TwoDShape;

class Rectangle extends TwoDShape

class Square extends Rectangle

This is just a small program that does not work, but the object oriented structure is clear. The subclasses of TwoDShape should implement the methods. I did not do it here to safe time, and because it is not neccesary.

Logging Aspect[edit]

Now suppose you want to log each call to any getArea like this

double Circle.getArea() {
 log("Get Area Called");
 double area=PI * this.r * this.r;
 log("Area of circle is: "+area);
 return area;

If you want to do something like this for each getArea method of each subclass of TwoDShape you have a lot of work, and also code entaglement.. What if you have added logging for all your getArea methods and someone else adds its own subclass of TwoDShape and does not implement the logging? Then you have a problem..

I have a Syslog class (C++) that writes to the syslog by default, and all logging in my project is done through a Syslog object. It's the first object built at runtime, and generally the only one, but it doesn't have to be. Every object doesn't need to reference it, it just has to be available. If I want it to do something different, I extend the class and change or supplement the default behaviour. Works for me, not sure this is a good example. Tsingi (talk) 01:35, 24 April 2008 (UTC)

The AOP Solution[edit]

AOP deals with this problem by identify this as a seperate concern, or aspect: a logging aspect. Pseude code for a logging aspect:

aspect GetAreaLogging {

 // this defines all our methods that much be advised by this aspect,
 // it is called a joint point.
 // This one means: All subclasses of TwoDShape where getArea is called
 jointpoint getAreaJoinPoint() :  execution(double TwoDShape+.getArea());

 // below is the actual advice, it is just a anonymous method of the aspect
 // only the special aspect-enabled-compiler weaves this code in the base code
 double around() : getAreaJointPoint() {
  log("getArea called");
  double area=proceed();
  log("The value of the area is: "+area);
  return area;

Hope you get the point a bit now, i know it is not easy. See for more information.

I get everything before this section, in that I understand the problem you are trying to solve. But your example here is absolutely and completely obtuse. The language and terminology you use in your comments are themselves undefined and not known by people who are not already experts in AOP. You've left out a huge number of basic facts that are necessary to understand the example. You must find a method of explaining step by step what it is you are trying to do, WITHOUT any of the AOP terminology. This is the type of thing that only some people are good at. You need to find one of those people. (I'm good at it, but not knowing a thing about AOP I can't help you.) (talk) 16:10, 17 December 2008 (UTC)

Side Note[edit]

Note that logging is the typical example concern to introduce someone to AOP, much more advance applications with AOP are possible. Read literature and websites to know more.

TjerkWol 17:43, 24 February 2007 (UTC)

Other comparisons (that would be useful to me)[edit]

How does AOP compare to Python decorators? (All of the examples seem to be exactly what a decorator would be used for in Python.)

How does AOP compare to Lisp macros? (Python decorators seem like a subset of Lisp macros, and from the article, so does AOP.)

How does AOP compare to CLOS

It would also be useful if someone could compare AOP to what you can do with XOTcl mixins and filters. Donal Fellows 22:36, 15 September 2007 (UTC)

Missing "throws"[edit]

In the section "Motivation and basic concepts" there is "throw e" , but e is of type Exception so the function should have "throws Exception" (because Exception is not subclass of RuntimeException).

Adoption risks section[edit]

does indeed need a lot of work. For starters, it doesn't cite any sources. Next to that, some of the issues raised in that section apply equally to non-AOP programs or, even, non-Java programs. For example, the following sentence:

"For example, consider the impact of injecting code to return true at the beginning of a password verification function that returns a boolean value."

can just as easily apply to C / C++ code, seeing that anyone can use a profiler (or whatever the name for such a type of program is) to examine the various function calls and whatnot and change the program flow, for example by turning a false to a true in a password verification function.

And besides, hacking into a program like this requires a person distributing a somewhat altered version of the program, seeing that I'm not sure if it's even possible for, say, a virus to alter a Java program while it's running.

It's not an AOP-specific problem, even - with the right tools, anyone can decompile a Java program, insert his own code, and recompile. Or, on a higher level, anyone can alter the memory of a JVM by using special tools. (the last statement is a guess by the way).

The section seems, in my opinion, awfully negative towards aspect-oriented programming, highlighting problems that occur in any form of programming, in any programming language. Also, the advantages don't seem to be weighed in the comparison. —Preceding unsigned comment added by (talk) 15:34, 13 November 2007 (UTC)

I suggest that this "adoption risks" section be removed, because it is factually inaccurate. Never mind how weasel-ish it is, it just isn't a part of reality. Jfm3 (talk) 22:11, 16 December 2007 (UTC)
I want to object. Rather, the title should be changed to something containing "Criticism". Anyway, including such a praragraph is mandatory IMHO, because AOP is a controversal issue. When you try to introduce AOP into a team, a project or something similar, chances are that you have to face surprisingly strong opposition, mostly using exactly the arguments detailed in this section. In this sense, this paragraph is precise and correct, just lacking quotations. Removing such an paragraph would endanger the whole AOP article to become biassed (towards AOP), as there is an ongoing controversy around this topic. Ichthyostega (talk) 20:14, 4 December 2008 (UTC)

Quality concerns[edit]

So, I studied computer science at MIT, and I find the introduction to be dense and to explain the concept poorly. If I'm having trouble slogging through it, I'm sure that general-audience readers are completely lost. This is probably why the {{technical}} tag was added (but someone has removed it). I've added {{confusing}}, though the reason the article is confusing is that it uses too much technical jargon and focuses on detailed technical aspects up front, rather than starting with a simple overview. -- Beland (talk) 08:07, 11 August 2008 (UTC)

i also studied computer science, and i completely agree. please start with a gentle, implementation agnostic introduction ("terminology", currently 4 pages down!) and remove implementation specifics. thanks! akmg (talk) 14:53, 3 April 2009 (UTC)
I am the creator of PostSharp, a commercial AOP framework for Microsoft.NET. I think this page does not serve the purpose of explaining aspect-oriented programming to mainstream developers. Instead, it is an academic description of the traditional approach to AOP (the AspectJ one). I fully respect the academic community and I give them credit to having developed the AOP concepts, but I think the first 20 lines of the page should focus on a larger audience. Would you agree on us spending some effort working on this page? — Preceding unsigned comment added by Gfraiteur (talkcontribs) 13:31, 13 February 2011 (UTC)

Merge Proposal[edit]

Aspect-Oriented Software Development[edit]

I am currently editing the Aspect-Oriented Software Development page, to provide a more general overview of AO. The AOSD and the AOP pages overlap on certain topics, so we should try to coordinate the content. I put this page under the AOSD category. --Cotttho (talk) 23:41, 20 August 2008 (UTC)

AOSD section merge[edit]

The AOSD article has a good section on AOP that seems to more properly belong in this article and should be merged. --Cybercobra (talk) 00:56, 15 November 2008 (UTC)

Third Response[edit]

Preliminary indications: wikify, possible restructure, merge content from § in the AOSD article here, then link this as the main for that section. Lycurgus (talk) 19:25, 9 January 2009 (UTC)

Last action above taken first, removing the merge tag. (talk) 02:08, 10 January 2009 (UTC)
Also there are some significant distortions in the current text which I am in the process of cleaning. About a fifth thru, the Java/Aspect J orientation needs to be put in its proper scope, as it stands now the article is AOP using Aspect J an advert. (talk) 02:24, 10 January 2009 (UTC)

crosscutting concerns aren't secondary[edit]

I changed the first sentence to remove the idea that AOP only modularize "secondary concerns". While it is possible to see that as true of many examples of AspectJ's advice mechanism, it is less true of code that uses AspectJ's inter-type declarations, and not at all true of code that uses Hyper/J. It also isn't true of several of the other systems introduced in the original AOP paper. AOP is about modularizing crosscutting concerns, and crosscutting is an inherently symmetric relationship. The small concern isn't the crosscutting one - two concerns crosscut each other with respect to a given hierarchical representation.

I tried to fix some bugs in this page a few years ago, and someone went and undid the changes right away. Hopefully that won't happen this time.

GregorKiczales (talk) 18:26, 17 February 2011 (UTC)

What is AOP?[edit]

I have tried quite hard to get a feeling for what AOP is from the article and various links here. I am still 99% puzzled and cannot see that it is anyway (as explained) a "paradigm". What relevance has "cross-cutting" (as I understand it) got to do with programming paradigms at all? If it really is something special or different to other styles of programming, surely those differences can be explained in simple english rather than weasel words or AOP jargon that makes little sense to me. It seems to me that someone who knows what they are talking about should completely re-write this article. — Preceding unsigned comment added by (talk) 11:29, 30 November 2011 (UTC)

I use Spring in my projects and yet I still can’t understand this article’s explanations. The description of the rationale in the lede makes sense. The Motivation and basic concepts portion is just inscrutable. It starts out with a clear example of the problem, but the discussion of the solution rapidly falls apart. It talks about security as an example but then presents a solution around logging instead. That example yields no insight into how the aspect mechanism for logging got invoked or how the original example code would have been modified to take into account the AOP solution. It also has a comment at the end about “Other crosscutting code”, and yet the aspect declaration was specifically for logging. The Join point models discussion again makes sense in some abstract way, but how that translates into anything that a programmer actually does and how the entire structure comes together is completely elusive. Eventually my eyes glazed over and I gave up. I recommend a clear, top-to-bottom example of solving the example problem using AOP in the most primitive, generic way. Strebe (talk) 21:07, 1 October 2014 (UTC)

"Cross-cutting" vs. "crosscutting"[edit]

"Cross-cutting" and "crosscutting" it seems are used interchangeably in this article (6 for the former, 14 for the latter as of this post -- give or take a few). In the cross-cutting concern article, the hyphen is used in the title, and the hyphenated version is used around 14 times, where the non-hyphenated is used just once.

We need to pick one and stick with it. I think that the hyphenated version is far more readable, and probably more correct, as well. However, I'm not a big Wikipedia buff, so I don't want to do it myself and open up room for controversy. Anyone care to make this call? Dugwyler (talk) 20:44, 11 April 2012 (UTC)


I don't get it... this article is describing a technique that was commonly used in graphics programming in the 1980's (e.g. the Xt Intrinsics, Xaw, the Motif toolkit, the Andrew toolkit, and also an even older style used on Mac's, OS/2 and the like (though I'm not at all familiar with those). How does AOP differ from plain-old-fashioned "callbacks" ? linas (talk) 03:31, 16 October 2012 (UTC)

Someone said in 2008 that this article needed more citations. Why does it not have more? — Preceding unsigned comment added by Make your own luck (talkcontribs) 21:22, 30 December 2013 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Aspect-oriented programming. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at {{Sourcecheck}}).

You may set the |checked=, on this template, to true or failed to let other editors know you reviewed the change. If you find any errors, please use the tools below to fix them or call an editor by setting |needhelp= to your help request.

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

If you are unable to use these tools, you may set |needhelp=<your help request> on this template to request help from an experienced user. Please include details about your problem, to help other editors.

Cheers.—InternetArchiveBot (Report bug) 23:38, 19 October 2016 (UTC)

Adding topic filters[edit]


I am going to add new sub-topic "filters" on Aspect-oriented programming. Filters can be applied to exclude unwanted joinpoints from given pointcut expression.

[1] [2] [3] [4] Apandey6 (talk) 03:47, 21 February 2017 (UTC)

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Aspect-oriented programming. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

You may set the |checked=, on this template, to true or failed to let other editors know you reviewed the change. If you find any errors, please use the tools below to fix them or call an editor by setting |needhelp= to your help request.

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

If you are unable to use these tools, you may set |needhelp=<your help request> on this template to request help from an experienced user. Please include details about your problem, to help other editors.

Cheers.—InternetArchiveBot (Report bug) 15:45, 27 July 2017 (UTC)