Addressed to: Markus Fischer <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from Markus Fischer <[EMAIL PROTECTED]> Thu, 3 Jan 2002
22:00:27 +0100
> > Because not everyone wants to use *(#$&ing objects in a simple script!
>
> Why?
Count me as one of the people who would not be using PHP if it forced
me to always use objects. I think object oriented programming is
over-rated, especially the purist version. You know, the people who
don't think they can live without private methods and have a heart
attack if you directly access a variable in an object.
That does not mean that I never use objects, I have a few things in my
library where they come in very handy. Mostly as a way of providing a
place to store data outside of the global scope, but available to many
functions.
If you are going to use objects you need to think about them quite a
bit before you start coding. After all re-use is supposed to be one of
the big reasons for OOP. Sometimes it just isn't worth it.
I certainly see no advantage in writing the following program with OOP:
------------------------------------------------------------
<?
echo "Hello World\n";
?>
------------------------------------------------------------
It doesn't make the job easier, and it certainly isn't easier to
understand the source code.
I don't even see an advantage here:
------------------------------------------------------------
<?
include( "mysql.plib" );
mysql_connect( "localhost", "username", "password" );
mysql_select_db( "database" );
$R1 = Query( "SELECT Field1, Field2, Field3 " .
"FROM Table " .
"ORDER BY Field1 " );
?>
<HTML>
<BODY>
<H1>Database Dump</H1>
<TABLE>
<TR>
<TH>Field1</TH>
<TH>Field2</TH>
<TH>Field3</TH>
</TR>
<? while( UnpackQuery( $R1 )) : ?>
<TR>
<TD><?=$Field1?></TD>
<TD><?=$Field2?></TD>
<TD><?=$Field3?></TD>
</TR>
<? endwhile ?>
</TABLE>
</BODY>
</HTML>
------------------------------------------------------------
A lot of web programming doesn't take much more that this. Why make it
more complicated by using objects? A few well thought out functions
(Query, UnpackQuery) in a library (mysql.plib) can go a long way
towards creating simple but robust programs in a lot of cases.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]