Jump to content

Recommended Posts

Any feedback on my design would be great, as I'm a bit new to all of this.

 

I am planning to write a parent Oracle class that will handle connecting to the database, implementing the iterator interface for use w/ foreach loops, and handle executing queries.  There will probably be more added to this class as time comes -- suggestions welcomed.

 

From there, I'll write individual classes that extend the Oracle class.  In these will be the actual SQL code relevant to the class.  Functions like "getAll()" and "getByID", for example.  As children to the Oracle class above, they should inherit the querying functions, iterator, etc.

 

Is this a good design schema for interfacing with the database?

Link to comment
https://forums.phpfreaks.com/topic/121237-object-oriented-design-for-database/
Share on other sites

So you plan on doing something like this:

 

class OracleDB {
}

class User extends OracleDB {
}

?

 

It would be better to use an instance of your Oracle class in the other classes.  In design, classes shouldn't care from where the data comes.

 

Anyway, maybe someone else can elaborate on this.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.