This week I had to implement a backend that stores report templates and filled reports in a database. Because I am used to thinking of data in a hierarchical way, I directly envisioned the template as containing entries of various kinds, a title, and the like. This is easily obtained in an OO design as an object with a lot of entries, and these entries are objects of classes that extend a general entry class. So far so good, but I wasn’t sure how to store this in a relational database and my implementation seemed more like it OO counterpart than I like.
The main issue though comes to transitioning between the two representations (or three if you include the JSON representation used to communicate the data with the frontend devices). I am using the Data Access Objects provided by the Exposed library to interface with the database. I found myself creating an additional set of classes that implement my hierarchical design and control the order in which the DAOs are created, how they linked, how they are stored, and how they are retrieved. I am rather uncomfortable with the design of these classes so far. It feels that I am making more effort than I should. Maybe I am not utilizing the relational model perfectly or maybe my data is more suited to other alternatives like some NoSQL Dbs. I will look into it and keep you posted.