- for "missing?" we often need to query database to check if an item exists. If predicates are truly independent, we will need to do the query again to return the item.
- "data flow" looks something like this (in Prismatic's Graph lib):
(def stats-graph
{:n (fnk [xs] (count xs))
:m (fnk [xs n] (/ (sum identity xs) n))
:m2 (fnk [xs n] (/ (sum #(* % %) xs) n))
:v (fnk [m m2] (- m2 (* m m)))})
or as a picture:
This is basically a data structure that more-or-less explicitly encodes data dependencies between functions and allows to check stuff like "all data needed for a function is already computed when it's called".
On the other hand, "decision graph" (it can be encoded as FSM, as in the case of your HTTP decision diagram) is all about callbacks and outcomes. In all practical implementations that I've saw, callbacks were allowed to pass something "downstream" (in state
or query
) to solve the problem mentioned in (1). However, this introduces implicit data dependencies between callbacks that are inferior to explicit "data flow" model.
Therefore, it seems preferable to somehow "merge" both approaches, but I don't know yet how. It would be interesting to hear your thoughts on this.
✅
I don't know if that's so much of an opaque bucket anymore. There must be a few callbacks that are inherently without a spec-ed output (but still a spec-ed input I think), and thus flexible. They return a blob that is indeed opaque to the "http decision tree" and to the "callback dependency tree" (including here the specification of the callbacks' args), but it is not opaque with relation to the callbacks themselves which are inherently "subjective" i.e. they run specific code, and thus at least some input source must be subjective.
The "callback dependency tree" (which after looking a bit at Graph, is nothing more/less than a graph) is not something that should be set in stone, abstractly, but something that may have a basic template for the specific HTTP backend to develop on (i.e. some callbacks not only return "opaque"/not-standardized output, but may have other dependencies than originally predicted as well or instead of modifying the standardized output)
Examples based on yours:
A. the
get
callback in the basic case would return some entity properties (which in most minds means non-meta data: a car's color). In the Datomic case, it would return some entity properties (the car's color) and meta-data: the etag. Truth be told, that is still entity data.B. In the Datomic case, the
get
callback could follow the "standard" basic type of output, with no non-meta data, and modify instead the dependencies: introduce a new callbackget-datomic
, which bothget
andget-etag
depend on.If I look at it from an ideal and modular PoV, B wins. From a practical/gain PoV, A wins (mostly because "etag" is still entity data, and thus it's a valid return of the
get
callback)