What are the differences between aspect-oriented, subject-oriented, and role-oriented programming

aspect-orientedparadigmsrole

I know there are many papers describing these three paradigms but I'm looking for a schematic explanation.

There are a few very good descriptions of aspect-oriented programming on here so I'm asking this question in the hope to get the kind of high-quality answer people at Stack Overflow are used to delivering.

Best Answer

One can answer this by writing a book on this. However, here is a basic comparison

1. Subject oriented Programming

Subject-Oriented Programming is radical departure from the Object oriented as follows. In OO, objects are defined in terms of intrinsic (i.e. based on a model that independently describes it). and based on this its attributes (properties) and methods (behavior) are derived. The application makes only the use of these properties and behavior. Contrary to this, in subject oriented programming, no object exists (and modeled) in such an isolation. In the process, but behaviors of the objects is been provided by the various other "subjectsā€¯ of the objects which are beyond the scope and control of the author of the original object. Think of it as a way of extending various "independently definable behaviors" on the object. I think this would be way beyond defining templates of inheritance compared to what is being discussed here.

The undisputed origin of terms (and concept) comes from the paper "Subject Oriented Programming: A Critique of Pure Objects, William Harrison and Harold Ossher". Here is another good paper. Though personally i believe this is a theoretical framework. I don't know if there are any languages/implementation

See this, this and this for more info.

2. Aspect Oriented Programming

Aspect oriented programming has originated from the concept of "Separation of oncerns". Basically it extends the either procedural or object oriented programming for concerns which are cross-cutting. Over simplifying one can say that software has functional requirements and non-functional ones. These cross cutting requirements includes examples like logging, exception handling, thread synchronization, memory management, optimization and so on. These cross cutting ASPECTS should be expressed and implemented separately and independently to any other functional parts.
A comprehensive work in this area is from IBM; basically each such concerns or aspects can be independent from each other forming multidimensional "concern space". , (read this).

Some of the good practical implementations of Aspect Oriented are AspectJ and AspectC++ and many more. See this.

3. Role Oriented Programing
As we evolve towards agents, many a times it is necessary to define "roles" and objectives where as exact activities that agent ends-up performing depends on the environment it is in. This is analogous to human conceptual understanding.

The primary objective is to decouple objective of task from it's co-operation capability by defining explicit construct called cooperation processes. A role is modeled as a set of the capabilities and an expected behavior. however, these approaches also allow modeling of the execution environment and how agent/object can perceive the environment as well. See this.

There are various frameworks proposed in the research for role based modeling and implementations. A few of them are ROPE, BRAIN, ALAADIN and more.

Related Topic