Re: Help on objects

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

 



2006/10/5, Satyam <Satyam@xxxxxxxxxxxxx>:

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.

Satyam


You're wrong, partially: an action can be an object and it's not necessarily
a bad design, take for example function objects or the program and
statements as objects in lisp-like languages. It's acceptable to make a
class that works as an abstract representation of an sql query. This kind of
classes are used very efficiently in object persistence libraries. What I
agree with you is that it's not right that this class works as the insert
action and not as a representation of the insert operation.

[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