Fog Creek Software
Discussion Board




Aspect-oriented programming

Is anyone exploring aspect oriented programming? 

As far as I understand it, this style is built upon OOP, and it diverges in that it lets you define methods of objects in more "sensible" places than just a single class file.  For example, the security methods for a bunch of related objects can be defined in SecurtyAspect.java.  When an object is created, the compiler checks that file for any methods that may have been defined for that  object.

That is purely my understanding; I don't think peoples' thoughts have stabilized enough to explain the concept well, so I could be wrong. 

So, are people like Booch right and it's the Next Big Buzzword of programming?

[ http://www.google.com/search?hl=en&q=aspect+oriented+programming ]

Sammy
Saturday, March 02, 2002

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.

Banana Fred
Saturday, March 02, 2002

It goes like this: OOP was supposed to solve most programming and maintenance problems easily. It didn't; it made some things easier, some things harder - but most importantly, it created an industry of design gurus and design tools. Now that OOP has more or less been mastered by the general public, this industry needs something else to feed on.

Granted, AOP may be the trend of the future - but as was pointed out earlier, it is nothing new. CLOS and other Lisps had it ages ago, and even Python does in many respects through it's metaclass mechanism.

AOP is a new TLA, not a new concept. However, it's a concept that hasn't been commercially used to create income so far - and it looks like it is going to soon.

Ori Berger
Sunday, March 03, 2002

I've read about this stuff to, but I must confess I really don't see the advantage!
Weren't Static Methods designed for Sharing!
If you must share code between classes which is a good idea for web-applications (Standard error pages, security etc...)

i.e for your error handler example ... in Java you could have something like
public class ErrorHandler()
{
  static void HandleError(ExceptionClass1 E){...}
  static void HandleError(ExceptionClass2 E){...}
  static void HandleError(ExceptionClass3 E){...}
  static void HandleError(ExceptionClass3 E){...}
}

this would probably be a lot simpler than rewriting an Existing JVM to handle essentially Thrown Objects!
something like

public class SecurityHandler catches AuthenticationClass cs
{
...
}

which is what I assume an Aspect oriented class would look like!

Daniel Shchyokin
Monday, March 04, 2002

My concept of AOP is centric around the context.  We develop contexts of encapsulation and place our objects within them.

For example if you're familiar with COM+ it provides us with a set of services, distributed transaction support, role based security, pooling, etc.  When you're building your COM object you could build it with out giving much thought about these services.  These services are "injected" at runtime. 

This is the kind of model I fall back on to understand AOP.  It is a very simple example.

Chris Sells wrote an article in the recent MSDN Magazine which does an excellent job of describing AOP and two implementations of it, one in COM and the other in .NET.

http://msdn.microsoft.com/msdnmag/issues/02/03/AOP/AOP.asp

Richard Caetano
Monday, March 04, 2002

I have read a little about Aspect-Oriented-Programming and have certainly found it interesting.  I think that it will eventually have more and more of precense in software design and development. 

However, another part of me sees it as a method of implementing the MVC (Model View Controller) pattern using external tools or language constructs.

Please have a look at the MVC pattern, which I think is the understated king of patterns.  Yes, it is typically associated with GUI development, but it is far more reaching than that.

James Ladd
Tuesday, March 05, 2002

Ran across these:

http://www-106.ibm.com/developerworks/java/library/j-aspectj/?open&l=185,t=grj,p=ASJ

http://www.javaworld.com/javaworld/jw-01-2002/jw-0118-aspect.html

http://aspectj.org/doc/dist/progguide/index.html

Mark W
Tuesday, March 05, 2002

I am now interested in AOP because I found there's need for something that can make enterprise level module/component to obtain the critical modern features more easily, those include container managed persistence, transaction support, logging, and so on. That seems currently approached via component services from application servers that complies to some specification like J2EE.
But I have a strong feeling that there must be something can cover this need more easily,  that's something I am currently thinking about - a Capability Oriented Programming methodology which aimed on object service's defination, interfacing, and implementation, I think a simpler and practical implementation maybe adding some Smalltalk abilities to Java. That's exactly of some thinking of AOP, but I have it a new name because it's more specifically on object service providing, and capabilities may consist of multiple interrelated aspects that seems AOP hasn't modeled out.
I propose to bring a new concept to OOP - capability. a capability can be thought a extention of Java Interface, except it has the following 2 significant differences.
    1. a capability can have method implementation code with its defination while Java interface can not.
    2. a class declares to 'enables' (contrasted to 'implements' for interface) some capabilities at the compile time, but the runtime environment may be configured or managed to link subcapabilities to that class on initiating of the class and its instances.
Then, with the yet added syntactic support from Smalltalk grammar which can be used to dynamically manipulate the class definition, this architecture will in fact achieve what currently achieved by other means like interception/injection.
Maybe it can be viewed as Grammar Supported Interception other than Reflection Supported Interception, But I think they are essentially different methodology.

Compl Y Still
Saturday, August 02, 2003

*  Recent Topics

*  Fog Creek Home