Slashdot Mirror


Aspect-Oriented Programming Article On JavaWorld

Some Guy writes: "Javaworld has another article (the second in a series of three) on Aspect-Oriented Programming. Grady Booch wrote last year that AOP is one of three signs of a disruptive software technology in the horizon: a technology that could take us to the next level beyond object-oriented programming."

75 comments

  1. Betty Swollocks by Anonymous Coward · · Score: 0

    Betty is visiting.

  2. Booch's own company is hardly a poster child... by Raskolnk · · Score: 4, Interesting

    When I was first starting out in programming I read Booch's OOA&D, and spent the next while thinking he was one of the smartest people on the planet.

    However, working with Rational's software has tainted Booch's name for me. After dropping the large amount of cache for the entire suite, I think many people realized it would have been better to spend the month or so of man hours getting open source tool x, y, and z up and customized for bug tracking, requirements management, etc; rather than dropping tens of thousands of dollars and spending several months with Rational eating data and hoping the next emergency patch will fix our problems.

    I'm well aware of the difficulties in developing large scale software, and I'm not suprised---I've worked on software that was done similar things ;-). But I'd hoped that Rational was a beacon of excellence in an industry full of buggy crap. I guess that's too much to hope for right now. Maybe in another 30 years when "software engineering" has become a _real_ discipline...

    I was very impressed that the first edition of OOA&D had examples in CLOS, Smalltalk, C++, and Object Pascal (if I remember correctly). But I tend to think that when he publishes his next book it will be with examples in VBScript (probably on extending various MS Office products to interact with the Rational Suite, while alienating UNIX users).

    --
    Don't blame me, I get all my opinions from my Ouija board.
    1. Re:Booch's own company is hardly a poster child... by Anonymous+Brave+Guy · · Score: 3, Interesting

      Speaking as a professional software developer, I would have to agree. Rational Rose is the single most pathetic application I have ever seen, on a price vs. value evaluation. It is cumbersome to use and bug-ridden, it produces terrible output (all I want is a simple good-looking class diagram in UML; is that too much to ask?) and, most damning of all, it has manifestly failed to improve these flaws given years of time to do so. If this is an example of the benefits of Mr Booch's methodology, perhaps I'll stick to good ol' procedural programming after all.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    2. Re:Booch's own company is hardly a poster child... by Shimmer · · Score: 1

      I agree. Rational's software is mostly crap. That's why I do my UML modeling in Visio. Not that Visio is a dream, but it's certainly better than Rose.

      -- Brian

      --
      The most rabid believers in American Exceptionalism are the exact same people whose policies are destroying it.
    3. Re:Booch's own company is hardly a poster child... by sinserve · · Score: 1

      I did wonders with a white board, a marker, and Class Builder.

      --

    4. Re:Booch's own company is hardly a poster child... by Anonymous+Brave+Guy · · Score: 1

      Thanks for the tip about ClassBuilder. I've been looking for an alternative tool to draw decent UML diagrams for a long time, and you might just have shown me where to find it...

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    5. Re:Booch's own company is hardly a poster child... by Anonymous Coward · · Score: 1, Informative

      if you're into java, argoUML (gpl or bsd, iirc) is a decent tool. of course, it's written in java, so you better have a fair dinkum amount of physical ram on your workstation (at least 128, 256 would be better).

    6. Re:Booch's own company is hardly a poster child... by Anonymous Coward · · Score: 0

      Well in a sense you can't blame Rational for the fact that RR sucks since they didn't write it and they knew it was full of bugs when they pushed it out the door. I will admit that my knowledge about their development process (if you can call it that) is from years ago and concievably could have nothing to do with their current offering. I'll have to say that Rational was the most poorly managed company I've ever seen in the industry. They do seem to know what software companies to buy to expand their product line though.

    7. Re:Booch's own company is hardly a poster child... by EvlG · · Score: 2

      I second that. ClearCase is an awesome system. Of course, I don't know if it is worth the price, but I really like using it.

  3. Don't like it by marat · · Score: 1
    After a brief reading of an article (really tried to manage myself to read it through with no luck) it all left bad impression on me. First: exploiting of a name: OOP, AOP... Acronim does not make technology but attracts interest of suits fast. Yet another technology to make development less expensive (Power Users believe the ads for 4GLs and Application Generator packages, and think that in two weeks they'll be able to fire all their Real Programmers. (Ha ha ha... remember "The Last One"?) © The Power User's Guide to Power Users).

    Adding more keywords to Java (yes, Java programmers paid 20% better) without much reasoning (you can easily do the same things without new keywords). All ideas realized was sure met by language designers and was sure discarded for simplicity. Modulizing? Module structure cannot be defined by language itself unless language includes project management. Java don't.

    Publishing you work in popular journal instead of specialized magazine. Word's like "higher productivity, improved quality" instead of clear evolution of new ideas. I don't like it. Point.

    1. Re:Don't like it by shemnon · · Score: 5, Insightful

      I think you are missing what the paradigm suggessted in AOP is; it is a concept that is recognized in the OOP community as "Separation of Concerns." You can do separatin of concerns today if you can agree on a framework and are quite explicit about it. It is much like Object Orientecd Programming and late binding/polymorphism, you could do all of those things in the previous generation of languages without language syntax. Heck OOP is even done today in the GTK widget set.

      The difference is that when the concepts are supported in the languaes it is (a) orders of magnatude easier for the developer proficient in those skills to do it and (b) it allows for an order of magnitude more developers to grasp the concept and exploit it.

      Java's EJBs are a current example of doing separation of concerns (SOC) without language bindings, in fact it it explicit in the original specification. The business rule writer doesn't need to know how the deployer deploys the EJBs and they don't need to know if it is an Oracle Database or DB2 or an IPlanet directory server serving as the persistance for the objects. As long as they follow an establised set of rules, such as business rules don't create thread objects and the deployer respects and stores all of the data that it is told to store it works. Then the person writing the business rules doesn't need to know about load balanceing and clusering and the deployer deploying into the load-balanced and clustered environment doesn't need to know a rats ass about the business rules or any other parts of the workflow for that EJB. Thus the people who do procurement rules procure and the people who know scaleability scale. In fact, the only time that the business rule guy and the deployment guy would need to talk is at the company christmas party, and they don't even need to know who they are.

      Now we can look at how SOC is done in EJB and that is generally the same style OOP was done in C (not C++). There was a lot of infrastructure and practice that had to be followed that was not enforced or explcit, and the means of doing them were often different from project to project and even module to module within a project. When C++ came along it was much easier to establish how you denote inheretance for polymorphism and when a functon should be virtual and thus bound late. AOP languages like AspectJ are providing the means to provide for these "aspects" (I don't like the name either) much as C++ did for the OOP practicces. Making it more accessable and maintainable.

      I must a gree with Booch, AOP will be affecting the future of software development as dramatically as the OOP concepts did. And if one doesn't keep up come 2010 you will be maintaining old payroll programs on a low paying contract rather than leading or managing a team on new software development in AOP.

      --
      --Shemnon
    2. Re:Don't like it by jilles · · Score: 4, Interesting

      Hmm, you are fast with your judgement. Too fast and obviously you missed the point and didn't do your homework.

      AOP is not about Java but rather a total new way of modeling & programming (obviously the general idea was lost on you), it was just implemented on top of Java as a proof of concept. The people who implemented AspectJ (one of the handfull of aspect oriented languages), made sure that it works well, integrates nicely with the language.

      Indeed, AspectJ evolved from just a prototype language a few years ago to a production ready compiler and toolset. The very reason it was created was to allow for industrial validation of the ideas that are behind it. The inventor of AOP (Gregor Kiczalez), figured that in order to do so you needed more than just a prototype language.

      BTW. the journal side of things is taken care of by the ACM. They recently had a special issue of Communications of the ACM on AOP. Also nearly any conference on OO systems (e.g. Ecoop, OOPSLA, ICSE) in the past few years had papers on AOP issues (validation, language and compiler issues etc.).

      If you want to learn about AOP, look at the tutorial and language spec on aspectj.org. Also be sure to look at the examples they provide.

      --

      Jilles
    3. Re:Don't like it by ealar+dlanvuli · · Score: 1

      I don't get it?

      what you just described can be summarized in two buzzwords "Modularization" and "Encapsulation". Whats diffrent between an 'aspect' and an 'encapuslated method'? (I admit I haven't read the entire article yet, I will, I just came back to see if any comments could help me get through his buzzword soup)

      --
      I live in a giant bucket.
    4. Re:Don't like it by Tablizer · · Score: 2, Interesting

      (* Publishing you work in popular journal instead of specialized magazine. Word's like "higher productivity, improved quality" instead of clear evolution of new ideas. *)

      Those kind of claims tick me off also. Why don't they simply say that this is a new way to do/look-at things that deserves further exploration.

      To go barging around claiming that it will make everything cheaper-better-faster is disingenuine. It is waaaaaay premature for that. There are a lot of complex tradeoffs in software engineering. Improving one thing often can hamper others that promoters conveniently forget to mention/check.

      I don't mind experiments, as long as they are labeled as such.

      ______________________
      oop.ismad.com

    5. Re:Don't like it by angel'o'sphere · · Score: 2, Informative

      An aspect is a property of a set of classes or methods.

      Hu?

      The simplest aspect is a logging aspect:

      ,,on enter method``
      System.out.println(method.name() + " entered");

      ,,on exit method``
      System.out.println(method.name() + " left");

      Now say:

      ,,all classes in package foo use aspect enter method and exit method``

      A aspect weaver (somthing like an OO object code morpher) now injects the two aspects into all methods of the package foo.

      Aspect oriented programming is about "grasping" ideas, code fragments, which are smaler than methods but can be regular expressed (like a regular expression).

      Similar concerns are described in one aspect, its like a class consisting out of code fragments.

      Then you write your classes without repetitive enter/exit -- or other -- patterns in their methods.

      Finaly you weave classes and aspects together into an executeable.

      There is a somewhat similar new way of programing: subject oriented programming.

      See "hyperj" at ibm.aphaworks.com.

      Regards,
      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    6. Re:Don't like it by ahde · · Score: 2

      Those are old buzzwords. "Aspect" is a newer one

  4. I DONT INDESTAND TEH LANGUAGE DAT YUO SPAEK by whee · · Score: 1
    I've never seen more confusing syntax in my life (regarding this guy's AspectJ). This is worse than bf. It would've helped if the extra tokens like '*' were explained before use, but even then, none of this seems useful to me. This might add some functionality, but at the expense of actually being able to understand the code after the fact.

    The entire wildcard thing looks like it could really create some problems. Who knows what that will expand to? You certainly can't tell by glancing at the code.

    1. Re:I DONT INDESTAND TEH LANGUAGE DAT YUO SPAEK by JMemmert · · Score: 1

      I can understand the confusion at the language extensions AspectJ is introducing. I'm not overly fond of that either. If you have the time and inclination, it might be fruitful to look at Hyper/J from IBM's alpahworks. It is a similar technology, with a steeper learning curve but far more capabilities and a much cleaner structure.

  5. Disruptive by LarryRiedel · · Score: 3, Interesting

    I think "disruptive" in this case means it may be another chance for gurus to promote their software and training as a solution to the problem that customers are dissatisfied with the "quality" of software, and software development schedules are too difficult to predict and control.

    From "AOP" experts, I expect to see quite a few descriptions of obvious problems, and some hand waving "solutions", such as design/development "methodologies", "modeling languages", and "patterns", which are not as disruptive in the real world as they are in the academic papers and the product literature.

    1. Re:Disruptive by cooldev · · Score: 3, Insightful

      Yeah, where are all my mod points when I need them?

      I call these things Hype-Oriented Programming.

      OOP, AOP, Design Patterns, CASE tools, eXtreme Programming, yadda, yadda, yadda. The problem is they are usually valuable and make significant contributions to the body of knowledge in CS and software engineering, but even the successful ones (OOP) never live up to the hype.

      The solution is to stay informed and keep up with new ideas and techniques, but point your fingers and laugh at people who jump from trend to trend, often never getting around to producing anything!

      (The worse is eXtreme Programming, but don't get me started; don't even get me started.)

  6. I've got a great idea by PD · · Score: 2, Troll

    Let's break down parts of our problems in a functional way. Then, let's group our functions together into modules, so that functions in a module are related.

    Then, let's call it AOP and hope the old Modula-2 programmers don't notice.

    Can someone explain exactly what is new about AOP?

    1. Re:I've got a great idea by jilles · · Score: 5, Insightful

      Sure,

      You have your regular OO program. Only you don't do the usual thing of littering with duplicate functionality for e.g. synchronization, persistance, security. This kind of code is what makes your program complex and generally requires rigid design rules in order not to blow up in your face. What AOP does instead is separate this kind functionality from your OO program into what is called an aspect.

      Aspects consist of code and a pattern defining where this code is to be inserted in the OO program. This process is referred to as weaving.

      Take for example logging. All large projects need this. Imagine you could just write down: for all public set methods in package X Y and Z: prior to execution write the name of the method that is called to the log. In aspectJ you'd define this functionality in a few lines of code whereas in your average OO language you would need to edit each and every public set method. In addition if you'd add a new public set method somewhere you would need to add the functionality manually. You might forget, introduce bugs (well, maybe not in logging).

      Now logging is just the most simple example of an aspect. There are many more and the people at aspectj.org do a much job of explaining it than I can. So, go have a look with an open mind. Download the compiler, try the examples and use your imagination.

      --

      Jilles
    2. Re:I've got a great idea by ealar+dlanvuli · · Score: 1

      "Aspects consist of code and a pattern defining where this code is to be inserted in the OO program."

      that sounds like you end up with a very limited set of potential applications using AOP, either that or there is a very small set of 'patterns'? hmmm

      ok last post before reading, closing /. until I've done more research

      --
      I live in a giant bucket.
    3. Re:I've got a great idea by jilles · · Score: 2

      There's definately more to it, I was just trying to give you the general idea. You have stuff like inheritance between aspects, abstract aspects, mechanisms to get access to whatever the aspect code ends up being weaved with. The aspectJ language is full of very powerfull features.

      --

      Jilles
    4. Re:I've got a great idea by ealar+dlanvuli · · Score: 2, Interesting

      upon a bit more research, I'm convinced that this could be a usefull extension to OOP in alot of situations (mind you I'm still not 100% convinced that OOP is the 'one true way'). I don't think its the ends within the means that its made out to be in the articles though.

      I'm not entirley 100% convinced its really worth *that* much, every example he gave for OOP leading to bad design, well, was *bad design*; so I think I'll have to see a bit more realisitic comparison before I jump on the bandwagon.

      I think a better description would be Event Wraped Objects, it seems more realisitic (though perhaps less easy to market).

      Anyway, this is an interesting peice of trivia to have, I don't think its a end of the world type upgrade, but if it does catch on it should take alot less time to beat into my head than OOP did, considering all it appears to be is event wrappers for program actions.

      --
      I live in a giant bucket.
    5. Re:I've got a great idea by Gregor+Kiczales · · Score: 1


      Let me just comment on the basic motivation and goals of AOP. For more background I would refer people to the Aspectj.org website. You can also check aosd.net, where you will find the proceedings of more than ten workshops on AOP, and the larger goals of AOSD (aspect-oriented software development).

      The basic goal has to do with separation of concerns at the design and code levels. Or, put another way, making the code look like the design. We all know how it feels to write good clean OO code. Each class represents a single tight concept, the methods within the class are similarly clear. The code is easy to understand and maintain.

      We also know what it feels like to write messy, un-modular code. Things are scattered around, and its hard to change some things because they are not "in one place".

      The idea behind AOP is that

      -no matter how good your object (class) structure is,
      -in decent size programs,
      -there will be some design structures (concerns) that will be scattered around,
      -because they naturally crosscut the class structure

      (The idea is actually more general than OO, but I'm giving the more specific OO form of it here.)

      AOP addresses that problem by providing constructs that explicitly support crosscutting structure in code. These constructs make it possible to say in one place things that would otherwise be spread around.

      There's a nice example of this in the CACM paper, the ECOOP paper, and on aspectj.org. But let me repeat it briefly here.

      Suppose you have a figures package, including Point, Line and other classes. Suppose you want to update the display whenever a figure moves. In straight Java, you would add a line like this to the end of any method that moves the objects:

      Display.needsRepaint();

      In AspectJ, we can write this in one place as something like:

      aspect DisplayUpdating {
      pointcut move():
      call(void Point.setX(int)) ||
      call(void Point.setY(int)) ||
      call(void Line.setP1(Point)) ||
      call(void Line.setP2(Point));

      after() returning: move() {
      Display.needsRepaint();
      }
      }

      The key point being that the move declaration names "any time a figure
      element moves", even though the code that does that is scattered
      across two classes. We can say other kinds of things as well,
      consider for example:

      aspect PublicErrorLogging {
      Log log = new Log();

      pointcut publicCall():
      call(public * com.xerox..*.*(..));

      after() throwing (Error e): publicCall() {
      log.write(e);
      }
      }

      This says that whenever any public method in the com.xerox package returns throwing an Error, we should log the error.

      I won't say more now. But I will note that there is something new here, even though it is based on bits and pieces of old ideas. You can't implement concerns like this with this degree of locality in straight Java. (Or CLOS for that matter!)

    6. Re:I've got a great idea by PD · · Score: 2

      Thanks for the specific examples with code, they help immensely. But one question... You described how to specify the action, such as a logging action that happens on every method in a class.

      Does the code that causes a class to utilize an aspect look something like this?

      class foo using aspect PublicErrorLogging {

      /* some methods here, all of which will be logged if they are called */

      }

      Thanks. Your comment has cleared the subject up immensely. I have found that a lot of new technologies are surrounded by a lot of fuzzy, impenetrable management speak. Just take a look at .NET - nobody can figure out what the hell it is. I am but a simple programmer, and your examples have definitely shown me that aspects are going to be an important thing in future languages.

    7. Re:I've got a great idea by axlrosen · · Score: 1

      In my very limited reading about AOP, it always sounded like something that was very useful in a very limited set of circumstances, but not nearly as general as OOP. The classic AOP example is logging, which it seems very useful for, but this ubiquitous example made it seem like a one-trick pony.

      In this thread, someone else mentioned synchronization, persistance, and security. I'd have to learn more about how AOP is useful in these areas, but they do seem to cut across member boundaries, so I can understand how they'd make good targets. Your needsRepaint() example is another interesting one. (As a side question, would this fall apart if repaints weren't batched? I.e. if I changed an object's x and y and width and height, would that cause 4 screen repaints? Any way around this?)

      So it seems like AOP is meant to solve the problem of "whenever we do X, we're going to have to remember to also do Y," where Y could be check security permissions, repaint, write to a log file, etc. Right? Can you suggest some example uses other than the ones already mentioned? I think this would help AOP overcome the one-trick-pony label in my mind.

  7. lets play a game by ealar+dlanvuli · · Score: 1

    spot the buzzwords and impacts and marketing hype: starting with part 1

    software systems, concerns, crosscut, Object-oriented, concerns, invasive to implement, tough to understand, difficult to evolve, aspect-oriented programming (AOP), of crosscutting concerns, facilitates modularization, crosscutting concerns, easier to design, easier to understand, easier to maintain, higher productivity, improved quality, better ability to implement newer features

    (done paragraph 1... this isn't looking promising)

    "goal, concept, or area of interest" (to be fair that was a definition), core concern, system-level concerns, "transaction integrity, authentication, security, performance" (only because they were placed there to impress PHB's), crosscutting concerns, implementation modules, "systems that are harder to design, understand, implement, and evolve."

    (end paragrph 2, slightly better, only half the words were buzzwords...)

    separates concerns, modularization of crosscutting concerns.

    ok, I think you have goten the point by now, attempting to finish the document.

    If anyone knows something non-buzzwordish that has to do with AOP can you please post it? Since it appears to have stemed from Java and was never part of academia (a fact that kinda scares me), real factual sources are a bit lacking from google searches.

    --
    I live in a giant bucket.
    1. Re:lets play a game by Anonymous Coward · · Score: 0

      >>was never part of academia (a fact that kinda scares me), real factual sources are a bit lacking from google searches.

      Actually, the roots of AOP are in the academic world. Search for topics such as Adapative Programming, Composition Filters, and Multi-Dimensional Seperation of concerns.

    2. Re:lets play a game by greenrd · · Score: 2
      Since it appears to have stemed from Java and was never part of academia

      Wrong wrong wrong. It did not stem from Java and the term was coined by Gregor Kiczales, who is a professor at the University of British Colombia. Arguably the first AOP system, composition filters, was invented at the University of Twente. There have been dozens of papers published by various groups from around the world, a bunch of AOP workshops and conferences, and there has been a Communications of the ACM Special Issue on Aspect-Oriented Programming. See aosd.net for links to conferences and papers.

      --
      Robin (who is doing his PhD on aspect-oriented programming and object databases, and will post more later).

  8. grammer nazi... by Anonymous Coward · · Score: 0

    dropping the large amount of cache for the entire suite

    I assume you meant cash

  9. long time listener, first time caller by Anonymous Coward · · Score: 0

    Quack, Quack

  10. AOP is a reinvention of multi-dispatch functions. by cpeterso · · Score: 1, Flamebait

    From what I've read of "Aspect Oriented Programming", it is just a reinvention of multi-dispatch methods or a language-level support for the Visitor OO design pattern. With multi-dispatch in a language like Lisp/CLOS, a single function call can (optionally) implicitly call your logging function, a monitor synchronization function, a security check function, etc.. before or after calling the "real" function.

    Funny how so many new programming fads are simply reinventions of old Lisp features because the new programming environments (like C++ or Java) need clumsy workarounds.

  11. Any better articles? by brenfern · · Score: 1

    It looks worth a second look, but are there any articles which explain the concept in a more clear and objective manner? I have been to the aspectj site, parc/aop and aosd sites, to no avail - the articles seem a little more intent on selling the concepts rather than explaining them.

    I dunno, but my mental buzzword filter kicks in reading articles like this. Or perhaps I am getting slow in my old age...

    My main worry these days with new technologies is that many organisations and developers use them for namesake rather than practicality - they create a vicious circle where the job market becomes disproportionately biased in favour of technologies that are used less often but considered to be "important". EJB & XML spring to mind here - not that they are necessarily bad technologies, just that they are often over-applied just as a point-scoring exercise. And in many companies (not mine), employees are effectively rewarded for spending their time at work reading up on new technologies so that they can b.s. about them... generally leading to a bad work ethic centred around buzzwords rather than objectivity. Not that it bothers me, they are welcome to their inefficiency!

    So, any links to more informative sites would be helpful, particularly one describing how it can improve productivity, quality, decrease development costs, or indeed, if it does not and why.... so far I am curious but unimpressed!

    1. Re:Any better articles? by Anonymous Coward · · Score: 0

      AspectJ lets you define chunks of code, plus places where the code should go ("beginning of Foo constructors", "end of any 'set' method"). It then compiles plain Java source files into plain Java source files with the chunks of code inserted into the right places. Changing the original chunk propagates the change to all the occurances in the code. If you look at the original AOP stuff, it's all about pulling out boilerplate code (database initialization; tracing calls) and moving it into a single Thing To Modify. It's usefull in the same way that exceptions are useful (pulling error handling out and making it distinct).

      Of course, AspectJ means that you simply *cannot* guarantee the validity of a method until you have checked it against every single Aspect defined for your program.

    2. Re:Any better articles? by quintessent · · Score: 2

      Yeah, I think they might have more success if they could describe this is simple language.

      Here's what I get from it, translated into English, and sprinkled with some object-oriented terms.

      Start with some Java code. This thing lets you search through the classes for method calls. For example, you could search for methods whose name begins with "Draw". Using these tools, I can attach event handlers to every call to these methods. My event handlers can run before and after each method call.

      An "Aspect" is like a class, except it has really confusing syntax. The Aspect tells the compiler which methods to look for and what events to attach to them. Besides methods, it can also look for things like constructors or property setters.

      An "Aspect" can do some nifty things. For example, if a class B inherits from C, it tweak it so B inherits from D instead. Also, it can add things (methods, variables, etc.) to a class or interface. Or it could change what kind of exception a method throws.

      Then he talks about a few more advanced things, like how many instances of an "Aspect" I create. It could be static so only one instance exists, or I could make a new instance for every method I attach to. Or something in between. Also, an "Aspect" can show warnings and errors at compile-time.

    3. Re:Any better articles? by Anonymous Coward · · Score: 0

      There is a chapter in this book below that explains aspects as well as any I have seen. There is also a version of the chapter available on the web somewhere (sorry I don't have the link)

      K. Czarnecki, U. Eisenecker, Generative Programming: Methods, Tools, and Applications, Boston, MA, Addison-Wesley, 2000

    4. Re:Any better articles? by Anonymous Coward · · Score: 0

      Well, for a little more hands-on exploration of AspectJ:

      http://www-106.ibm.com/developerworks/java/libra ry /j-aspectj/index.html?dwzone=java

      OK, I wrote it :)

      ndlesiecki@apache.org

  12. re: wildcards by Tablizer · · Score: 1

    (* The entire wildcard thing looks like it could really create some problems. Who knows what that will expand to? You certainly can't tell by glancing at the code. *)

    I imagine that it will end up like most of "one command does magic" coding ideas: the granularity is too large and there are too many exceptions to the rule to make it work in the real world.

    Now:

    *

    2004:

    * {unless x < 5}

    2008:

    * {unless case:
    a: bar < 5 and foo
    b: * > 9
    c: * in (u,v,w)
    }

    2012:

    * {unless class foo
    method a {......}
    method b {......}
    method c {......}
    }

    Etc....

    Gee, I don't sound too skeptical, do I?

  13. Event system with makeup? by abdulla · · Score: 2, Interesting

    Maybe they should call it Event Orientated Programming, sound more like functions can capture events and execute on the context of the event. You could hook this in to C++ (tho not very cleanly), but it sounds sort of similar to what QT's moc does to QT C++ code.

  14. But... by einhverfr · · Score: 2

    Good application design is good application design is good application design...

    What he states as separation of concerns is good and all, but misses an important point-- clever modularization or a program and good design allow reasonable separation of concerns while still allowing the developer flexibility in how each module handles those concerns.

    I don't like his description of AOP because I think that it takes good design principles too far and makes them inflexible. My experience with large applications has taught me that reusable code for common functions is very important, but so is control on how those functions are implimented in every case.

    (And no, I am not generally an OO fan either because I think that in most instances, it makes the application more difficult to impliment, but there are HUGE exceptions to this, and I use it where I see fit. I often use proceedural programming on my core engines, structural programming where the data complexity becomes slightly higher, and OO when an abstract interface actually allows me to impliment extremely complex object models.)

    --

    LedgerSMB: Open source Accounting/ERP
  15. MSDN has an article on AOP, as well by diegoq · · Score: 2, Informative

    For those of you not employed in Java-land,
    this month's MSDN has an article
    about AOP as applicable to COM/COM+/.NET.

    --
    --Tim
    1. Re:MSDN has an article on AOP, as well by JKR · · Score: 1

      Thanks for the link. That is an excellent article.

      Jon.

  16. Re:AOP is a reinvention of multi-dispatch function by Anonymous Coward · · Score: 0

    Even more interesting that, even though every imaginable language feature already exists in LISP people are constantly implementing them in other languages.

    Perhaps it's because the other languages have a syntax that makes sense to normal humans?

  17. Re:AOP is a reinvention of multi-dispatch function by Anonymous Coward · · Score: 0

    It's a bit more sophisticated than that. The AspectJ compiler does whole-program analysis to insert the cross-cutting code, which would be much more difficult in CLOS. It also inserts the code at more places than :before :after and :around various functions.

  18. Maybe I dont get it yet by gorehog · · Score: 1

    It seems to me that the examples given could be addressed by creating appropriate libraries or classes.

    With AOP you dont write the network optimization into every module, the computer does it for you. You just create a line of code that says "apply the network traffic optimization to all of the objects." While it is transparent to the programmer the develoment tool does in fact add the code then compiles it.

    This is just one example. Can anyone confirm/deny this? If this is right I can see how it would save time and reduce confusion, making it very useful but it sounds like a lot of excitement over a small improvement to OOP. More like OOP++ than a new methodology.

    Let me restate so folks can adress my comments properly

    1)AOP seems not to change the final product before compilation. It does add a step before compile time, which is called weaving. Weaving seems to add required code to ensure that all aspects of each object are addressed properly.

    2)AOP simplifies design and coding by placing the calls to the appropriate procedures or methods in the called procedure or method
    ***EXAMPLE*** (please excuse my pseudocode, my pascal is showing)
    FUNCTION validate_input
    {
    ADD_THIS_FUNCTION_TO (object1,object2,object3);
    //code for validating input goes here
    }

    FUNCTION object1
    {//gets numbers}

    FUNCTION object2
    {//gets strings}

    FUNCTION object3
    {//gets passwords}

    My understanding is that before going to the compiler AOP would process the code and weave in the FUNCTION validate_input simply by adding the code in the right places in oblect1, object2, and object3. a)Am I right? b)if not (if, for instance, aspectJ does something different which is more customized to AOP) would this have a similar effect?

    While this example is truncated and perhaps illegible I would appreciate any feedback as to whether or not it is on the right track.

    More food for the mill.

    1. Re:Maybe I dont get it yet by jilles · · Score: 3, Informative

      The confusing thing about AspectJ is that it is really not Java but rather a different language that happens to share a lot of the syntax and is able to compile to bytecode (just like e.g. Jython).

      Currently the compiler merely does some preprocessing and then uses the Java compiler but the long term plans are to create a separate, incremental compiler (to improve performance on large projects).

      It is also worth pointing out that there's a difference between AOP and AspectJ. AspectJ is one of the many aspect oriented languages. Other examples include IBM's HyperJ and Karl Lieberherr's Demeter Java (do a search on google if you are interested).

      AspecJ happens to do most of the weaving statically but this it could just as well do it at run-time. The only problem with that is that this would affect performance since you need to do all sorts of reflective stuff in order to make it work.

      The best way of describing what AOP does is to think of your OO system as a graph of objects calling each other. Aspects insert functionality on the paths in this graph that augment e.g. return values or exceptions or introduce new data.

      You could for instance insert an aspect that would simply count all accesses of public methods (not particularly useful but the point is that you can). In order to that you would need a static aspect (i.e. all insertion points get the same aspect instance) with an integer and some increment functionality. In addition you would write a pointcut (i.e. a pattern identifying insertion points in the graph) that gives you all the public methods. The AspectJ compiler does the rest.

      The whole point of AOP is that counting the public method accesses is a concern that is different from the other functionality in your program. More importantly, in a regular OO program it is a crosscutting concern since you would need to insert functionality in each public method to make it work.

      By making it an aspect you separate the concern from the other concerns that your program addresses. Should you for example discover that you would need a long rather than an int, you only have to update the aspect rather than each public method in your program.

      Well designed OO programs also exhibit some separation of concerns. Typically you will find stuff like design patterns being used to do so. The price you pay is a more complex design. AOP potentially offers you a cleaner and easier to maintain solution than design patterns. However case studies will need to proof this (this is the primary motivation for creating AspectJ).

      --

      Jilles
    2. Re:Maybe I dont get it yet by JMemmert · · Score: 1
      The confusing thing about AspectJ is that it is really not Java but rather a different language that happens to share a lot of the syntax and is able to compile to bytecode (just like e.g. Jython).

      I totally concur with that and would like to add a few sentences here.
      Regardless of whether you like it or not, it is, imho, not anywhere near correct to talk about Java and AspectJ in one sentence. Of course, AspectJ applies aspects to Java code and generates code that is written in Java, but the basic capability to write in AspectJ requires the user to learn completely new structures which look like a language extension, but when you look at the way i.e. the pointcuts are defined, it's a new language.
      Regardless of whether that is good or not, I think it needs to be understood.

      It is also worth pointing out that there's a difference between AOP and AspectJ. AspectJ is one of the many aspect oriented languages. Other examples include IBM's HyperJ and Karl Lieberherr's Demeter Java (do a search on google if you are interested).

      Thank you for pointing that out. it's a fact often forgotten. The term for all these technologies which is now widely used is AOSD (the Hyper/J people used MDSOC, for Multi-dimensional deparation of concerns).

      Well designed OO programs also exhibit some separation of concerns. Typically you will find stuff like design patterns being used to do so.

      I would like to add to that as well. Peri Tarr et al. have named that the "Tyranny of the dominant decomposition". That means that for every given module of software, you have one major decomposition, by class.
      If you have accounting software, you have a class called "Account" and a class "transferal". There is, normally, no class first class entity which encalsulates the UI for the "Account" class, or its logging or any of the other tasks the "Account" class has to perform in addition to being the representation of an account.
      That brings us to your next paragraph...

      The price you pay is a more complex design.

      The trouble with normal OO design is that, no matter how dilligent you design, how much patterns you use, how many factories and facade objects you use, there still remain concerns which have not been encapsulated or new concerns will be added which have not been anticipated.
      These concerns become cross-cutting concerns which can not be implemented completely in one separate artifact.
      That's the moment your application starts to get difficult to maintain and evolve.

      AOP potentially offers you a cleaner and easier to maintain solution than design patterns.

      Imho, AOSD is an addition to patterns. There are patterns which can be removed through use of AOSD technologies (see http://www.research.ibm.com/sop/sopcpats.htm for examples).

      I hope that did add some informative tidbits...

  19. Re:AOP is a reinvention of multi-dispatch function by jilles · · Score: 5, Informative

    and unsurprisingly the inventor of AOP (Gregor Kiczalez) also wrote a book on the meta object protocol (meta programming in CLOS). It's funny how people try to dismiss stuff by comparing it to stuff they do know. Aspects are of course easy to implement in Lisp (just as most other language features we know). The original, quite interesting, paper on AOP at Ecoop '97 even used CLOS for the examples. Lisp is a very powerfull language, however it is also very hard to use.

    Kiczalez realized that if he'd stick to lisp, AOP would never work because ordinary C++/Java programmers would never be able to understand it (just like they never grasped meta programming, reflection and whole bunch of other advanced language concepts). Hence he made an implementation of AOP based on Java. One of the design goals was interoperability with Java so that the transition would be as easy as possible.

    Now the difference between the visitor pattern and AOP is that the visitor pattern affects the design of your program (i.e. the places where visitors are used must explicitly call a visitor) whereas the usage of aspects is transparent.

    --

    Jilles
  20. Why I don't like AOP by toughguy · · Score: 1

    Hi,

    I'm by no means an expert at AOP, I've never used it, only read about it. But from what I understand I don't think it's that great.

    AOP seems most similar to the OOP approach of 'composition', that is, creating larger, more feature-full objects out of smaller sets of objects. I don't see any other fundamental difference between AOP and composition. If there is please enlighten me.

    The problem I have with AOP (and regular OOP Composition doesn't fare much better in this regard) is that designing a system with a number of small distinct components seems like a good idea. It still seems like a good idea when you use composition to create larger objects with more functionality out of the smaller pieces. The point where AOP breaks down is when you want to use the AOP objects in some even larger AOP creation. The point when software development gets to this stage is usually well into the implementation and maybe after it is in production. At this point it seems to me like you're back to dealing with all the original problems that AOP was meant to help with (spaghetti-like code being the most significant).

    Is there really more to AOP than what I've been able to deduce?

    1. Re:Why I don't like AOP by greenrd · · Score: 1
      At this point it seems to me like you're back to dealing with all the original problems that AOP was meant to help with (spaghetti-like code being the most significant).

      Well, there is no panacea. If you have spaghetti code, you need to refactor, and AOP can help untangle code which talks about a lot of different concerns (more so than OOP can). If you can't refactor (because you're using third-party fixed APIs, or because it would be too expensive), tough.

    2. Re:Why I don't like AOP by JMemmert · · Score: 1

      Maybe I can add something here... I've been working with AOSD technologies, namely Hyper/J (the competitor to AspectJ) for two years. While it is imho true that AspectJ has a problem when you get to larger and larger compositions, the good thing about AOSD approaches (though not neccessarily of AspectJ, but I don't want to start a religious discussion here) is that the components you weave together, regardless of how large they become, remain distinctly apart. That way, the impact of chage is clearly limited. What AOSD technologies like AspectJ or Hyper/J do is to merge together these distinct aspects. The result looks ugly as hell and should not be considered of any use. The catch is to keep writing aspects if you have to change the component, not change the merged code. (And if you're calling the component from the outside, you should not care about the internals anyway.) So, as long as you don't make a transition from aspects (or concerns) back to normal OO methodology within the same class / component after you've weaved things together, the code of each aspect / concerns remains clean and concise. I hope that helped a bit... but I am really no AOP expert (when you consider AOP = AspectJ. Hyper/J handles things differently).

  21. AspectJ violates locality guarantees by RelentlessWeevilHowl · · Score: 3, Interesting

    With stock Java, you can inspect a particular method and know almost exactly what it does. It's a lot of work; you have to examine:

    • the instructions inside the method
    • the arguments to the method
    • the instance variables and the methods of the containing class
    • the instance variables and methods of the parent classes
    • the contracts of any classes you have to be using
    It's annoying to do but the lexical structure of the language makes it clear where you have to look. The only exception is when derived classes override methods in the class you're examining. (And this is a problem with every class-based OO language out there.) If the method is "abstract", though, at least you have some indication to look elsewhere.

    AspectJ messes this up badly, because you can no longer tell what's going on by tracing code. To understand the behavior of a method, you have to do everything you did before, plus know and understand every single Aspect defined for your program, since any of them may change any of:

    • The behavior at the beginning or end of your method
    • The behavior at any function call in your method
    • The parent of the class
    Aspect weaving is useful---it makes up for some of the lack of power of Java---but if Grady Booch's hype machine is successful, he'll sell a lot of books, people will use a lot of Aspects, and no one will be able to tell what is going on in their programs.
    1. Re:AspectJ violates locality guarantees by Anonymous Coward · · Score: 0

      One thing that's alwasy bothered me - why don't IDEs for languages with inheritance have a "show through" editing system, where inherited methods show through in the subclasses source, grayed-out?
      About 70% of my difficulty with inheritance is having to have the chain of superclasses open in loads of windows - since inheritance is basically composition + type unification, why not SHOW ME THAT in my source editing window ????

    2. Re:AspectJ violates locality guarantees by peter+greaves · · Score: 1

      can you suggest a way to overcome this problem thru abstraction? seems to me that if we can still get some value out of an aspect approach without heresy, that is still a better world?

      --
      The tigers of wrath are wiser than the horses of instruction, but they eat more steak.
    3. Re:AspectJ violates locality guarantees by Anonymous Coward · · Score: 0

      The same is more true of interceptors, which are widely adopted. But AspectJ advice is more transparent than interceptors since (a) you can in fact trace it all, including the advice, and (b) you can use the tools to navigate to any advice on a method when you are asking the question of what the method does. Plus, advice is only part of the modularity story.

      But that really misses the point: if you need to know about advice when understanding the method, then someone is putting code in advice when they should be putting it into the method. But if you're worried about the advice concern not being implemented at runtime, you can trace the concern and all the methods it advices - which is easier than checking that each method in fact invokes the correct security API. So I agree that transparency ("understandable", in Bertrand Meyer's phrasing) is a key determinant of modularity that AOP must meet, but I don't agree that AspectJ reduces transparency, unless programmers write piss-poor code.

      As for the hype machine, AspectJ is free, paid for by DARPA) and it does things you have to pay for now. What more can you ask?

    4. Re:AspectJ violates locality guarantees by RelentlessWeevilHowl · · Score: 1

      Let's call the original functionality F, the guard functionality G and the sum functionality H.

      The most common approach has always been to take F and bury it under an API. You can then mix G throughout, without any other code being aware. Any changes to the guarded code are thus localized and easier to modify, but the up-front effort can be annoying.

      The standard idiom for functional languages is to make G a function that takes a function as an argument. Calling H passes F to G. G does the setup work, calls F, does teardown work and returns F's value. Scheme's call-with-input-file is a good example of this. The changes necessary to turn F into H are smaller, and F and G are much more cleanly separated. And it's clear what's going on in the code.

      I think the best way of approaching Aspects is to compare them to operator overloading: if you're programming in a domain where it's a natural technique, it's wonderful (that was my experience doing 3-D graphics in C++); if you're using it for averything else, you're probably going to confuse the next person looking at your code. I think Aspects are a natural technique for any sort of instrumenting.

      It would be amusing to survey the AOP/AspectJ boosters on what they think of operator overloading.

    5. Re:AspectJ violates locality guarantees by Anonymous Coward · · Score: 0
      I don't agree that AspectJ reduces transparency, unless programmers write piss-poor code.

      Of course the problem is that 99% of programmers write piss-poor code.

    6. Re:AspectJ violates locality guarantees by EvlG · · Score: 2

      That's an excellent idea, but making the editor do syntax analysis to pick out the functions and merge them together is probably CPU prohibitive.

      But that is just my guess.

  22. Re: wildcards by Anonymous Coward · · Score: 0

    Well thats a funny post. Guess noone reads this deep into a thread. I can see where you're coming from but even just OOP techniques degenerate into a mess of spaghetti in the real world. Every new programmer comes along and looks at the code they've been asked to fix and goes "this is shit!". What you want is a programmer who will fix it with the minimum of disruption (rather than spending 1 month rewriting it for his clarity, when two months later another programmer comes along and goes "this is shit!", repeating ad infinitum). The only things problems you don't get spaghetti in are small ones.

  23. Re: wildcards by Tablizer · · Score: 1
    Well thats a funny post. Guess noone reads this deep into a thread. I can see where you're coming from but even just OOP techniques degenerate into a mess of spaghetti in the real world. Every new programmer comes along and looks at the code they've been asked to fix and goes "this is shit!". What you want is a programmer who will fix it with the minimum of disruption (rather than spending 1 month rewriting it for his clarity, when two months later another programmer comes along and goes "this is shit!", repeating ad infinitum). The only things problems you don't get spaghetti in are small ones.

    Assuming I was not overrushed or outvoted in my technique, I find my code far easier to read than other people's code down the road. That is because I know how I think.

    Software Engineering is *mostly* about psychology, and not math nor machines nor magic paradigms.

  24. WTF is AOP? by Anonymous Coward · · Score: 0
    And what is an "aspect" in this context?

    If someone can give me clear one-sentence answers to the above two questions, maybe there is something to AOP.

  25. Re:AOP is a reinvention of multi-dispatch function by Anonymous Coward · · Score: 0

    And then Java 2 introduced (kludged in) extensive reflection support to support Java Beans, so Java programmers started to have to understand it.

    Basically, in 10 years time, the Java/.net community will have reinvented lisp, but with insane syntax. Just like Perl has already become a lisp-with-insane-syntax...

    So Java is a big plot to slowly wean people to Lisp ???

  26. Re:sigh. by Anonymous Coward · · Score: 0

    The above may be presented in a trollish fashion, but it's true. Aspect-oriented programming is a proper subset of programming in Lisp (in fact, the original aspect-oriented stuff used the power of CLOS's MOP to work)

    All AOP is is bringing to Java something that Lispers had years ago, and doing so in as hypey a way as possible.

  27. First read so what, 2nd read - maybe... by peter+greaves · · Score: 1

    first time i read the article i thought - dontcha identify yr concerns when you do your use case analysis and see the verb "log" cropping up and then factor out all that function into a class responsible for logging? IWC, i did not really see the value. then when i re-read and looked at the code examples i thought - if you develop for concerns, maybe there is more extensibility in the source because it is concern-aware? would that give you more refactoring elbow-room during the lifetime of the system?

    --
    The tigers of wrath are wiser than the horses of instruction, but they eat more steak.
  28. Re:AOP is a reinvention of multi-dispatch function by jilles · · Score: 2

    I consider neither language to be ideal. However, I am pleased to see powerfull language features gaining acceptance among ordinary programmers (few of which ever use lisp). One of the reasons Java is so popular is that it provides some interesting features and is simple to use at the same time.

    Syntax easthetics is of course matter of taste but many would argue lisp is quite insane with all its parenthesis. The Java language was cleverly designed to look like C++ and be as clean as Pascal. Perl on the other hand evolved from a simple scripting language to an everything and the kitchen sink language. During its evolution nobody bothered to pay attention to the syntax (other than to stay as close to the more or less quick & dirty syntax of the earlier versions of perl).

    I would say that being able to do something in lisp and practice of doing something in a certain way in lisp are two different things. AOP can be implemented rather easily on top of lisp but I don't know of many projects where lisp was used in an AOP style of programming.

    --

    Jilles
  29. but maybe Re:I've got a great idea by peter+greaves · · Score: 1

    the AOP thing is a good design solution for a highly decoupled kind-of miasma of objects when nothing happens and then events do? where there is less of a logical use-case type of path, and state is more critical than state transitions.

    but then, if you had that sort of a system, there are a number of patterns that would do most of what you want - does AOP look like the retrofitting an event paradigm onto a more workflow type collaboration of objects?

    --
    The tigers of wrath are wiser than the horses of instruction, but they eat more steak.
  30. Re:AOP is a reinvention of multi-dispatch function by Anonymous Coward · · Score: 0

    I agree it would be more difficult within CLOS, but CLOS is only a subsystem of Common Lisp. A few macros would be a much better (and ridiculuously easy) way to write an aspect-oriented system.

  31. Re:AOP is a reinvention of multi-dispatch function by Gregor+Kiczales · · Score: 1

    I would very much like to see how you do this with Common Lisp macros.

  32. This has to be a joke, right ? by SimonK · · Score: 2

    A very long time ago, someone suggested a programming construct called "COMEFROM" that allowed you to declare you code to be called from somewhere else, regardless of whether the caller wanted to or not. That was a joke. Obviously no sane person would suggest being able to write code that gave you no clue what other code was being invoked, right ?

    Well, apparently, this is exactly what a supposed expert on design is now suggesting. Code that executes on arbitrary conditions. Stuff that executes before and after your methods that changes their results. I can only conclude, given that Booch is clearly not joking, that this is a conspiracy to lower the quality of software and thereby drive more poor benighted, deluded souls into the arms of the Ration Unified Straightjacket and mechanistic OO design methodologies.

  33. Which is all well and good by SimonK · · Score: 2

    I can see the goal. However the proposed mechanism is basically ghastly. It allows you to stick extra bits of invisible code in all over the place that get executed without anyone even realising they're there. Its a similar problem to operator overloading, or C#/Delphi's property mechanisms, only much, much worse.

    To make it work better, something has to be done to reduce the power of the mechanism. Say, preventing the "apsects" from having any having any side-effects that affect the code that triggers them.

  34. Aspect-Oriented Software Development by Anonymous Coward · · Score: 0

    AOP and AOSD (Aspect-Oriented Software Development) is about explicitly addressing crosscutting concerns ("aspects") during the development cycle. In other words, and along the lines of Object-Orientation is more than just programming.

    A concern is term crosscutting if it cannot be well localized, i.e. if it cannot fit into a single modular unit. Examples of crosscutting concerns include synchronization, scheduling, fault tolerance, error handling, etc.

    Please do not forget that AspectJ is merely one of the several available technologies, and one that addresses aspects (crosscuting concerns) using a linguistic approach. Other approaches include reflective techniques, and aspect-oriented frameworks, and combinations of the above. You may take a look at http://aosd.net as a starting point.

    I will try to address some of the criticisms about the article as well as some other misconceptions:

    Obscure syntax of AspectJ: This has nothing to do with AOSD as a concept, but with the particular technology. There are plenty of other languages, including AspectC++, as well as a lot of domain specific aspect languages. In other words, there is and there should be a difference between a criticism on AOP and a criticism on the AspectJ language.

    Gregor Kiczales and Xerox: Gregor is not the inventor of AOP. The inventor of AOP is Cristina Lopes with her PhD thesis (Northeastern University, 1997). Gregor was Cristina's second advisor as at the time she was an intern at Xerox. Cristina' advisor was Karl Lieberher the director of the Demeter project at NEU and the main investigator of Adaptive Programming. Cristina built two domain specific languages (one for synchronization, and one for coordination) to be used in distributed programming. The motivation for the invention of AOP (AOSD) is a family of well-known problems associated with conflicts between synchronization and reuse known as "inheritance anomalies". A large number of research proposals have addressed this problem, separating synchronization from the main functionality, but leaving it in the same class (e.g. ESP). Cristina was the first to propose a complete separation for a higher level of reuse and the provision of adaptability. Since then there have been a large number of AOSD proposals using different technologies.

    AOP can be done with libraries. You are missing the point of separation of concerns. With libraries you indeed achieve reusability of code but you cannot avoid what is termed "code tangling".

    AOP to replace OOP. This is simply not true. In fact, AOP is not bound to OOP, and there are plenty of papers and research work in AOSD and functional or logical, even procedural programming. One example is AspectC (University of British Columbia, principal investigator is Yvonne Coady) that addresses (operating) system design.

    To conclude, OOP has done and it still does a great job. However, for certain problem domains and in complex systems (e.g. concurrent and distributed systems) AOSD can be used in conjunction with OOP to address the *remaining* tangling of code (concerns).

    If you want to learn about the principles of AOSD, the JavaWorld article does not provide a good introductory treatment in my opinion. I have been doing research in this area since if first appeared (1997) and I didn't like the article but then again this may also be a matter of approach to introducing the main idea. A better treatment that talks about the concepts and about the major technologies (including AspectJ) would be "Generative Programming; Methods, Tools and Applications" by K. Czarnecki and U. Eisenecker (Chapter 8: Aspect oriented programming). Please bear in mind that the book was written in 1998 and the technologies have evolved since then but the main idea is the same.