Works::BaseWork
Works::
WorkBehaviors
PCDM::
ObjectBehaviors
Sufia::GenericWork
Sufia::
WorkBehaviors
Works::
HasMetadata
etc...
Sufia::
ModelMethods
etc...
Dissertation
ScannedBook
GISDataset
PCDM::Object
Connect the Dots
The blue items all exist in their corresponding code bases. Squares represent classes, Plus signs (“+”) represent modules.
What are the different ways you can get the desired behaviors to cascade from top to bottom so that they all will be present in the classes at the bottom (ie. Sufia::GenericWork, Dissertation, etc)?
See your options in the other slides...
Works::BaseWork
Works::
WorkBehaviors
PCDM::
ObjectBehaviors
Sufia::GenericWork
Sufia::
WorkBehaviors
Works::
HasMetadata
etc...
Sufia::
ModelMethods
etc...
Dissertation
ScannedBook
GISDataset
PCDM::Object
Single-Inheritance
This approach uses single inheritance, but the actual behaviors are all in modules that could be mixed together using multiple inheritance.
Note: Making Works::BaseWork a subclass of PCDM::Object would prevent the “mixins-only” approach in Slide 3 because we would not be able to make Works::WorkBehaviors include PCDM::ObjectBehaviors
Works::BaseWork
Works::
WorkBehaviors
PCDM::
ObjectBehaviors
Sufia::GenericWork
Sufia::
WorkBehaviors
Works::
HasMetadata
etc...
Sufia::
ModelMethods
etc...
Dissertation
ScannedBook
GISDataset
PCDM::Object
Multiple Inheritance
(In ruby vernacular, people often talk about this in terms of “mixins” not inheritance)
This approach uses only mixins/modules, with no Superclass relationship. Though PCDM:Object, Works:BaseWork and Sufia:GenericWork are available for others to use as superclasses, this implementation doesn’t use them.
Note: This would not prevent downstream code from using inheritance (see slide 4).
Works::BaseWork
Works::
WorkBehaviors
PCDM::
ObjectBehaviors
Sufia::GenericWork
Sufia::
WorkBehaviors
Works::
HasMetadata
etc...
Sufia::
ModelMethods
etc...
PCDM::Object
If Sufia Chooses to use Single Inheritance
This shows how something downstream of hydra-pcdm and hydra-works can choose to use single inheritance without this blocking others from using multiple inheritance (mixins).
Dissertation
ScannedBook
GISDataset