ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
RE: [Zope] RE: Any comments from ex-PHP developers?
by other posts by this author
Dec 18 2002 1:34AM messages near this date
[Zope] Re: CatalogPathAwareness and manage_beforeDelete | [Zope] maintaining last_modified_date when copying an object
I get frustrated when reading other coders' PHP code, and I think it is
right to direct that frustration at a crappy language.

Compared to Zope/Python, PHPs weakness is a poor language, aside from
platform/framework considerations.  PHP breaks down for team development
because it inlines code and presentation, but even worse, by way of example,
is unclear method namespaces, and excessive promotion of inlline code
evaluation:

PHP is also horrible in its promotion of
specialized-functionality-module-level stuff to global namespaces.  At least
in Python, if you want to create an ftp client, you do:

from ftplib import FTP 
# I know where to look in the lib ref for this, no?
f = FTP() #I know where FTP came from, no?
f.connect('zopeserver.foo.com',8021) #
f.set_pasv(1)
l = f.dir()
#etc...

in PHP:
$conn = ftp_connect('someserver.foo.com') 
#where did this come from?
$login_res = ftp_login($conn, 'foouser','foopasswd')
$upload = ftp_put....etc

Notice the global namespaces for all the functions... You can't figure out
explicitly where these things came from (unlike Python where tracing
method/class names in code to import statements recursively is almost always
at some point going to lead you back to the library reference, and perhaps
understanding).  If this doesn't make most developers (from many other
languages - even Perl -that do this in a more modular way) concerned, I
don't know what will.

Another example: common practice of inlining execution of code in a PHP
script: 

<%
include('somesnippetofcode.php');
%> 

Inline eval of code is bad.  Again, this is not explicit.  This magic
server-side-includish practice does not make sense in logic code.  You want
to criticize dtml code in Zope that does this just as much, but at least
Zope provides you with a better alternative: do logic in Python, either TTW
on on the filesystem (and either way, everything is clear becuase you call
other modules via component/object interfaces instead of inline evaluation).

Explicit is always better than implicit, except when it isn't - and trust
me, neither of these count as one of those cases.  

Sean

-----Original Message-----
From: Lennart Regebro [mailto:lennart@[...].nu]
Sent: Tuesday, December 17, 2002 11:51 AM
To: zope@zope.org; Frederic Faure
Subject: Re: [Zope] RE: Any comments from ex-PHP developers?


From: "Frederic Faure" <ffaure@[...].com> 
>  - Python is truly OOP : What is missing in PHP4? Multiple inheritance?

Well, yes, but mostly an object store.

>  - Zope uses its own DB instead of a filesystem. But then, nobody complains
>  when data are saved in other DBMS's, so why do they complain about ZODB?

This is actually a pro, not a con. :-)
The fact that that DB is also file based, and doesn't require you to set up
an SQL-database is another pro.



_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  Zope@[...].org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved