I was talking with a programmer pal of mine about inheritance and its use in designing models. He's a big proponent and I'm a little more tepid. Mostly because I tend to design systems from the bottom up: Database -> Application -> Presentation (honestly, I'm not much of a front-end guy, so I often leave presentation entirely to someone else). I find that relational database systems don't support inheritance without a lot of 1-to-1 relationships to other tables.
If I'm designing from a conceptual standpoint, an Administrator is a User is a Person. Starting from the database up, an Administrator is a User with UserType = "Administrator". Reconciling these approaches seems difficult to me, and therefore I only use inheritance with non-persisted objects.
What's wrong with my thinking? Why is inheritance such an oft-celebrated aspect of OO if it has these inherent incompatibilities with traditional relational structures? Or, is it me who's not mapping inheritance properly to relational data? Is there some guidance out there that might clear this up for me?
Sorry for the rambling question and thanks in advance for your answers. If you include code in your response, C# is my "native language".
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…