When it comes to class diagrams, can an association or aggregation exist between two objects that are in composition with one base object?
Example:
Class Car
has a composition relation with class Engine
and class Fueltank
. So Car
has An Engine
and a Fueltank
, and Engine
and a Fueltank
are dependent on Car
. But Engine
also needs information from Fueltank
, without intervention of Car
(in accordance with a sequence diagram for example). That means Engine
and Fueltank
also have a relationship although, they're both compositions of the Car
. See diagram below:
So, the question is, may such “loops”, or better redudant associations, in class diagrams occur? Or does that undermine the rules of OOP?