What is the difference between extends and mixes


In which cases should we use extends, and in which cases should we use mixes?


The “extends” keyword indicates that the Type should participate in an “is-a” relationship
Example: A Department is a type of PartyRole. A Supplier is another type of PartyRole. Use extends if you want to create a subclass.

Mixes denotes a composition relationship and the fact that hey type participates in a “has-a” relationship. Use mixes if you want to inherit functions and attributes.

Don’t forget that there is also “remix”, which allows users to extend a type directly.