On Fri, Apr 25, 2008 at 3:26 PM, Ian Kelly <[EMAIL PROTECTED]> wrote: > Purely in terms of OO design, because it's cleaner. Object > composition is usually a more appropriate paradigm than class > inheritance. To take the example from the post that started this > thread, the relationship between users and user profiles is "has-a", > not "is-a". So what would be the design benefit of applying > inheritance here in the first place?
Not to get too much into this discussion, but I tend to be slow to understand design patterns and other paradigms. What then would be the appropriate way to handle an app that managed authors? I can see two possibilities: class Author(User): pen_name = models.CharField(max_length=255) or class AuthorProfile(models.Model): user = models.OneToOneField(User) pen_name = models.CharField(max_length=255) Essentially, whether it has the semantics of an "is-a" or a "has-a" relationship seems to depend solely on what name I give the class. Clearly a user could "be an" author, while he/she could instead "have an" author profile. How would I proceed in a situation like this? -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---