Passing from classes to tables it’s really helpful and one of the most important parts when designing a program, so this is what you have to do to make sure your classes are now tables and your structure keeps remaining as good as it can be
Mapping attributes to columns
The classes will map to either zero or a number of columns in the database, but it’s important to know which one of them are going to be there to stay and which can be removed.
Implement inheritance in a relational database.
To accomplish this stage it important to figure out how to organize the inherited attributes or the ones that doesn’t fit in the main tables but that are still relevant to the system. So, to solve that there are three ways to do it:
- Mapping the class hierarchy to one single data entity
- Mapping each concrete class to a single data entity
- Mapping each class to its own data entity
Once this mapping stage it’s complete now it’s easier to determinate the rules of each table and relation, this is called constraint and keeps everything in order.
At this level now the tables are available and the relationship between each one of them is based on the behaviour shown in the previous class diagram, but now it represents only with different icons, such as the ones on the next picture. The arrows show the direction of the relationship, and the numbers on it represent the quantity of elements related to that relation.
Now that the table structure is ready it’s time to initialize the project and start coding!