Data context interaction

from Wikipedia, the free encyclopedia

Datacontext Interaction ( DCI , German  data-context interaction ) is an architectural pattern for modeling the professionalism of complex object-oriented software. DCI separates technical objects (data) from use cases (context) and roles (interaction) . DCI was first described by Trygve Reenskaug , inventor of the Model View Controller architecture pattern. He was later assisted in this by James O. Coplien .

description

Data Context Interaction is based on the idea of ​​not modeling classes - as is otherwise usual in object-oriented analysis and design - but describing objects. With DCI, when modeling, you should think more about the instances at runtime than about the classes from which the objects were instantiated.

This approach does not promise to get classes overloaded with functionalities, but rather simple technical objects (data) without their own technical functionality, which fulfill different roles (i.e. functionalities), but which are themselves outsourced to the interaction classes. The actual subject matter (i.e. use cases) itself is mapped in the so-called context classes.

Data Context Interaction is characterized by the strict separation of data (data objects - corresponds roughly to the technical objects), context (context - corresponds to use cases , scenarios or algorithms ) and interaction (interactions - corresponds to the roles that the data objects perform in different contexts):

Data (data objects)

Designates the specialist objects and their relationships to one another. These data objects no longer contain any technical functions and are more or less simple data holders. They should correspond to the conceptual model of the user for the data of the application. They correspond to the model of the Model View Controller architecture pattern.

An example of a data object would be a "bank account". It would have simple methods to query and change the account balance, but no functionalities that require transactions or access to other objects or user interactions. Such tasks are made possible in DCI by the contexts.

Data classes correspond to the entities , value objects and aggregates in the domain-driven design .

Context

Describe the context in which the data objects are used in specific roles. These are the use cases , scenarios and algorithms of the technical task of the application.

Contexts are objects that represent one or more use cases and are instantiated for each execution of a use case. Your main task is to identify the data objects which play a certain role in the use case and to associate them with this role. This binding of the data objects to their roles is comparable to the polymorphism in object-oriented programming.

The implementation of a specific application is thus the process of a business functionality based on data classes which play a specific role in this application.

The entire business functionality of an application is thus the sum of a network of methods, decentralized in various roles.

An example of a context would be a bank transfer between two accounts. This bank transfer uses the data object “bank account” in the roles “source account” and “target account”. The separation of data objects and roles makes it possible, for example, to implement bank transfers between other account types (such as credit accounts or savings accounts) without taking the actual data objects behind them into account.

Interaction (interactions)

In Data Context Interaction, interactions are the roles that can be assigned to data objects. At DCI, a role corresponds to a user's idea of ​​the responsibilities of objects in the system. A role is a collection of responsibilities.

While in object orientation the responsibilities are seen in objects or classes, in DCI these are assigned to the interactions and thus to the roles. Objects take on certain roles in a use case, which can differ from use case to use case. A bank account takes on the role of “source account” at one time, the “target account” role at other times and the “transfer account” role at other times.

An example of a role would be a target account to which amounts can be posted in the "bank transfer" use case.

Compare to other technologies

Object Orientation (OO)
Data Context Interaction is an architecture pattern that cannot be fully reconciled with the principles of object orientation. There is no concept in object orientation that would completely fit the roles of DCI's interactions. This is also one reason why most implementations of DCI with object-oriented programming languages ​​take getting used to.
In addition, the representatives of DCI criticize the fact that the object orientation generally represents an orientation towards classes, while DCI is much more oriented towards the objects of the runtime of a program.
Domain-driven design (DDD)
Data Context Interaction is an architecture pattern that can supplement the components of domain models of domain-driven design (entities, value objects, aggregates, service objects and business events), or can be supplemented by them. The data objects of DCI can be refined by the entities, value objects and aggregates of DDD, context objects in turn can be represented by service objects and business events. The roles of the interactions of DCI, however, in turn expand the components of the domain-driven design.
Aspect-oriented programming (AOP)
Aspect-oriented programming has a variety of application areas, some of which can also be implemented using DCI, because the goals of DCI are comparable to the goals of aspect-oriented programming - and like AOP, DCI is also based on a strong form of reflection or meta-programming. In contrast to aspects, however, the roles of the interactions can easily be aggregated and summarized by DCI. Contexts provide a framework for roles to work together, while aspects only work with the objects to which they are applied.
Composite oriented programming (COP)
Composite-oriented programming (a possible translation into German would be composite-oriented programming) corresponds to a concept that represents an overlap of the concepts DDD, AOP and DCI mentioned here. It is based on the following principles: behavior must be modeled in a context-dependent manner, decoupling is a virtue and must therefore be constantly maintained, business rules are more important than infrastructure such as persistence or security.

Implementations

There are now a number of initial implementations of Data Context Interaction for various programming languages. However, since DCI represents a different, new programming paradigm, its implementation in other programming languages ​​is often bumpy and cumbersome. For example, the injection of methods is usually necessary for the implementation of roles. A few languages ​​support roles natively, other languages ​​use dynamic or static injection or pre-compilation to simulate DCI. There is currently no native implementation of Data Context Interaction.

One implementation of DCI is Apache Zest (formerly Qi4j), a Java framework for domain-centric application development based on concepts such as aspect-oriented programming , data context interaction and domain-driven design . With the so-called traits, Scala has a language construct with which roles can be implemented natively. In addition, there are initial approaches for implementation with PHP (Wax Framework), Smalltalk, C ++, C #, Ruby, JavaScript and Python.

Web links

  • Trygve Reenskaug, James O. Coplien: The DCI Architecture. A New Vision of Object-Oriented Programming . Ed .: Artima. March 20, 2009 ( artima.com [accessed February 14, 2010]).
  • Trygve Reenskaug: The Common Sense of Object Oriented Programming . Ed .: Department of Computer Science, University of Oslo , Norway. April 13, 2009 ( uio.no [PDF; accessed February 14, 2010]).
  • object-composition - Google group with discussions and first implementations of DCI for different programming languages
  • Richard Öberg: Qi4j - code, examples and demo . Lecture at Øredev 2008 on Qi4j, Data Context Interaction and Domain Driven Design
  • James O. Coplien: The DCI Architecture: Lean and Agile at the Code Level . Lecture at QCon, June 30, 2010

Individual evidence

  1. Composite Oriented Programming ( Memento of the original dated December 16, 2010 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / iridescence.no
  2. ^ Trygve Reenskaug, James O. Coplien: The DCI Architecture: A New Vision of Object-Oriented Programming . ( Memento of the original from September 29, 2017 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. March 20, 2009 @1@ 2Template: Webachiv / IABot / www.artima.com