Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ault Nathanielsz 87 posts 407 karma points c-trib
    Apr 29, 2019 @ 13:02
    Ault Nathanielsz
    0

    Doctype... inherit vs child

    There are certain common elements that I want certain doctypes to have. (E.g. all web-pages should have short names, descriptions, associated images, meta descriptions, etc.)

    I can achieve this by making a master doctype. Then, when I make other doctypes I can either use inheritance or make them as children of the master doctype.

    On the face of it, there doesn't seem to be much difference between the methods. However, I fear that there may be a good reason (or several pros and cons) for using one method over the other. Any thoughts on using inheritance over parent-child?

  • Rhys Hamilton 140 posts 942 karma points
    Apr 29, 2019 @ 13:32
    Rhys Hamilton
    1

    If you go down the inheritance via Composition, then you've got the flexibility to include your "master doctype" settings in any document type that you like, regardless of how things are structured - and then can easily remove this if required.

    If you use the inheritance via Parent-Child relationship, then every child will have the default settings as standard, which you might not necessarily want to have. So you'll have to move the child outside of the parent to remove this inheritance, which might not always feel intuitive.

    As you pointed out, there isn't a huge difference for your particular scenario, but if you're looking for a bit more flexibility and freedom as your project grows, I'd recommend using inheritance via Composition. approach.

Please Sign in or register to post replies

Write your reply to:

Draft