Real-Time Object-Oriented Modeling

Last updated

Real-Time Object-Oriented Modeling (ROOM) is a domain-specific language.

Contents

ROOM was developed in the early 1990s for modeling Real-time systems. [1] The initial focus was on telecommunications, even though ROOM can be applied to any event-driven real-time system.

ROOM was supported by ObjecTime Developer (commercial) and is now implemented by the official Eclipse project eTrice [2]

When UML2 was defined (version 2 of UML with real time extensions), many elements of ROOM were adopted.

Concepts and Key Notions of ROOM

ROOM is a modeling language for the definition of software systems. It allows the complete code generation for the whole system from the model. ROOM comes with a textual as well as with a graphical notation. Typically the generated code is accompanied with manually written code, e.g. for graphical user interfaces (GUI). The code is compiled and linked against a runtime library which provides base classes and basic services (e.g. messaging).

ROOM describes a software system along three dimensions: structure, behavior and inheritance. The following sections will explain these three aspects in more detail.

Structure

The structural view in ROOM is composed of actors or capsules. Actors can communicate with each other using ports. Those ports are connected by bindings. Actors do exchange messages asynchronously via ports and bindings. To each port a unique protocol is assigned. A protocol in ROOM defines a set of outgoing and a set of incoming messages. Ports can be connected with a binding if they belong to the same protocol and are conjugate to each other. That means that one port is sending the outgoing messages of the protocol and receiving the incoming ones. This port is called the regular port. Its peer port, the conjugated port, receives the outgoing messages and sends the incoming ones of the protocol. In other words, a port is the combination of a required and a provided interface in a role (since one and the same protocol can be used by several ports of an actor).

Example of a structure diagram Structure of AnActorClass.jpg
Example of a structure diagram

An actor can contain other actors (as a composition). In ROOM these are called actor references or actor refs for short. This allows to create structural hierarchies of arbitrary depth.

The actor's ports can be part of its interface (visible from the exterior) or part of its structure (used by itself) or both. Ports that are part of the interface only are called relay ports. They are directly connected to a port of a sub actor (they are delegating to the sub actor). Ports that are part of the structure only are called internal end ports. Ports that belong to both, structure and interface, are called external end ports.

Behavior

Each actor in ROOM has a behavior which is defined by means of a hierarchical finite-state machine, or just state machine for short. A state machine is a directed graph consisting of nodes called states and edges called transitions. State transitions are triggered by incoming messages from an internal or external end port. In this context the messages sometimes are also called events or signals. If a transition specifies a certain trigger then it is said to fire if the state machine is in the source state of the transition and a message of the type specified by the trigger arrives. Afterwards the state is changed to the target state of the transition.

ROOM behavior diagramm (state machine as a state chart) ROOM Behavior Diagram.jpg
ROOM behavior diagramm (state machine as a state chart)

During the state change certain pieces of code are executed. The programmer (or modeler) can attach them to the states and transitions. In ROOM this code is written in the so called detail level language, usually the target language of the code generation. A state can have entry code and exit code. During a state change first the exit code of the source state is executed. Then the action code of the firing transition is executed and finally the entry code of the target state. A typical part of those codes is the sending of messages through ports of the actor.

State machines in ROOM also have a graphical notation similar to the UML state charts. An example is shown in the diagram in this section.

A state machine can also have a hierarchy in the sense that states can have sub state machines. Similar to the structure this can be extended to arbitrary depth. For details of the semantics of hierarchical state machines we refer to the original book. [3]

An important concept in the context of state machines is the execution model of run-to-completion. That means that an actor is processing a message completely before it accepts the next message. Since the run-to-completion semantics is guaranteed by the execution environment, the programmer/modeler doesn't have to deal with classical thread synchronization. And this despite the fact that typical ROOM systems are highly concurrent because of the asynchronous communication. And maybe its worth to stress that the asynchronous nature of ROOM systems is not by accident but reflects the inherent asynchronicity of e.g. the machine being controlled by the software. Definitely this requires another mind set than the one that is needed for functional programming of synchronous systems. But after a short while of getting accustomed it will be evident that asynchronously communicating state machines are perfectly suited for control software.

Inheritance

Like other object oriented programming languages ROOM uses the concept of classes. Actors are classes which can be instantiated as objects several times in the system. Of course each instance of an actor class tracks its own state and can communicate with other instances of the same (and other) classes.

Similar to other modern programming languages ROOM allows inheritance of actor classes. It is a single inheritance as an actor class can be derived from another actor class (its base class). It inherits all features of the base class like ports and actor refs, but also the state machine. The derived actor class can add further states and transitions to the inherited one.

Layering

A last powerful concept of ROOM is layering. This notion refers to the vertical layers of a software system consisting of services and their clients. ROOM introduces the notions of service access point (SAP) for the client side and service provision point (SPP) for the server side. From the point of view of an actor implementation the SAPs and SPPs work like ports. Like ports they are associated with a protocol. But other than ports they don't have to (and even cannot) be bound explicitly. Rather, an actor is bound to a concrete service by a layer connection and this binding of a service is propagated recursively to all sub actors of this actor. This concept is very similar to dependency injection.

Literature

Related Research Articles

In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state and implementations of behavior.

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space, which is written as if it were a normal (local) procedure call, without the programmer explicitly writing the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. This is a form of client–server interaction, typically implemented via a request–response message-passing system. In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI). The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls. Remote calls are usually orders of magnitude slower and less reliable than local calls, so distinguishing them is important.

<span class="mw-page-title-main">Smalltalk</span> Object-oriented programming language first released in 1972

Smalltalk is a purely object oriented programming language (OOP), which was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learning Research Group (LRG) scientists, including Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Diana Merry, and Scott Wallace.

The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between systems on different operating systems, programming languages, and computing hardware. CORBA uses an object-oriented model although the systems that use the CORBA do not have to be object-oriented. CORBA is an example of the distributed object paradigm.

Cocoa is Apple's native object-oriented application programming interface (API) for its desktop operating system macOS.

A web service (WS) is either:

In computer science, an object can be a variable, a data structure, a function, or a method. As regions of memory, objects contain a value and are referenced by identifiers.

Message-oriented middleware (MOM) is software or hardware infrastructure supporting sending and receiving messages between distributed systems. MOM allows application modules to be distributed over heterogeneous platforms and reduces the complexity of developing applications that span multiple operating systems and network protocols. The middleware creates a distributed communications layer that insulates the application developer from the details of the various operating systems and network interfaces. APIs that extend across diverse platforms and networks are typically provided by MOM.

In computer science, message passing is a technique for invoking behavior on a computer. The invoking program sends a message to a process and relies on that process and its supporting infrastructure to then select and run some appropriate code. Message passing differs from conventional programming where a process, subroutine, or function is directly invoked by name. Message passing is key to some models of concurrency and object-oriented programming.

The actor model in computer science is a mathematical model of concurrent computation that treats an actor as the basic building block of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other indirectly through messaging.

In computing and systems design, a loosely coupled system is one

  1. in which components are weakly associated with each other, and thus changes in one component least affect existence or performance of another component.
  2. in which each of its components has, or makes use of, little or no knowledge of the definitions of other separate components. Subareas include the coupling of classes, interfaces, data, and services. Loose coupling is the opposite of tight coupling.

Specification and Description Language (SDL) is a specification language targeted at the unambiguous specification and description of the behaviour of reactive and distributed systems.

Glossary of Unified Modeling Language (UML) terms provides a compilation of terminology used in all versions of UML, along with their definitions. Any notable distinctions that may exist between versions are noted with the individual entry it applies to.

Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, Browser Helper Object, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and Windows Runtime. The essence of COM is a language-neutral way of implementing objects that can be used in environments different from the one in which they were created, even across machine boundaries. For well-authored components, COM allows reuse of objects with no knowledge of their internal implementation, as it forces component implementers to provide well-defined interfaces that are separated from the implementation. The different allocation semantics of languages are accommodated by making objects responsible for their own creation and destruction through reference-counting. Type conversion casting between different interfaces of an object is achieved through the QueryInterface method. The preferred method of "inheritance" within COM is the creation of sub-objects to which method "calls" are delegated.

UML state machine, also known as UML statechart, is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the Unified Modeling Language (UML) notation.

Object-oriented programming (OOP) is a programming paradigm based on the concept of objects, which can contain data and code: data in the form of fields, and code in the form of procedures.

<span class="mw-page-title-main">API</span> Software interface between computer programs

An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build or use such a connection or interface is called an API specification. A computer system that meets this standard is said to implement or expose an API. The term API may refer either to the specification or to the implementation. Whereas a system's user interface dictates how its end-users interact with the system in question, its API dictates how to write code that takes advantage of that system's capabilities.

<span class="mw-page-title-main">QP (framework)</span>

QP is a family of open source real-time embedded frameworks (RTEFs) and runtime environments based on active objects (actors) and hierarchical state machines. The QP family consists of the lightweight QP/C and QP/C++ frameworks, written in C (C99) and C++ (C++11), respectively.

ObjecTime Developer is a software automation tool designed to meet the development needs of real-time software development teams. The tool was created by ObjecTime Limited of Kanata, Ontario, and was aimed at aiding software developers in building applications using Real-Time Object-Oriented Modeling (ROOM) for real-time, graphical design models. ObjecTime, using the design models, will then generate production-quality applications for real-time operating systems, using the C and C++ programming languages. An important aspect of the development process using OTD was the capability to visually see the execution of the generated software as animation of the design models. This was true both for the software running both on the development or target platform.

eTrice is a CASE-Tool for the development of real-time software. It is an official Eclipse project.

References

  1. 1 2 Summary of the book "Real-Time Object-Oriented Modeling"
  2. eTrice - ROOM Open Source Tool
  3. Bran Selic, Garth Gullekson, Paul T. Ward: "Real-Time Object-Oriented Modeling", New York, John Wiley & Sons Inc, 1994, ISBN   978-0-471-59917-3