Multiple Object creation per AJAX request -- bad idea?

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

Locked
fish123456
Forum Newbie
Posts: 3
Joined: Thu May 17, 2007 9:30 am

Multiple Object creation per AJAX request -- bad idea?

Post by fish123456 »

I am trying to leverage my knowledge of OOP to PHP, but I'm new to PHP, so I'm not sure if the following idea is realistic:

If I have a page that updates itself constantly (via AJAX) with data from other users who are on the same page, does it make sense to build a bunch of objects from a Database in order to work on those objects?

For example, let's say I am trying to allow users to play a game, so each action has to be propagated to all other users. This is done via AJAX polling. So every 3 seconds, the page polls for data. (i.e. index.php?user=fish&gameId=456) I was thinking about taking the user and gameIds, creating a Player object, populating the Player object with data from a database, and then performing some routines, such as Player->movePiece(). Thus, every single time a request comes in, one or more objects are instantiated, some functionality is performed, and when the request completes, the objects are destroyed.

Can anyone with experience speak to whether this is a bad idea in respect to performance when scaling to multiple dozens of games and several dozen users simultaneously?
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

I already answered your other almost identical post, please refer to that one.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Duplicate thread. Locked.
Locked