0

Am I understanding multiplicity and aggregation here?

The Idea I'm trying to get across is that:

  • Each character has a spell book.
  • Each spell book has an array of 4 spells. (This is where things look a little weird to me)

enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Looks correct to me. You could even argue that the aggregation can be refined to a composition: http://aviadezra.blogspot.de/2009/05/uml-association-aggregation-composition.html – Christoph S Apr 11 '18 at 20:06

1 Answers1

0

That's basically ok. The SpellArr is a (wrongly placed and capitalized) redundant attribute. Rather you should use dot-notation together with the role name spell (which should be spells instead). Also the hollow diamond should be removed as it has no useful semantics. See p. 110 of the specs:

Indicates that the Property has shared aggregation semantics. Precise semantics of shared aggregation varies by application area and modeler.

enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Annoying downvote without providing any justification! – Gerd Wagner Apr 12 '18 at 09:38
  • It seems that the design model for the `Character` class can be simplified by modeling `SpellBook` as a complex datatype with a `spells` property and a `castSpell` method. Then `Character` would simply have a `spellBook` property and there would be no need for an association. – Gerd Wagner Apr 12 '18 at 09:46
  • @GerdWagner Yeah, but I don't care about down votes any more. That just happens :-/ You are probably right about the design issues, but that would take it too far off. I always found it the most interesting part to scribble the design to a whiteboard and discuss it with others. – qwerty_so Apr 12 '18 at 10:01
  • I'll compensate the annoying downvote with an upvote. – Gerd Wagner Apr 12 '18 at 17:01
  • I should look up some of your posts to give you one back :-) Thanks! – qwerty_so Apr 12 '18 at 20:09