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

| improve this question | | | | |
  • 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. – David Arno Dec 20 '16 at 6:55

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.

| improve this answer | | | | |
  • 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. – Arwa Dec 20 '16 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.