[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aspect Oriented Programming in context of lightweight languages.



Matthew Estes writes:
>
> I've been reading on Aspect Oriented Programming for a while, and I
> was having a hard time getting my head around it. On the surface, it
> seems useful to me, but it seems everyone loves the "adding logging
> to an application example", and other problems solved by it aren't
> just busting out of my head.

I think AOP offers a sufficiently novel set of control constructs that
no one is entirely sure how to use it. It looks like AOP pointcuts
give you a set of stack-inspection primitives, and some hooks for
telling the program to perform certain actions when the call stack
matches a particular pattern. In other words, it lets you make use of
the *context* of a procedural call when deciding what to do.

For example, you could use AOP-style to generate error messages for a
recursive descent parser, by reading the stack trace to generate an
error message that explains the context the parser was in when it ran
into an error. Sure, you can accomplish that with a disciplined use of
exceptions, but it grunges up the code considerably.

-- 
Neel Krishnaswami
neelk@alum.mit.edu