top of page

RIDDL

Our foundational open source software project that defines a compilable meta-language for building system designs based on DDD.

RIDDL

RIDDL

RIDDL, the Reactive Interface for Domain Definition Language, is a system specification language that describes systems using an extended DDD model. It is simple, strongly typed, syntactically regular, easily readable, message-driven, and extensible. We have designed RIDDL to be easy for humans to edit, AI to produce, and computer to process. It is intended to be the system of record for your software design.


RIDDL is fully open source via the Apache v2 License and available for separate use without Ossum's help or expense. This will never change as we want to encourage others to use RIDDL and show us how to improve it. We look forward to discovering what you do with it.


Domain-Driven Design Support

As defined in the following sections, many concepts from Domain Driven Design are supported in RIDDL.

Messages

The heart of RIDDL builds around just four message concepts that processing elements can handle:

  • command - an imperative to take some action, but it can be refused

  • event - a factual record of things that have happened

  • query - a request for information

  • result - the response to a query

Messages

Domain

While the word domain has many definitions, we use it here in the sense of these connotations:

  • A sphere of knowledge, influence, or activity, e.g., "the domain of biblical scholarship

  • The set of elements to which a mathematical or logical variable is limited, specifically the set on which a function is defined,

  • A territory over which dominion is exercised, e.g., "the forest is part of the king's domain"),

  • A region distinctively marked by some physical feature (or virtual attribute)


Consequently, in RIDDL a domain is a knowledge area, field of applicability, region of influence, or sphere of activity. Consider it a circumscribing boundary between "this" and "that." Domains allow you to apply the divide-and-conquer technique to segregate areas of knowledge. You can use them to contain taxonomies of things, the structure of your business, hierarchies of physical properties, or any related concepts your software needs. Just like package names in a programming language, domains group a related set of ideas and definitions.

Context

A RIDDL Context is a specialization of the Domain described above. Contexts provide a collection of definitions that form a ubiquitous language, per DDD, that concisely and precisely defines the domain. Contexts allow that ubiquitous language to be expressed in terms of Entity, Streamlet, Repository, Projector, Sagas, and Adaptors.


Entity

An Entity is an essential definition in your domain model, the bread and butter of domains, if you will. Entities in RIDDL are state machines with great flexibility and are based on the actor model. This is where your business or domain logic will be expressed. Entities distinguish themselves from other data types because they have a unique identifier that RIDDL provides and maintains.

Streamlet

A streamlet is an arbitrary processing element that has no data, but it can:

  • process messages it receives via an inlet,

  • produce messages to an outlet,

  • perform stream processing logic to map, reduce, sum, or otherwise alter the data flowing in a stream

  • perform any other domain logic

Streamlets allow your system model to decompose processing into discrete elements for clarity and simplicity.

Repository

A Repository in RIDDL is an abstraction for persistent storage. It is not necessarily a database or file but might be an API, non-volatile memory, or some other means by which data is stored permanently. Repositories define a very flexible schema for the data they hold and know how to translate incoming messages into the corresponding writes on the schema. Similarly, they can translate query messages to select the intended data and return it.

Projector

A projector is a definition that transforms events it receives into Repository updates. This capability allows us to take a data stream of facts (events) and translate it into a particular view of those events, commonly called a projection. Projectors are beneficial components of a CQRS design.

Saga

A Saga is a definition that provides for the atomicity of multi-step transactions using actions and compensating actions. It is a direct application of the Saga Pattern.

Adaptor

DDD calls this an "Anti-Corruption Layer", but we prefer to think of it as a Context-to-Context adaptor, or translator. Adaptors aid in keeping a Context's language pure since the same idea may be called different things in different contexts.


The riddlc Compiler

The riddlc compiler parses textual models written in the riddlc to turn them into an Abstract Syntax Tree (AST). It can then run various passes over the AST, such as:

  • Symbols - enter the names of defined things into a symbol table

  • Resolution—RIDDL uses textual "Path Identifiers" to refer to non-local definitions. This pass resolves those references for faster lookup.

  • Validation - With a resolved model, you can run various analyses on your AST model to ensure the model is complete and logical, find unused definitions, ensure style is consistent, and various other checks for validity

  • Prettify - With a valid model, you can transform the model back into RIDDL source but with consistent styling

  • Statistics - Generate some statistics about your model.

  • Custom - With little effort, you can write your own Pass implementation to do whatever you like with the AST content.



bottom of page