Reputation: 33
The following situation:
I have: a) a super office has n or more main offices has none or more small offices b) all are offices c) the whole structure is twice (preserving the structure) for two business lines d) every office can be a legal representation e) each office can be in a different country
which UML pattern would you suggest
I tried: Composite pattern with leaf office and composite legal rep specializing in main office, super office, small office. Issue: how to represent business line?
Office with self reference (is super of, is main of, is small of) Issue: how to preserve structure for business line?
Composition (three objects super, main, small) Issue: how to preserve structure, and having three non inherited objects for the same seems ugly.
What is your view?
Upvotes: 1
Views: 98
Reputation: 36313
Like so often I'd apply Occam's Razor. To me the 2nd with the self-reference appears the clearest. To represent the business line you would need to insert a property and apply a business rule describing the line.
Of course YMMV. A different view might lead to a different result. Means: the razors cuts in a different way. The above would be my first cut.
Upvotes: 0