Almost every attribute type will convert their logical value into one of those primitive values before storing it. This happens because we don’t create a custom database schema for every possible attribute type – they all have to make do with a general schema, so their values have to be converted to a store-able form.
This is a fundamental theme of CMS in general – we’re storing highly custom data in a generalized system. If we created a custom storage system for everything then we wouldn’t need a CMS. Indeed, our desire not to do this is why we have CMSs in the first place.
A CMS is, in many ways, just a customization or an extension to an underlying datastore. Every CMS is backed by some datastore – usually a relational database. Any database will store information. What makes a content management system are the services it provides over and above simple storage.
We’ll discuss the idea of a content service model in a later chapter.
The concept of converting a more complex data structure to a simpler one for storage is called serialization, while the process of restoring the complex structure from the simpler value is deserialization.
For example, if we need to edit and store a set of map coordinates, we will likely give our editors a visual map interface from which to pick a location. When they do, the CMS will serialize that logical value – the set of coordinates, and perhaps the zoom level the editor was at when they picked it – into something simpler. The actual value stored in the database is just a string of structured text, like this (XML, in this example):
<coordinates lat="43.55" long="-96.7" zoom="1.5"/>
Next time the editorial interface for this attribute needs to render and populate with the stored value, the CMS deserializes that XML back into the logical location value, and uses it to position the map in the editing interface.