Database design is an important task for each software developer. It is in most software development projects crucial to understand the real world problem thoroughly and to be able to design the most simple database design possible. The key to success is as well a good understanding of the problem given as the ability to simplify the real world to a good model. The most talented designers master the art of designing a data model that is universal and versatile and continues to work unchanged when there will be added entities and attributes in the future.
The real world is full of objects. If you look around you and think a bit you will find
We call each class of objects of the same type entity (from latin ens being).
An entity is usually represented in software by a form. In table-oriented databases, an entity can also very easily be understood and represented as a table (consisting of rows and columns). In Protogrid, each entity is defined as a Proto, a special Design Card that is used to define the attributes, appearance and behaviour of Data Cards.
Entity records have different names in literature. In table-oriented databases it is represented as a table row. More generally it is called a tuple, i.e. a set of attributes defined in an entity. In Protogrid, records are represented as Data Cards. An entity usually has many records. Each record has a unique key that allows to identify the record. In Protogrid, that key is called a Card Key.
An entity has attributes. Each attribute describes a part of the entity. In table-oriented databases, an attribute is represented as a table column. In Protogrid, attributes are represented as fields on a Data Card, and are defined using Field Definitions on the Proto. Field Definitions are another type of Design Card, responsible to define the behaviour and appearance of fields.
As an example, a house might have the following attributes:
An attribute is typically of a specific data type, like:
Often there are relations between entities.
For one mother there might be many, one or no child. We call this a 1-to-many-relation and write 1:n, with n representing the variable number of children. 1 and n are often called the cardinality of an entity in a relationship. In database design, the variable n is usually repeated for each of the relations, even though each represents the cardinality of a different entity.
Many times we see mother-child-relations:
How do we represent these relations in a software's user interface?
This knowledge is already enough to build many different types of applications.
That's all folks! It really is that simple in Protogrid. This is where Protogrid truly shows its Rapid Application Development capabilities.
There is one more important variant of relations:
Sometimes a child has not only one related entity (like a mother - there is only one for each child on this planet) but many. The closest example to think of are siblings.
Examples:
For the sake of simplicity any n:m-relation might be split into two 1:n-relations
Examples:
In Cards of the first Proto you now can see all relations to the other Proto. And in Cards of the second Proto you can see all relations to the first Proto, which is exactly what we need in these cases.