class - Create a design pattern for objects in two categories, both covering all objects -


i design class diagram following problem:

from 1 perspective in domain, elements ("elements") either input elements or output elements, not both.

from perspective, either nodes or arrows (but not both).

for example, element e1 can have 1 of following situations:

1) input node

2) output node

3) input arrow

4) output arrow.

i encode without using constraint (like ocl)

so far, i've come following design diagram (grey classes abstract): enter image description here

my question: there more efficient pattern fit problem more accurately, without multi-inheritance?

with requirements , per understanding, i'd rather use strategy pattern instead of inheritance. 2 different behaviors

  1. input/output
  2. node/arrow (could shape)

and element contain functions related 2 behaviors (as has both of these). diagram (the element referring ishapebehavior , iinputoutputbehavior)

enter image description here


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -