RE: OOP in web development

From: Date: Wed, 14 Feb 2001 09:12:36 +0000
Subject: RE: OOP in web development
Groups: php.general 
Request: Send a blank email to php-general+get-39603@lists.php.net to get a copy of this message
oop should be used when you want to create things to manipulate in your program that are of a consistent structure. A simple example I use is for company contact details and addresses. By creating a contact class I can do ... include("path/contact.pc"); $thiscontact = new contact("company_code"); // and then $thiscontact->display(); $thiscontact->save(); $thiscontact->delete(); // etc. the class methods take care of all the mysql data gathering so you don't have to worry about it after you've written the class. If your data structure changes (or even the name of the database or server) just change the class definition. What I wouldn't use classes for is collecting variables together (use associative arrays). Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: Joe Sheble (Wizaerd) [mailto:JustForMailingLists@wizaerd.com] > Sent: 13 February 2001 16:42 > To: php-general@lists.php.net > Subject: OOP in web development > > > I've been using PHP for over a year now and have been > successfully running > three different websites developed with PHP, but I've never > done anything > with classes or objects. Even when returning data from a > mySQL database, I > use mysql_fetch_array() instead of mysql_fetch_object(). > > What am I missing by not using objects and classes, other than > reusability? What are the real benefits to using OOPs in PHP? > >

« previous php.general (#39603) next »