This is a discussion on Exposing the object structure from a list within the Software Patterns forums, part of the Testing category; Hello, I want to use well known patterns for a problem I need to solve. I am finding trouble with ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Exposing the object structure from a list
Hello,
I want to use well known patterns for a problem I need to solve. I am finding trouble with applying if in the moment - I am fairly new to this, so please bear with me. I need to design a class structure that looks like this at the moment Client -------------------> List ---------------> External Classes | ^ | | | | --------------+---------------- | | | | | | | Obj Obj Obj Obj Obj------------+ That is, List is something of an iterator to an array. The List and/or Objects have interfaces with external subsystems (to retrieve Object properties) I do not want to expose. The Client is not capable of adding or removing objects to the list, just modifying some properties of each object. Now my question is, should I return the Object to the client when it requests access, or use a "facade-like" structure in which the List class controls access like this List::SetCurrentObject(index) List::GetObjProperty() List::NextObject() Or perhaps I should redesign Object so it does not have external dependencies (keep the dependencies in the List class) and return a reference to the Object to the client (and simplify List structure)?? Thanks for your help Fabio |