in reply to OO Application Design

getAdults() sounds like a specific version of, say, a search() method:
# warning, not what you really need my @adult = Person->search(age => 18);
which is more than likely a class method. Say, you aren't rolling your own are you? Check out Class::DBI and it's oh so useful extension, which allows you to do things like:
@adult = Person->retrieve_from_sql('WHERE age >= ?', 18);
which is what you really most likely want (you could also wrap that code in the method getAdults()).

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: OO Application Design
by davis (Vicar) on Sep 25, 2002 at 15:38 UTC
    I did something fairly similar recently - to paraphrase my POD (Yay! I'm so glad I wrote it now :-) ):
    Person->get(name => "Foo Bar"); Person->get(name => {method => "EQUALS", value=>"Foo Bar"}); Person->get(name => {method => "REGEX", value=>"Foo? Bar"}); Person->get(name => {method => "CONTAINS", value=>"Foo"}); Person->get(age => {method => "GREATERTHAN", value=>18}); Person->get(age => {method => "LESSTHAN", value=>21});

    Where the arguments to the get function acted as constraints, i.e. reducing the number of results you'd get back. I'm not certain that it was the way to do it, but it allowed me to forget that I'm not very good at SQL, I'm terrible at schema design, and even the fact the data is stored in an RDBMS.

    This approach also had the advantage of having one place to put the SQL, and prevented users from throwing potentially bad SQL at the database, or asking for people that had a name "GREATERTHAN" 24.

    Cheers.
    davis
    Is this going out live?
    No, Homer, very few cartoons are broadcast live - it's a terrible strain on the animator's wrist