This is a discussion on Pattern Clarification within the Software Patterns forums, part of the Testing category; Hi, Hoping someone could provide some direction on how to approach this problem using any GOF patterns. e.g. A ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Pattern Clarification
Hi,
Hoping someone could provide some direction on how to approach this problem using any GOF patterns. e.g. A project contains a team and a team contains zero or more members, each with a specific role(s) e.g. architect, programmer, DBA etc. Again assuming that each member is either an employee or a consultant. If there are two questions that need to be answered # Which employee(s)/consultant(s) are involved in a project? # In which projects is an employee/consultant involved and in what roles? I have been beating my head over something similar for the past 2-3 days without much success. Any help is much appreciated. Thx! sd |
|
|||
|
Re: Pattern Clarification
Hi,
I 100% agree with using the Composite pattern BUT why is it needed the Iterator? with the composite you just apply X() to the root and that's it, it gets applied to the tree entirely ... that is precisely what is so beautiful about using Composite ... I do not see application of Iterator but I do see it would be useful using the Visitor pattern. Would allow any branch of the tree to be visited. An "Iterator" then would be kind of visiting the root node. Best Regards, Giovanni "Ted Hill" <thill_NO_SPAM@tomotherapy.com> wrote in message news:42C0461D.4050507@tomotherapy.com... >I think you could use the Composite and the Iterator patterns here. > > Use the composite to model the Project-Team-Members 'tree' > > Then implement an Iterator that will iterate over the composite. > |
|
|||
|
Re: Pattern Clarification
Hi Sd,
As pointed out before it fits that you use the Composite Pattern to model the tree structure. Have you thought about complex cases (or are there?) ... e.g. some Employee or Consultant that is Architect and also do DBA? If this is the case then I would considering using Decorator pattern ... e.g. Component genius = new Architect(new DBA(new Programmer(new Employee()))); genius.showoff(); Regards, Giovanni <danths@gmail.com> wrote in message news:1119583307.675282.317490@o13g2000cwo.googlegroups.com... > Hi, > Hoping someone could provide some direction on how to approach this > problem using any GOF patterns. e.g. A project contains a team and a > team contains zero or more members, each with a specific role(s) e.g. > architect, programmer, DBA etc. Again assuming that each member is > either an employee or a consultant. If there are two questions that > need to be answered > # Which employee(s)/consultant(s) are involved in a project? > # In which projects is an employee/consultant involved and in what > roles? > > I have been beating my head over something similar for the past 2-3 > days without much success. Any help is much appreciated. > > > Thx! > sd > |
![]() |
| Thread Tools | |
|
|