Reference articles on history, science, culture and more
Encyclopedia

Role-oriented programming

Programming paradigm based on conceptual understanding of objects

Role-oriented programming as a form of computer programming aims at expressing things in terms that are analogous to human conceptual understanding of the world. This should make programs easier to understand and maintain.

The main idea of role-oriented programming is that humans think in terms of roles. This claim is often backed up by examples of social relations. For example, a student attending a class and the same student at a party are the same person, yet that person plays two different roles. In particular, the interactions of this person with the outside world depend on his current role. The roles typically share features, e.g., the intrinsic properties of being a person. This sharing of properties is often handled by the delegation mechanism.

In the older literature and in the field of databases, it seems that there has been little consideration for the context in which roles interplay with each other. Such a context is being established in newer role- and aspect-oriented programming languages such as Object Teams. Compare the use of "role" as "a set of software programs (services) that enable a server to perform specific functions for users or computers on the network" in Windows Server jargon.

Many researchers have argued the advantages of roles in modeling and implementation. Roles allow objects to evolve over time, they enable independent and concurrently existing views (interfaces) of the object, explicating the different contexts of the object, and separating concerns. Generally roles are a natural element of human daily concept-forming. Roles in programming languages enable objects to have changing interfaces, as we see in real life - things change over time, are used differently in different contexts, etc.

01Authors of role literature

02Programming languages with explicit support for roles

Watch videos about Role-oriented programmingExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article Role-oriented programming, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.

Continue exploring

Related topics

Aspect-oriented programming

In computing, aspect-oriented programming is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) without modifying the code, instead separately specifying which code is modified via a "pointcut" specification, such as "log all function calls when the function's name begins with 'set'".

Data, context and interaction

Data, context, and interaction is a paradigm used in computer software to program systems of communicating objects. Its goals are: To improve the readability of object-oriented code by giving system behavior first-class status; To cleanly separate code for rapidly changing system behavior (what a system does) versus slowly changing domain knowledge (what a system is), instead of combining both in one class interface; To help software developers reason about system-level state and behavior instead of only object state and behavior; To support an object style of thinking that is close to programmers' mental models, rather than the class style of thinking that overshadowed object thinking early in the history of object-oriented programming languages.

Object-oriented role analysis and modeling

Object-oriented role analysis and modeling is a method, based on the concept of role, for performing object-oriented modeling. Originally (1989) coined Object Oriented Role Analysis, Synthesis and Structuring (OORASS), the method focuses on describing patterns of interaction without connecting the interaction to particular objects/instances.