3

If in class diagram I have a parent "Account" and three childs "Child1", "Child2", and "Admin". The "Admin" has control over "Child1" and "Child2" accounts. Will the relation be like this?

enter image description here

Giorgio
19.8k16 gold badges89 silver badges137 bronze badges
asked Dec 20, 2016 at 6:30
1
  • 2
    I'll let others answer whether the diagram encapsulates what you are asking. My worry here is your design. You are using inheritance, then you are tightly coupling Admin to other classes. Lastly, you have a design where an admin can edit a child1 or child2, but not another admin, which sounds like a bug already. Just replace all of this with a allowedToEditOtherAccounts flag in Account and move on. Job done. Commented Dec 20, 2016 at 6:55

1 Answer 1

3

The diagram is is close to what you said. But, just going by the names, Child1 and Child2 should not be classes. Those names are instances of Child.

Also, according to the zero one infinity rule, in a design, there is no such thing as 2. Everything is either zero, one, or some arbitrary user configurable number. That's what the * you used is. A design with a 2 in it should raise your eyebrows.

answered Dec 20, 2016 at 6:44
1
  • Many thanks. I see your point. Actually the real diagram doesn't contain Child1 and Child2, it contains two different classes, maybe I had to specify that. Commented Dec 20, 2016 at 10:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.