ericm Posted August 25, 2008 Share Posted August 25, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/121237-object-oriented-design-for-database/ Share on other sites More sharing options...
corbin Posted August 27, 2008 Share Posted August 27, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/121237-object-oriented-design-for-database/#findComment-627300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.