GAI main classes - makingthematrix/gailibrary GitHub Wiki
To access GAI, the developer will have to create an object (or maybe access a singleton - not decided yet) of the GAI
struct:
struct GAI {
cells: CellRegistry
cellTypes: CellTypeRegistry
functions: FunctionRegistry
graphs: GraphRegistry
ids: Identifiers
conf: Configuration
}
All the names may still change, especially these *Registry
names. I've read once that if a programmer does not know what the object really does, she names it a "manager". It's a bit like this here. The main object, GAI
, wraps together "registries", ie. maps of CellId
to Cell
, CellTypeId
to CellType
, FunctionId
to Function
, and GraphId
to Graph
. Each registry will also provide utility methods specific for the given type. On top of that, Identifiers
can be used to generate and maintain ids used in these four, and Configuration
will hold configuration data. Plus, GAI
itself will provide methods to setup everything, run iterations, and collect results.
This might be a good moment to stop and think about what form of Dependency Injection I want to use. It's a big subject, but one I prefer to leave for later. I have a feeling that in this case making a decision too early might result in that, as the library grows, I will be forced to use a solution which doesn't really fit the architecture. So, I think that while GAI is small I can live without deciding on a specific solution. I will come back to it when the first working version of GAI is ready.
Apart from the GAI
data structure, the library will provide a few utility classes with generic functions, function builders, operations on sets, etc. - anything that may make the programmer's work easier. I hope that in the future I will be able to expand these classes with new functions written by others, or by me but because of the feedback I'll get from people using GAI.
Identifiers <- | -> The main loop