-
Notifications
You must be signed in to change notification settings - Fork 4
schema overview
Almost every system design starts with defining domain models, what do they consist of and how they relate to each other. This is the language PMs and customers understand and it allows to set up universal dictionary for interfaces and implementations. So lets start with a few abstract entities:
Every entity can be described by multiple representations: ID, URI, record or even binary data like images. We can capture this concept by introducing multi-types, collections of types that can act as different representations of the same entity.
User
is a multi-type that can be either UserId
or UserRecord
, File
can
be either FileId
or FileRecord
and so on.
Now we have records, fields and field types. FileRecord.name
is probably
a string, but what’s the type of FileRecord.owner
? Before deciding on it lets
step back and think about the nature of a field. Fields define relationships
between entities and field names hint at their semantics. We don’t care about
implementation details at this point, all we want to say is that a File
has an
owner which is a User