Jump to content

Object Oriented Design for Database


ericm

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.