How would you model/program the following:We have items in our domain, let's say cars. We also have categories for cars. A category has certain characteristics. So for example we could have a car named Model A and place it in the category Sedan. The Sedan category has the characteristics 'five-doors' and 'five adults' (I'm just making it up as I go).So our Model A car has these two characteristics, just by the virtue of being added to the Sedan category.But now we want to add certain characteristics on top of that, even if they are from other categories. That's the easy part, just link the car to a category and link the car to separate characteristics.But what if we want to override one of the characteristics from the Sedan category by removing it?So in essence, we want this:Model ASedan categoryfive-doorsfive adults // we never want this characteristicextra characteristics:sporty // we've added thisI hope this is clear. I easily see how we can link a car to a category and link a car to characteristics (via many-to-many relationships, both in code and database). But how would we remove one of the characteristics of a category the car is linked to?Is this a good solution?Model ASedan categoryfive-doorsfive adultsextra characteristics:sporty // we've added thisremoved charcteristics:five adults // we never want thisGetCharacteristics // implement logic to combine the above info
How would you model the persistent removal of child elements of a child element?
domain model