Re: Help on objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message ----- From: "Robert Cummings" <robert@xxxxxxxxxxxxx>
To: "Satyam" <Satyam@xxxxxxxxxxxxx>
Cc: "Deckard" <ml@xxxxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
Sent: Thursday, October 05, 2006 11:16 AM
Subject: Re:  Help on objects


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.
--

Indeed, they often are: you as an object are defined by properties such as height, color of your hair and many other adjectives and you have many other objects which define you, fingers, legs, etc, which are also properties. Being more detailed, instead of the color of your hair being a property of you as a whole, you might have a property pointing to a hair object (a noun) which has a color property.

Other noun properties might not be so helpful in defining you, your friends might give a hint of who you are, your clients do not. But, after all, neither does your hair, mine is deserting me and I'm still myself. So, I would say that while adjectives define an object, nouns are relations in between objects and might not define neither.

Anyway, I didn't mean this analogy to be complete, nor I mean to teach OOP to English teachers, and though it can be talked much about, stretching it too far would certainly break it. I don't mean to defend it very strongly.

Cheers

Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux