akvino
June 17th, 2009, 04:48 PM
I am in dilemma, what is the OO PHP way?
I am trying to understand if design should compliment the rules of:
case One:
1 USER/ 1 SESSION/ 1 OBJECT on need to use basis instantiated on user call / new objects per a user.. To expand on this thought - 100 users = 100 objects
case Two:
MANY USERS use 1 OBJECT for it's functionality needs / the object is instantiated upon application start and is life independent on user session - usually these objects are functional objects providing application functions (example quick_forms, PDO)/ other half of the objects are on need to use basis and are instantiated upon the user call and go by the 1 user = 1 object instantiation rule
case Three:
Many USERS use only 1 object of each kind, even if the object is instantiated on user need and not when application starts up.
case Four:
Maybe we need to keep procedural calls in some occasions, such as one user per one object instantiation, vs. many users one object instantiation.
My questions - what is correct way to program keeping in mind performance aspects of the application? What is the impact of 1 user per 1 object methodology on memory allocation, cpu, etc.. ?
Please keep in mind I am new to PHP so I haven't had a chance to visit Zend Framework in more detail, maybe in the future...:popcorn:
I am trying to understand if design should compliment the rules of:
case One:
1 USER/ 1 SESSION/ 1 OBJECT on need to use basis instantiated on user call / new objects per a user.. To expand on this thought - 100 users = 100 objects
case Two:
MANY USERS use 1 OBJECT for it's functionality needs / the object is instantiated upon application start and is life independent on user session - usually these objects are functional objects providing application functions (example quick_forms, PDO)/ other half of the objects are on need to use basis and are instantiated upon the user call and go by the 1 user = 1 object instantiation rule
case Three:
Many USERS use only 1 object of each kind, even if the object is instantiated on user need and not when application starts up.
case Four:
Maybe we need to keep procedural calls in some occasions, such as one user per one object instantiation, vs. many users one object instantiation.
My questions - what is correct way to program keeping in mind performance aspects of the application? What is the impact of 1 user per 1 object methodology on memory allocation, cpu, etc.. ?
Please keep in mind I am new to PHP so I haven't had a chance to visit Zend Framework in more detail, maybe in the future...:popcorn: