Book a Demo

Author Topic: How do I insert this in a class Diagram  (Read 3331 times)

hello

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
How do I insert this in a class Diagram
« on: November 23, 2008, 05:21:24 am »
Hi there,

In the http://byfiles.storage.msn.com/y1paO8lFkvso_t4ZHNBN-9ojd7swzVnZp8nasuP9rS1bTDc6XBhgLqUAjQkRTGJqDkT?PARTNER=WRITERshows an image of two classes Item ansd Ledger.

Buiness rule say that :
1. "Ledger" can have maximum of 12 "Item" objects
2. In each "Item" object in the "Ledger" there can be maximum of 20 of the same item

Q:
1. What kind of relationship is this?
2. How do i put this in the class Diagram and how the references should be included into the classes?

cheers

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How do I insert this in a class Diagram
« Reply #1 on: November 23, 2008, 10:16:37 pm »
You're probably OK the way you have it set up.

[edit]Please see Simon's note below.[/edit]

Look up Multiplicity in EA help. You can type in your own upper and lower bounds, so 0..12 is a legal value for items in a ledger.

I am allowing for an 'empty' ledger. If your business rules only allow creation of a ledger when there is at least one item, then you could use 1..12. That example is a bit contrived, but I wanted to show that both bounds can be specified. You can even use strings like 2 or 2,4 or even 0..3,6..10 if you want. These would specify 2; either 2 or 4 but not any other quantity; and between 0 and 10 but not 5 or 6.

Depending on what you mean in your second question, you may want to look up Cardinality. This will seem like the first solution at first, but let it percolate a bit.

Finally, you could always set up an Items collection as an attribute of the Ledger class. After saving the attribute, click the Advanced button on the Attribute Properties dialog and you can make this attribute a collection. In this case you might want to model a custom collection class first, and then use this as the type of the Items attribute.

HTH, David
« Last Edit: November 24, 2008, 10:45:49 am by Midnight »
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How do I insert this in a class Diagram
« Reply #2 on: November 24, 2008, 08:55:12 am »
David's answer is correct, when using EA.  Of course, since you've stated that you're using Visio instead, you'll probably need to find the specifics out for yourself.  (Or find a group of Visio users)

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How do I insert this in a class Diagram
« Reply #3 on: November 24, 2008, 10:44:47 am »
Thanks Simon,

Once again I've failed to state the obvious, which I should have done here. I will however let my answer stand (while citing yours) for the benefit of anyone who might want an EA-specific answer.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How do I insert this in a class Diagram
« Reply #4 on: November 24, 2008, 03:35:53 pm »
You gave the answer that I would expect on a board covering EA.  In time, we might have conversion to a much better tool for modeling UML.