View Single Post
Old 01-18-2008, 02:27 PM   #13 (permalink)
cosmok
The Wanderer
 
Join Date: Jan 2008
Posts: 23
Thanks: 8
cosmok is on a distinguished road
Default

Quote:
Originally Posted by flyingbuddha View Post
I've just joined this site, it looks like it's pretty lively so thought I'd roll with you lot :)
I am glad you did!

Quote:
Originally Posted by flyingbuddha View Post
An example of a good use of oop is a database util class. In the first example, you could just have your functions class that connects and queries a mysql db. Great. Now, if you want to connect to a Sqlite / postgre / oracle db, what do you do?
With oop, you could have a factory script, a sort of shell, that can extend one other script of your choosing. You know that you just need to call open_db() (or of that ilk), and whichever type of data storage you have, you'll be getting the same result. Without oop, you'll be writing functions like open_db_mysql(), open_db_postgre(), open_db_sqlite(), and so forth, then if you moved datasource at any time, you'll be recoding all calls throughout the site to the new function. "Portability" is the take-home message ;)
I am kinda getting your point, but, would you mind showing some code here?that should definitely drive it down my head.
cosmok is offline  
Reply With Quote