Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: (jeffa) Re: OO Application Design

by davis (Vicar)
on Sep 25, 2002 at 15:38 UTC ( [id://200648]=note: print w/replies, xml ) Need Help??


in reply to (jeffa) Re: OO Application Design
in thread OO Application Design

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://200648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found