Thursday 19 July 2018 — This is over six years old. Be careful.
When talking about classes, and how they relate, there are two classic relationships. Class Y can inherit from class X (inheritance), or class Y can use class X (composition). In the first case we say that an X is-a Y, in the second that an X has-a Y.
Sometimes it isn’t clear which choice is best, and you can imagine using either. One thought that can help decide: is it part of X’s essence that it is a Y? Is it impossible to think of an X that isn’t a Y? Or is Y just a helpful implementation detail of X, and there are other possible ways to build X?
I don’t want to open a can of worms debating licenses, and probably this is an absurd analogy, but it occurred to me that copyleft license (GPL) advocates view their license choice as an is-a, and permissive license (BSD, MIT, Apache) advocates view theirs as a has-a.
Comments
In the analogy, what is the subject (the left-hand side) of the “is-a” or “has-a” relationship? The work of software? The project? The recipient? Something else?
Can you edit the article to give some example sentences, of the form “FOO is-a GPL” and “BAR has-a- BSD” so that we can see what you think is a fitting example of “FOO” or “BAR”?
Add a comment: