Get in touch
Think that we can help? Feel free to contact us.
Today I’m going to answer the question that’s been on your mind all month “What are data models & can they be used to describe pop songs?“
For this example I’m going to use “Message in a Bottle” by The Police - a nice classic from the 70s.
Just a castaway
An island lost at sea
Another lonely day
With no one here but me
More loneliness
Than any man could bear
Rescue me before I fall into despairI'll send an SOS to the world
I'll send an SOS to the world
I hope that someone gets my
Message in a bottle
“So far, so catchy” you say “But what is a data model & how does it relate to pop songs or bottles?”
Data models are how we organise data in the applications we develop. At the most basic level data models define the relationships between different bits of data.
Data models always start somewhere & for this example we start with a Castaway on an Island.
Castaway
Belongs to: Island
Has one: Message
Island
Has one: Castaway
Boolean: IsLost
A Boolean is something that is true or false. In this case we know the Island is lost We also know that Castaway is the only one of the Island. The Island can’t have more than one Castaway.
The Castaway has a Message in a Bottle & the Message is a SOS.
Message
Belongs to: Castaway
Belongs to: Bottle
IsSOS: Boolean(true)
You can only put a Message in one Bottle. But we need to keep in mind that a Bottle could have many messages.
Bottle
Has many: Message(s)
Hopefully this makes sense so far. But the third verse adds some more complexity:
Walked out this morning
Don't believe what I saw
A hundred billion bottles
Washed up on the shore
Seems I'm not alone at being alone
A hundred billion castaways
Looking for a home
Crikey - there are many Castaways! How do we change the data model to factor this in? Well the second line of the first verse is:
An island lost at sea
Which means we need to add:
Sea
Has many: Island(s)
But island has to change too - it belongs to the Sea & has a Shore, which can have many Bottles.
Island
Has one: Castaway
Belongs to: Sea
Has one: Shore
Shore
Belongs to: Island
Has many: Bottle(s)
And finally we need to recognise a Bottle can be on one Shore at a time - whether it belongs to a Shore is up to debate.
Bottle
Has many: Message(s)
Has one: Shore
Phew! Who knew existential angst could be so complicated or turned into a logical data model?
But there we have it - a pop song turned into a data model that could be implemented into any modern application framework.
Many of our projects start with defining a data model & hopefully the above example gives you some idea of how a data model can be designed from anything - be it a pop song or your business process.