Jump to content

Subject-oriented programming

From Alfawiki
Adapted from the English Wikipedia article Subject-oriented programming, available under CC BY-SA 4.0Updated 9 August 2025

In computing, subject-oriented programming represents an object-oriented software paradigm where the attributes (fields) and actions (methods) of objects are defined by multiple subjective viewpoints ("subjects") rather than being inherent to the objects themselves. This idea was initially introduced in September 1993 and later acknowledged as one of the most significant papers presented at the conference spanning 1986 to 1996. The work draws parallels to philosophical perspectives from Plato and Kant, demonstrating that an object's properties can vary according to different viewpoints. For example, the measurable features of a tree differ when observed from the perspective of a bird or a tax assessor, who might add value or tax-related information not originally part of the tree.

Subject-oriented programming structures classes that define objects into distinct "subjects," which can be combined into more complex subjects. At specific access points to fields or methods, contributions from multiple subjects may be merged at designated join-points. For example, the act of cutting down a tree could involve integrating behaviors from the bird and tax assessor subjects alongside those belonging to the tree itself. This paradigm prioritizes software composition rather than traditional procedural or object-oriented algorithmic techniques.

Relationship to aspect-oriented programming

When aspect-oriented programming was introduced in 1997, it prompted discussions about its connection to subject-oriented programming and the differences between subjects and aspects. These distinctions were clarified in a 1999 patent, which emphasized two main points:

  • An aspect program contains a cross-cut—specific execution points where cross-cutting behavior is applied—and a corresponding implementation component with program code.
  • Aspects automatically enforce cross-cutting concerns on object classes and other software elements.

Conversely, subject-oriented programming keeps the cross-cut separate from the subject itself, with behavior controlled through composition rules rather than being imposed by aspects. Moreover, aspect-oriented programming brought in query-like pointcuts that allow external specification of join-points, a feature not present in subject-oriented programming, which limits join-points to field accesses and method invocations for functional expansion. Although pointcuts increase expressive power, they remain a topic of debate within aspect-oriented programming circles.

Relationship to aspect-oriented software development

By the early 2000s, multiple research teams were creating technologies aimed at integrating separately packaged state and functionality into cohesive objects. To differentiate this wider domain from Aspect-Oriented Programming (AOP) and its related patents, these techniques were collectively categorized under Aspect-Oriented Software Development (AOSD), which extends beyond mere programming practices. Alongside AOP, methodologies such as subject-oriented programming, composition filters, and feature-oriented programming are included within AOSD’s scope.

Multi-dimensional separation of concerns, Hyper/J, and the Concern Manipulation Environment

Originally, subject-oriented programming emerged as a technique for packaging to extend both functions and data types. Initial versions focused on C++ and Smalltalk, utilizing software labels alongside composition rules to integrate subjects.

To improve capabilities for analysis and composition beyond simple packaging, a multi-dimensional "matrix" was introduced that maps concerns to software components—this is known as multi-dimensional separation of concerns. This idea significantly influenced research within software engineering.

The concept was realized for Java through the tool Hyper/J, which facilitates the separation of concerns across multiple dimensions.

These composition principles are also applicable to non-code artifacts such as requirements or documentation. The Concern Manipulation Environment (CME), developed as a research tool within Eclipse, offers features for querying, analyzing, modeling, and composing various artifact types by means of plug-in adapters.

A successor to Hyper/J’s composition engine incorporated a comprehensive framework that includes:

  • a unification-based query language designed to locate join points,
  • a versatile structural-attachment model,
  • nested-graph definitions to specify element ordering,
  • priority-based ordering mechanisms for conflict resolution.

While both Hyper/J and CME remain accessible via alphaWorks and SourceForge, they no longer receive active maintenance.

Subject-oriented programming as a "third dimension"

In object-oriented programming, method dispatch operates in "two dimensions," depending on both the method name and the target object. Procedural programming, on the other hand, resolves procedure names in a single dimension directly to subroutines. Subject-oriented programming introduces an additional factor—the sender or subject—into dispatch decisions, effectively adding a third dimension.

See also

External links