Author Topic: Aspect Oriented Programming  (Read 7619 times)

Offline Chocoboko

  • Single posting newcomer
  • *
  • Posts: 9
    • Celestial Bridge
Aspect Oriented Programming
« on: December 17, 2005, 10:09:03 pm »
I've been reading about a new programming paradigmn to accompony OOP (Object-Oriented Programming).  It's called Aspect Oriented Programming.  So far, it looks pretty interesting.  The idea behind it is to make object code cleaner.  It doesn't replace OOP as much as accompany it.  It uses a program called a weaver to convert an AOP language to an OOP language which is then interpretted by the compiler.

AOP involves creating special functions called aspects.  These are specialized functions called before and after a specific function.  It's re-using certain code, such as access checking for various different functions.  Here's a pseudocode example:

Code: [Select]
before BankAccount(idNumber)
{
if ( !VerifyAccountID(idNumber) )
{
print("Invalid account number");
terminate;
}

}

BankAccount Withdraw(idNumber, amount)
{
accounts[idNumber].balance-=amount;
print ( amount + " withdrawn.");
}

BankAccount Deposit(idNumber, amount)
{
accounts[idNumber].balance+=amount;
print ( amount + " deposited.");
}



This pseudocode has two specialized functions of type BankAccount.  Before each function is called, the "before" function is called to verify that the idNumber is correct.  The idea on Aspect-oriented programming is to re-use access checking functions.

There's an AOP binding for C++ called AspectC++ (http://www.aspectc.org/).  It supports weaving together code for the GNU compiler, and MS Visual C++.

What do you all think about AOP?  Do you think a plugin supporting AspectC++ or another weaver would be a useful addition to Code::Blocks?  I want to generate some discussion on this.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Aspect Oriented Programming
« Reply #1 on: December 18, 2005, 12:45:34 am »
Hello,

I think that aspect-oriented programming (AOP) is a new interesting programming paradigm. I did not know too much about it and have also heard practically no information about it (and I work/study in an academic Institute :)).

Anyway, regarding the addition of AOP to C++, I am a bit skeptical. I believe and support the work of ISO/IEC JTC1/SC22/WG21. I think that they do a very good job in maintaing/extending the C++ (I have already had the pleasure to speak with one or two members of the C++ Standards Committee). Until now I have heard nothing or quite relating the addition of AOP to C++. Anyway, this does not mean that AOP is not worth to be added.

Personally, I think that the addition of a plugin allowing AOP support would be a good idea. So, C::B users can try this new programming paradigm or use it for their project.

Michael

PS.: A couple of interesting AOP links:

http://en.wikipedia.org/wiki/Aspect-oriented_programming
http://www.you.com.au/news/1680.htm