You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example spec, there's a question if the color select event should inherit from a PointerEvent, or should be a new event type that contains an optional reference to the pointer event.
This raises the general question, of when should we recommend composition vs inheritance. We should do some spelunking and look for existing patterns.
The text was updated successfully, but these errors were encountered:
I cannot find the discussion that prompted this, but generally inheritance is for "is a" relationships, while composition of the type described in the OP (a property pointing to another object) is for modeling all other types of relationships.
The Liskov substitution principle is a good test for this.
This was brought up in our discussion of w3ctag/design-reviews#587.
In the example spec, there's a question if the color select event should inherit from a PointerEvent, or should be a new event type that contains an optional reference to the pointer event.
This raises the general question, of when should we recommend composition vs inheritance. We should do some spelunking and look for existing patterns.
The text was updated successfully, but these errors were encountered: