Advertisement

Aspect-oriented programming? New programming paradigm?

Started by May 29, 2000 11:42 AM
6 comments, last by Stanley Foo 24 years, 7 months ago
I read in a recent post that some researchers were trying to come up with a new programming paradigm to replace object-oriented programming, and someone said that his group was involved in aspect-oriented programming. Can anyone give me more details? Stanley
It was me that made that post. The software engineering group here at the University of Twente is researching topics in this field.

The problem software engineers are facing is that of ''separation of concerns'': how to identify, encapsulate and manipulate those parts of the software that are relevant to a particular concern.

There are several upcomming techniques and ideas that try to address the separation of concerns issues. For example, there are composition filters (developed at my University), which add certain filters to messages an object can receive. There''s Hyperspaces, from IBM Research, which groups concerns into dimensions. The complete system is then composed dynamically or statically. And there''s Aspect Oriented Programming, from Xeroc PARC. AOP introduces a new unit of software modularity called aspects, enabling a software engineer to program directly in terms of aspects. AspectJ is a general-purpose aspect-oriented extension to Java.

Here are some links that provide more info on the subject:
IBM''s Hyperspace - http://www.research.ibm.com/hyperspace/
AOP - http://www.parc.xerox.com/csl/projects/aop/
Composition Filters - http://wwwtrese.cs.utwente.nl/sina/cfom/index.html

A chapter called ''Aspect-Oriented Decomposition and Compisition'' appears in the book "Generative Programming: Methods, Techniques and Applications" by K. Czarnecki and U. Eisenecker, published by Addison-Wesley, ISBN 0-201-30977-7.

Here at the University I followed a course called Object Oriented Systems that discussed this subject, and by chance, at about the same time there was a Symposium here at the University about the exact same thing. All the hot-shots from this field of software engineering were present

If you want more info, let me know.

Erik
Advertisement
Hi

My university also have a software group working on issues related to object oriented programming. It''s not like a new paradigm but more like several extensions to the good old object oriented one.

Some of the things they are working on is extensions of the traditional object model to support:

a) Automated (or autonomous) agent-like objects enabling objects to be ''active'' and take on responsebilities and show correct behaviour acording to these responsebilities.

b) Constraint based modelling enabling modelling of constrains (or relations) between objects. For example in a CAD program you would be able to set constrains on objects ensuring that if you move a part of a model, the rest of the model would dynamicly adapt to that change.

c) Perspective based modelling. Here an object contains only the identity of the object. There''s no state or functionality associated with the "raw" object. Only when viewing the object from a certain perspective does the functionality associated with this perspective show. So instead of making a very large bulky object you model your objects in smaller ''properties'' associated with certain perspectives.


I think this is all very exciting and it would be interesting and usefull to apply it to computer games.

Regards

nicba
quote: Original post by Erik Post

It was me that made that post. The software engineering group here at the University of Twente is researching topics in this field.



Yes, Erik, you did. But I''m afraid I''m too much a beginner to understand what you said. Could you explain at an easier level? Thanks.

Stanley
yeah, could you simplify it a little more for us humans? ;D I basically want an abstraction of what it is... know what i mean.. like your talking in psuedo-code, and i need an algorithm... know what i mean? thx
Ok, I''ll try to explain things by giving a simple example (it''s in the book I mentioned) that uses AspectJ.

Suppose you want to have a stack that has some synchronisation constraints:
1. push is self exclusive (no two threads can execute push at the same time)
2. pop is self exclusive
3. push and pop are mutually exclusive (no two threads can simultaneously execute push and pop)
4. push can only proceed if the stack is not full
5. pop can only proceed if the stack is not empty.

If you''d implement this stack in Java, the code that handles the synchronisation becomes tangled with the code that implements the actual stack. Here''s an example implementation for push, with the synchronisation code preceded with a *:
public synchronized void push( Object element ){*    while ( top == max_top )*    { try*      { wait();*      }*      catch (InterruptedException e) {};*    }    elements[++top] = element;*    if ( top == 0 ) notifyAll();} 

With AspectJ, you can specify the synchronisation constraints directly in a different module using a Java-like syntax:
coordinator Stack{  selfex push, pop;   mutex {push, pop};   condition full=false, empty=true;   guard push:     requires !full;     onexit     { if ( empty ) empty = false;       if ( top == s_size-1 ) full = true;     }   guard pop:     requires !empty;     onexit     { if ( full ) full = false;       if ( top == -1 ) empty = true;     }} 

The code for the Stack''s push method would look like this:
public void push(Object element){ elements[++top] = element;} 

The actual code for the synchronised stack is then generated using a separate compiler that extends the Stack source code with the constraints specified in the separate module.

It''s a bit of trivial example, but it gives an idea what can be done with AspectJ. Other tools/languages work alike, but differ in actual implementation and usage, of course.

I hope this makes things even more clear

Erik
Advertisement
hmmm, i think i''m starting to get it... that''s pretty damn trippy, are there any other methods of programming being developed (i''m sure there are many, but what about major/promising ones)
Got it, Eric. Now I know why they refer to "conditions" as in condition of the stack. Thanks a lot, bud.

Stanley

This topic is closed to new replies.

Advertisement