NYCPHP Meetup

NYPHP.org

Object Oriented Question

ophir prusak prutwo at onebox.com
Fri Jun 7 10:47:23 EDT 2002


Hi All,

I've decided to clean up the code on my site, and at the same time use
object oriented code.
I have a few ideas in my head, but I really wanted to get some input
from others that have built projects in PHP using OO code.

Here's the problem I'm currently trying to solve (I've simplified it
a bit and left out un-necessary details).
My site is a video game site. Currently, my database has:
A games table which has basic game information for each game (game_id,
title, console, etc)
A reviews table which has game_id (foreign key to games table), review
date, review text, reviewer name and email.

If you look at this URL
http://ps2.consolemonkey.com/reviews_date.php3?order=rev_id 
you can see a page which shows a list of all the games and the date for
the most recent review for that game.

Currently I'm just doing this with a single SQL query (simple join of
the two tables) and echoing out the results.
Very fast.

I'm trying to envision how to create this page using object oriented
code.
My initial thought was to somehow use a game object, but if I have to
instantiate a game object for every game, this seems like it would have
an enormous amount of overhead and be slow.

How is this usually done on OO projects ?

Am I missing something or would you say that if your data sits in a relational
database and your doing a search or mass listing of data then OO code
is not the way to go.

comments/suggestions/thoughts/ideas/etc ?

Thanx
Ophir 

 
----
Ophir Prusak
Internet developer 
prutwo at onebox.com | http://www.prusak.com/ 

 



More information about the talk mailing list