Re: Help on objects

From: Date: Thu, 05 Oct 2006 09:16:36 +0000
Subject: Re: Help on objects
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-242643@lists.php.net to get a copy of this message
On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote: > I've seen you already had a good answer on the errors in the code so I won't > go on that. As for OOP, the one design error you have is that you are > asking for an action, not an object. You want to make SQL inserts, that is > your purpose, and that is an action, which is solved by a statement, not by > an object. There is no doer. Objects are what even your English teacher > would call objects while describing a sentence. You are asking for a verb, > you don't have a subject, you don't have an object. Of course you can wrap > an action in a class, but that is bad design. Classes will usually have > names representing nouns, methods will be verbs, properties adjectives, more > or less, that's OOP for English teachers. Properties are very often nouns in addition to adjectives. For instance a linked list class will undoubtedly have noun objects referring to the current link, the next link, etc. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#242643) next »