Sadie, A Dynamic Interspection Engine
In addition to having a gnu-style recursive moniker, Sadie is a key/value hash (like a lot of other projects), but it adds the idea of a framework of primers which get registered at initialization and executed when a value is requested with a key that has not yet been used to set a value. If a primer exists for a key, then the primer is executed and the value is computed and stored.
Primers are free to make requests from the Sadie object as well, such that the execution of a single primer's code may trigger hundreds of subordinate primers before returning the answer. In this way, Sadie allows a complex arrangement of interconnected data which references information from several sources (hence the interspection non-word part of the title) and transforms the information as needed to fulfill the request (hence, dynamic).
Because primers are executed on-demand as values are requested, small quick requests which touch only a small fraction of the data can be handled in an efficient way, requiring only the minimum amount of initialization necessary to answer the question at hand.
Further, Sadie offers some convenience features such as:
- allowing values to be selectively stored in memory or on disk, as dictated in the primer or via the setCheap and setExpensive methods.
- a pluggable primer file mechanism which allows new shorthand primer files such as database connections and/or queries, windows-style .ini files, and templating via ruby's erb facility.
- easy serialization and de-serialization.
Future versions of Sadie will:
- incorporate methodologies for incorporating testing into the data assembly mechanism itself, so much of the business logic will be testable in absence of real data.
- be multi-threaded, performing fetch and transform operations in parallel where possible.