2021/11/08/data objects refactoring

From Woozle Writes Code
Revision as of 18:34, 8 November 2021 by Woozle (talk | contribs) (Created page with "I'm making some changes to the data objects management system for Ferreteria v0.5. ==at present== Database instantiation is currently done by <code>cDatabase::Instantiate()</c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 named caDatabase, because it is abstract.

TO DO

  • rename cDatabase to caDatabase
  • rename cDatabaseSpec to caDatabaseSpec
  • replace abstract caDataSpec->GetTypeString() method with caDatabaseSpec->GetDatabaseClass()
  • write caDatabaseSpec->MakeDatabase()