I believe you should have getAdults as a class method in class Person and let it return an object of type PersonList. A PersonList should just contain the handle of the executed statement (in other words a cursor or ResultSet) and wouldn't hold all elements in memory. It could have methods like get_next, has_more_elements, as_array, letting you either access elements sequentially or get all the bunch as an array.
In a more general setting, a PersonList could be an instance of a superclass DBObjectList, knowing aware of what kind of objects it is retrieving (in your case Person's).
In reply to Re: OO Application Design
by abell
in thread OO Application Design
by Nomis52
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |