01-18-2008, 02:27 PM
|
#13 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Posts: 25
Thanks: 8
|
Quote:
Originally Posted by flyingbuddha
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
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.
|
|
|
|