HUGE Milestone: RTTI Enabled Context and OPF

Written by SysOp on 2019-07-08 06:51:36 updated 2019-08-11 13:48:43; 0 comments

A couple of big milestones here. I've known for quite some time that Object Pascal (Delphi, FreePascal, ...) keeps type information for published object properties available for run-time inspection (RTTI). I've just not had the occasion to jump in and check out what's there. But it definitely seemed like what I needed here. So in I dove.

I've completed my initial application of RTTI to the template "context" system. Now templates can draw data from flat variables, objects and the properties and objects they publish. I dug into FPC's fpWeb source and published several key bits of data from objects that are likely to be wanted during page rendering. These are now available in templates along with whatever other data a view chooses to make available.

I also have a functional start on an Object Persistence Framework (OPF), sort of like an ORM, but without the requirement of a "Relational" database. I can read and write the published properties of any object class to and from a container of any kind that supports reading RTTI. As an example I can now read an object from a TSV file and store it into a SQL database server or visa-versa. Or its now trivially easy to dump data from my SQLite dev DB and push it to my production MariaDB server.

These two achievements make one HUGE milestone since I can now load objects from a DB, store them in a context for rendering via a template into a webpage. Think: Django, Ruby on Rails, ... but with the performance of a native-code compiled language! Actually I could generate any kind of content that can be expressed with a text based template. These make up the core components for building data driven websites!

Although I still have quite a lot to do before these things become complete solutions, things are now likely to start moving pretty quickly.