Relative Content

Tag Archive for aggregate

Is this an example of a composition or aggregation? [duplicate]

This question already has answers here: Aggregation vs Composition (9 answers) Closed 7 years ago. Composition and aggregation both are confusion to me. Does my code sample below indicate composition or aggregation? class A { public static function getData($id) { //something } public static function checkUrl($url) { // something } class B { public function […]

Aggregate design for a fuel tank with deliveries and fill level readings

So I’ve got a rather simple, mostly crud application I want to use DDD with, to learn/practice it. I wonder about aggregate design regarding a fuel tank entity. Each tank stores fill level readings (date, fill level), usually one each year, and gets several deliveries of fuel per year (date, amount, cost).
Looking at invariants, the two collections are independent from each other, and I can only see one business rule for the fill level readings: there must only be one reading for any given date.
Regarding usage patterns, the two collections are edited independently as well, because a delivery rarely happens on the same day that readings are taken. When reading a tank to display it, however, the most recent values of both collections are also needed.

Aggregate design for a fuel tank with deliveries and fill level readings

So I’ve got a rather simple, mostly crud application I want to use DDD with, to learn/practice it. I wonder about aggregate design regarding a fuel tank entity. Each tank stores fill level readings (date, fill level), usually one each year, and gets several deliveries of fuel per year (date, amount, cost).
Looking at invariants, the two collections are independent from each other, and I can only see one business rule for the fill level readings: there must only be one reading for any given date.
Regarding usage patterns, the two collections are edited independently as well, because a delivery rarely happens on the same day that readings are taken. When reading a tank to display it, however, the most recent values of both collections are also needed.