Members class-OO: Suggestions solicited[Unsolved]

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

User avatar
sweatje
Forum Contributor
Posts: 277
Joined: Wed Jun 29, 2005 10:04 pm
Location: Iowa, USA

Post by sweatje »

Jeroen Oosterlaar wrote:Hi raghavan20,

Why are you passing a database connection object to your objects data management objects? As far as I know, that is not necessary. Once you have created a connection, everything that is executed during the request, can execute transactions freely. So when you have a page script that first initializes the database connection and then invokes some method that executes some database transaction, that object doesn't need to have an expliciet reference to the database connection (object). The connection is 'just there'.
How would you test that?
Jeroen Oosterlaar
Forum Commoner
Posts: 37
Joined: Sun Nov 06, 2005 4:12 pm

Post by Jeroen Oosterlaar »

sweatje wrote:How would you test that?
Isn't that the responsibility of the code that calls the object? In my opinion, taking care of the database connection should not concern such objects, but they should be able to assume there is a connection available. I think that separated database connection managing is preferable.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

Thanks for your reply guys...but I would be more happier if you can reply to recent problems I posted in my earlier thread.
Post Reply