Relational of OR/M??? *lol*

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Relational of OR/M??? *lol*

Post by alex.barylski »

Ignore the oxymoronic subject title please...and read on... :)

So I spent the better part of today reading a book which I found through Google on relational theory...interesting read, I'd strongly suggest anyone who has battled with whether to use OR/M or not, to read some articles and/or books on the subject of relational theory (hopefully one from a conceptual level and nor so much theory as the math might make your head spin).

Anyways, I now have a very solid understanding as to why I have never *really* liked OR/M...yes when first introduced it seemed cool, despite being somewhat skeptical, I continued reading about it. I worked on a few of my own implementations and hit occasional road blocks. Although it's obvious that relational data models are very different from object data models...how much they differ never sunk in until reading this booklet.

Basically IMHO - OR/M is a nasty hack :P

However there is much that can be learnt (learned??) from the study of OR/M...constructing SQL statements is a burden...doing them efficienctly and effectively is even more of a PITA (security issues, complex joins, etc).

I have sat down and ran off some ideas for a procedural library which takes some ideas from OR/M (at least some I have concluded whilst writing my own OR/M classes) but applies them at the relational level...so hopefully you get some benefits of OR/M without the over head and awkward feeling of hacking something togather :)

Before I go spending any great deal of time researching this subject and self-study...does anyone know of anything which might head me in the right direction? Perhaps a library which does just what I am looking for?

Have you also considered this and find the topic interesting? Would you care to bounce some ideas off me? I'm interested in hearing how others may have tackled similar situations?

Do you have any suggestions on what parts of OR/M or any kind of advanced SQL toolkit might enhance the process of writing SQL queries, etc? For instance, maybe a toolkit which made pagination easier? I'm looking for ideas like that...experiences, etc???

Cheers :)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Slightly off topic:

I recall reading about a design pattern a while back...I think it was called AddressBook pattern...if it was indeed a pattern :P

I don't think it's very popular, but it had to do with storing SQL statements externally and calling them into your program via an address book interface. You stored a library of SQL statements and adjusted them as required...

Can someone please tell me if I was high on Peyote and now just remembering incorrectly... :P Cause I cannot for the life of me find anything on Google :(

It's driving me nutts :)

Cheers :)
wei
Forum Contributor
Posts: 140
Joined: Wed Jul 12, 2006 12:18 am

Post by wei »

storing SQL statements externally and calling them into your program via an address book interface. You stored a library of SQL statements and adjusted them as required...
may be something like the Ibatis SQLMap data mapper. http://ibatis.apache.org/
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Edit: Finally found it...Phrasebook pattern :P jesus that took forever by Internet standards

Hmmmm...possibly interesting...but thats not what I was looking for specifically I don't think :(

I'm sure it was called the book pattern...or something similar...as you basically stored SQL statements in an external book of sorts and addressed each SQL statement when needed, interpolating placeholders with variables and then passed the query to a execution funciton...I think that was the gist of the idea :P

Anyways, thanks...I'll keep searchin' :)
User avatar
johno
Forum Commoner
Posts: 36
Joined: Fri May 05, 2006 6:54 am
Location: Bratislava/Slovakia
Contact:

Post by johno »

You mean table data gateway? row data gateway? http://martinfowler.com/eaaCatalog/rowDataGateway.html
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

No sir...I meant phrasebook... :P

Thanks anyways though
Post Reply