If I have a People table and those people can be at different addresses, and each address can have more than one person, thats a many-to-many relationship.
So, using ORMs like Entity Framework and Django, I’ve got the hang of doing that. But my problem is that there are different types of people, like employees and customers and other clients that all have these fields also.
This would leave me with a top level class called Person which has a many-to-many relationship with Address and then these other classes (Customers, etc.) that inherit from person.
I read that there are different types of inheritance, so what would be the best approach?
4
Single-table inheritance is probably the easiest to understand and to maintain. That said, if you have a large number of differences between the inherited objects, you’re going to end up with an equally large number of null fields all over your table. When that becomes apparent, you can (relatively easily) switch to using multi-table inheritance.
Links refer to Entity Framework.
1