Skip to content

Instantly share code, notes, and snippets.

@jbowles
Created November 23, 2012 14:54
Show Gist options
  • Save jbowles/4135988 to your computer and use it in GitHub Desktop.
Save jbowles/4135988 to your computer and use it in GitHub Desktop.
Horizon First Draft

Horizon

Transactional system that defines a set of primitive and composable concepts. It is inspired by Finite State Grammars.

ABSTRACT

Finite State Transactional Grammar. I don't know if I made up this term, so I won't claim to have invented this, but I'm running with it. What is sketched here is a transactional system inspired by finite state machines, finite state grammars, rule engines, map-reduce algorithms, functional programming (namely Clojure and LISP), business intelligence, and the rubygem Hero.

Hub

Each modular application is a hub. A hub is a center of activity for its dedicated formula. It is responsible for verifying the integrity of inputs-outputs and compliance of its transactions.

Formula

Any step or set of steps defined by either business and technical needs.

Step

Algorithms, processes, change of state, events.

Node

Each hub has at least one node. Each node is responsible for returning a Boolean/Binary value to determine whether or not its dedicated operation executed sucessfully.

Integrity

If a node successfully executed then all transactional data is complete and sound.

Integrity = complete + sound

Complete

All data relevant to a transaction exists.

Sound

All data within a transaction is correct.

Stable

Transactional system is considered stable if the integrity returns true.

Finite State Grammar Details

Composables and Primitives

Composables are composed of the outputs of allowed primitives (in some cases a composable can be composed of themselves).

Composables

  1. Hub (hub, node) [A Hub can be composed of at least one hub and/or one node]
  2. Node (formula) [A Node can be composed of at least one formula]
  3. Formula (formula, step) [A Formula can be composed of at least one step and/or one formula]
  4. Step (step) [A Step can be composed of at least one step]
  5. Integrity (complete + sound) [Integrity is composed of at least one complete AND one sound]
  6. Stable (integrity) [Stable is composed of at least one integrity]

Primitives

  1. Step (from the transaction system's point of view a step is primitive)
  2. Complete
  3. Sound

Return Values (Outputs)

A Boolean is a True/False, a State is any other kind of value.

Composables

  1. Hub returns [State (accepts from Formula, no change), Boolean (accepts from Formula)]
  2. Formula returns [State (accepts from Step, no change), Boolean (accepts from Step)]
  3. Step returns [State (set values), Boolean (set values for sound and complete)]
  4. Node returns [Boolean (accept from Step, pass to Integrity), State (passes State from Step to Formula, no change)]
  5. Integrity returns [Boolean (accepts from Node(sound(true/false),complete(true/false)))]
  6. Stable returns [Boolean (accepts from Integrity(true/false))]

Primitives

  1. Step returns [State (set state, only piece that can change state), Boolean]
  2. Complete returns [Boolean]
  3. Sound returns [Boolean]

Misc. Notes

In other words, only Steps are allowed to change and persist state, while Formulas manage and co-ordinate Steps. Since Formulas are composed of Steps, and Hubs compose of Formulas the States are accessible by, and percolate up to, the heirarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment