Take the 2-minute tour ×  I'm modelling a class diagram and I'm
absolutely stuck with this issue:  My new web application has
"cards" (entries about a subject) which can be modified by the
users, à là wiki. But unlike wikis, different cards hold
different data. Also unlike wikis, cards are interrelated with
other cards explicitly in the database. Let me show you how I
initially designed it using a dummy example:  /** Similar to
strategy/bridge pattern */ class Card<T extends CardInfoVersion>
is composed of T // container of versions class CardInfoVersion
// one version class Painting extends CardInfoVersion  class
Museum extends CardInfoVersion is composed of Paintings
Elegant, clean, but wrong. Using this approach, museums are tied
to painting versions, not to the painting itself. The first
solution that came off my head was this one:  class Card<T
extends CardInfoVersion> is composed of T class CardInfoVersion
class Painting extends CardInfoVersion class Museum extends
CardInfoVersion is composed of Card<P