Previous: The Swarm Design Pattern, Up: Three Design Patterns



2.3 The Incubator Design Pattern

The Incubator design pattern does not quite extend the Swarm, but rather restricts the exposure used and the residents that are allowed. Firstly, Incubators use the same kind of exposure, which is based on ASCII strings. And secondly, only two kinds of residents are allowed: on the one hand, passive ligands, which are simple strings; and on the other hand, processing units, which are general programs that can perform certain operations on ligands. We discuss these two topics in parallel. A ligand is an ASCII string. As a resident of the Swarm underlying an Incubator, it exposes a single projection, whose marker is a simple ASCII string. Processing units can recognize fragments of this string (as described later) and bind to it. When a processing unit is bound to a fragment of a ligand, that fragment can not participate in further matching operations until the binding is released. However, many processing units may be bound to the same ligand, as long as the fragments they're binding to do not overlap. Processing units are general residents of the underlying Swarm. They can expose multiple projections. However, the projections fall into one of two kinds: ligand binding projections, which bind to ligands as discussed above, and structural binding projections, which bind to other processing units. The marker type of ligand binding projections on a processing unit is the matcher, which is just a regular expression able to bind to fragments of ligands. The marker type of structural binding projections on a processing unit is the snippet. A snippet is a pair consisting of a string and a matcher. Two snippets s1 = (str1, mat1) and s2 = (str2, mat2) match if and only if str1 matches mat2 and str2 matches mat1 — that is, the strings and regular expressions must match crosswise. Snippet matching captures an essential biochemical feature: when proteins interact, they both need to recognize a region of their companion, while at the same time expressing a complementary region. FIXME: Insert graphic.

FIXME: Woops — explain how the affinity in the Incubator is computed, depending on the lengths of the strings which are being matched.

Processing units are otherwise general-purpose residents. They are free to react to binding and release actions, and can emit orders to the Incubator as well to release ligands, change markers, change ligands, etc. More precisely, in a processing unit to ligand interaction, the processing unit may:

  1. Release the ligand.
  2. Change the string underlying the ligand.
  3. FIXME: Split the ligand and/or join ligand fragments.
  4. FIXME: “Slide” along the ligand.
In a processing unit to processing unit interaction, each processing unit may:
  1. Release the other processing unit.
  2. FIXME: Create a communication “channel” with the other side for arbitrary communication?
For more information, see the signature source file incubator.mli, which contains an implementation-free description of the capabilities of the Incubator layer.

In addition to the residents (ligands and processing units), the Incubator needs a harness in order to be fully operational. The harness has the same abilities as in the Swarm. We enumerate them again here:

We proceed to give a simple application example of the Incubator, and a quick overview of a possible way to interpret the Incubator, the “Turing Soup”.