Archive for the ‘Coding’ Category

Rules of Abstraction I

Thursday, March 26th, 2009

Alright, here finally is an entry about programming stuff ;)

MetaManager To ease my efforts in implementing new applications that have to access data I have begun writing a abstraction layer for a database (e.g. MSSQL). The aim is to get rid of having to write SQL code inside an application and thus be able to just rely on the layer to do any necessary communication with the data source (not only database but also xml-file, webservice, or just memory).

Data source Abstraction
Layer
Application

The Abstraction Layer is a set of classes centered around one metaDataPool class, which contains all the functionality needed to manage the data within the application. The number of tables in the database is fixed, so all structural information for any data model needs to be contained in the data, not in the table structure (columns). There are tables for classes, their attributes, relationships, their attributes, and tables for users, projects (namespaces), and hierarchical data storage (folders).
An instance of the metaDataPool class keeps all this information and by its methods the information can be manipulated and without extra programming be stored in the respective data source.

metaDataPool dataPool;
metaQueryResult result =
metaDatabaseDataPool.Create(connectionString, out dataPool);
if (result.OK)
{
foreach (metaClass c in dataPool.Classes)
{
Console.WriteLine(c.Name);
}
}

screenshot…more to come…