Synopsis: Polymorphic Associations

Let’s look at an antipattern that originates from multiple inheritance relationships.

Let’s allow users to make comments on bugs. A given bug may have many comments, but any given comment must pertain to a single bug. So, there’s a one-to-many relationship between Bugs and Comments. The Entity-Relationship Diagram for this kind of simple association is shown below.

Get hands-on with 1400+ tech skills courses.