Role-oriented programming as a form of
computer programming
Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
aims at expressing things in terms that are analogous to human
concept
A concept is an abstract idea that serves as a foundation for more concrete principles, thoughts, and beliefs.
Concepts play an important role in all aspects of cognition. As such, concepts are studied within such disciplines as linguistics, ...
ual understanding of the
world
The world is the totality of entities, the whole of reality, or everything that Existence, exists. The nature of the world has been conceptualized differently in different fields. Some conceptions see the world as unique, while others talk ...
. This should make programs easier to understand and maintain.
The main idea of role-oriented programming is that humans think in terms of
role
A role (also rôle or social role) is a set of connected behaviors, rights, obligations, beliefs, and norms as conceptualized by people in a social situation. It is an
expected or free or continuously changing behavior and may have a given indi ...
s. This claim is often backed up by examples of
social relations
A social relation is the fundamental unit of analysis within the social sciences, and describes any voluntary or involuntary interpersonal relationship between two or more conspecifics within and/or between groups. The group can be a language or k ...
. 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
database
In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
s, 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
In computing, aspect-oriented programming (AOP) 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 t ...
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
Windows Server (formerly Windows NT Server) is a brand name for Server (computing), server-oriented releases of the Windows NT operating system (OS) that have been developed by Microsoft since 1993. The first release under this brand name i ...
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
Real life is a phrase used originally in literature to distinguish between the real world and fictional, virtual or idealized worlds, and in acting to distinguish between actors and the Character (arts), characters they portray. It has become a ...
- things change over time, are used differently in different contexts, etc.
Authors of role literature
Barbara PerniciBruce Wallace*
Charles Bachman
Friedrich SteimannKasper B. GraversenKasper Østerbye*
Trygve Reenskaug
Trygve Mikkjel Heyerdahl Reenskaug (21 June 1930 – 14 June 2024) was a Norwegian computer scientist and professor emeritus of the University of Oslo. He formulated the model–view–controller (MVC) pattern for graphical user interface (GUI) ...
Thomas Kühn
Programming languages with explicit support for roles
*
Cameleon
EpsilonJ*
JavaScript Delegation - Functions as Roles (Traits and Mixins)
Object Teams*
Perl (Moose)
*
Raku
powerJavaSCala ROLes Language
See also
*
Aspect-oriented programming
In computing, aspect-oriented programming (AOP) 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 t ...
*
Data, context and interaction
*
Object Oriented Role Analysis Method
*
Object-role modeling
*
Subject (programming)
*
Subject-oriented programming
*
Traits (computer science)
References
External links
Adaptive Plug-and-Play Components for Evolutionary Software Development by Mira Mezini and Karl Lieberherr
Overview and taxonomy of Role languagesROPE: Role Oriented Programming Environment for Multiagent Systems
{{compu-prog-stub
Object-based programming languages
Programming paradigms