Role-oriented programming as a form of
computer programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
aims at expressing things in terms that are analogous to human
concept
Concepts are defined as abstract ideas. They are understood to be the fundamental building blocks of the concept behind principles, thoughts and beliefs.
They play an important role in all aspects of cognition. As such, concepts are studied by ...
ual understanding of the
world
In its most general sense, the term "world" refers to the totality of entities, to the whole of reality or to everything that is. The nature of the world has been conceptualized differently in different fields. Some conceptions see the worl ...
. 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, moral obligation, obligations, beliefs, and social norm, norms as conceptualized by people in a social situation. It is an expected or free or continuously changing behavi ...
s. This claim is often backed up by examples of
social relations
A social relation or also described as a social interaction or social experience is the fundamental unit of analysis within the social sciences, and describes any voluntary or involuntary interpersonal relationship between two or more individuals ...
. 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 stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases s ...
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 th ...
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 group of operating systems (OS) for servers that Microsoft has been developing since July 27, 1993. The first OS that was released for this platform was Windows NT 3.1 Advanced Server. With the r ...
jargon.
Many researchers have argued the advantages of roles in
modeling
A model is an informative representation of an object, person or system. The term originally denoted the plans of a building in late 16th-century English, and derived via French and Italian ultimately from Latin ''modulus'', a measure.
Models c ...
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 characters they portray. It has become a popular term on th ...
- things change over time, are used differently in different contexts, etc.
Authors of role literature
Barbara PerniciBruce Wallace*
Charles Bachman
Charles William Bachman III (December 11, 1924 – July 13, 2017) was an American computer scientist, who spent his entire career as an industrial researcher, developer, and manager rather than in academia. He was particularly known for his ...
Friedrich SteimannKasper B. GraversenKasper Østerbye*
Trygve Reenskaug
Trygve Mikkjel Heyerdahl Reenskaug (born 21 June 1930) is 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) software des ...
Thomas Kühn
Programming languages with explicit support for roles
*
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 th ...
*
Data, context and interaction Data, context, and interaction (DCI) 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 ...
*
Object Oriented Role Analysis Method The OOram (Object-oriented Role Analysis and Modeling) is a method, based on the concept of ''role'', for performing object-oriented modeling.
(Presented at OOPSLA 1996 Workshop: ''Exploration of Framework Design Principles'')
Originally (1989) co ...
*
Object-role modeling
Object-role modeling (ORM) is used to model the semantics of a universe of discourse. ORM is often used for data modeling and software engineering.
An object-role model uses graphical symbols that are based on first order predicate logic and se ...
*
Subject (programming)
In computing, subject-oriented programming is an object-oriented software paradigm in which the state (fields) and behavior (methods) of objects are not seen as intrinsic to the objects themselves, but are provided by various subjective perceptio ...
*
Subject-oriented programming
*
Traits (computer science)
In computer programming, a trait is a concept used in object-oriented programming which represents a set of methods that can be used to extend the functionality of a class.
Rationale
In object-oriented programming, behavior is sometimes share ...
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