2021/11/08/data objects refactoring
Jump to navigation
Jump to search
I'm making some changes to the data objects management system for #Ferreteria v0.5.
at present
Database instantiation is currently done by cDatabase::Instantiate()
, which uses an internal static table to look up the cDatabase
-descendant to instantiate from a slug returned by cDatabaseSpec->GetTypeString()
.
I suddenly realized that this makes no sense:
- the cDatabaseSpec-descendant should just return the class it wants to use, from
->GetDatabaseClass()
cDatabaseSpec
can instantiate directly, e.g.cMainDBSpec->MakeDatabase()
.cDatabase
should be namedcaDatabase
, because it is abstract.
TO DO
- rename
cDatabase
tocaDatabase
- rename
cDatabaseSpec
tocaDatabaseSpec
- replace abstract
caDataSpec->GetTypeString()
method withcaDatabaseSpec->GetDatabaseClass()
- write
caDatabaseSpec->MakeDatabase()