What makes a good datamodel? – Point 2: Flexible

Trying to model humans is probably the easiest way I know to break an inflexible model. Why? Because humans are recursive – that means they keep repeating the same thing and also they keep changing the rules! Humans start off as a child and become parents, they form relationships with each other, they marry each other and they can now change gender. If you designed your database schema in the 1500’s you would have had to rebuild it several times since!

A person has many different roles in life; child, parent, friend, employee, customer, manager, driver, passenger.  Each of these roles comes with a set of information relevant to it, and new ones are being invented all the time. 

Information in an industrial asset is much the same; it is always being generated and the format and content is whatever it needs to be to achieve the business goals. 

Now, here’s thing, you need this flexibility within the context of a useful structure.  You could make your storage completely flexible but also completely useless, for example by just storing everything as plain text.  But then every application you write has to do all the interpretation of that information from scratch. 

The data model needs to return rich objects that carry usable information to minimise the overhead on downstream applications; for example, if something is a time or date then it should be in a recognised DateTime format etc. 

What you need to be able to is add new roles to objects over their lifetime and link them to other objects.  Oh, and these relationships need to be time bounded as well – some objects are only related to each other for a fixed period of time, for example when you take a flight on a plane. 

So guess what, I’m going to bring up a Class Library again! And specifically “multiple inheritance”.  An object needs to be able to have multiple difference classes simultaneously.  Role on the next blog on the Class Library!

written by

Murray Callander

posted on

June 25, 2020

you may also like...