Ok this confirms my gut that aggregate (shared aggregation) is better to start with as it gives wiggle room rather than composition (composite aggregation). Make everything shared aggregate until single absolute ownership is needed/wanted by the part. “@user:It depends on how you want to design your application. I don’t think a board owning the pieces makes sense. But possibly the player can own the pieces? However, probably a ChessGame instance is even a better owner for the pieces, in which case board and player would both show aggregation. Also, you may not know the best choice for owner until you start doing sequence diagrams. Thus, start out with aggregation and let your design tell you who should own the pieces. More often than not, the flow of your sequence diagrams makes this obvious.”

Ok this confirms my gut that aggregate (shared aggregation) is better to start with as it gives wiggle room rather than composition (composite aggregation).

Make everything shared aggregate until single absolute ownership is needed/wanted by the part.

“@user:It depends on how you want to design your application. I don’t think a board owning the pieces makes sense. But possibly the player can own the pieces? However, probably a ChessGame instance is even a better owner for the pieces, in which case board and player would both show aggregation. Also, you may not know the best choice for owner until you start doing sequence diagrams. Thus, start out with aggregation and let your design tell you who should own the pieces. More often than not, the flow of your sequence diagrams makes this obvious.”

Leave a comment

Your email address will not be published. Required fields are marked *


seven − 6 =

Leave a Reply