Aspects Oriented Programming
- Published May 9th, 2007 in Software Eng.
Cookies. Imagine a cookie. It’s self contained. Flour is mixed with butter and chocolate chips but the details don’t matter that much to us as long as it tastes well.
Do you see cookies sending messages or logging stuff?
Object Oriented Programming (should) is like cookies. Objects should be encapsulated and self contained. So why do we have logger systems that have nothing to do with the object, mixed in the middle of the object’s logic? Why are OOP cookies (ie, objects) that have nothing to do with loggers, logging stuff? It’s not their intent to send messages. Just to be eated.
Well, they shouldn’t. If you, like me, believe that these kind of stuff are middleware and should stay away from the logic of the object itself then it’s time to welcome Aspects Oriented Programming.
There are very interesting books about the subject and several tutorials. But if you liked the example I gave you then keep reading it here. A lot more examples of interesting usage of AOP could be brought up to exemplify its usefulness. If you have some, comment about them. I’m really interested in AOP use case scenarios.




Hi,
I am the author of a slight different approach to define Aspects. Here is my URL: http://www.phpclasses.org/browse/package/3215.html
Take a look at the manual, and if interested, we can discuss about the approach I built through MSN/GTalk.
Regards,
Guilherme Blanco
Hi Guilherme,
First, let me congratulate you for two reasons. First being the work you made. It’s a huge contribution to the AOP community (it’s a matter of time until it becomes mainstream!). Secondly, I’m happy to see the Brazilian community working so actively. As a Portuguese, I have a strong connection to Brazilians for the best reasons :-)
I’d love to talk with you about the fine-details of how it was implemented but I think it would be great to post it online so it can benefit more people. We could try using this thread and, afterwards, I’d be really thrilled if you write a post and I could cite it on my blog.
My first question would be: why use XML to define the AOP semantics? Wouldn’t it be easier to use code as similar to PHP as possible? It would be extra work for you though. I’d have to build a parser on your own.