|
Posted by Wayne on 11/29/05 19:40
On Tue, 29 Nov 2005 15:33:06 GMT, Kevin Newman <CaptainN@unFocus.com>
wrote:
>I thought of that, but doesn't it try to load "XML_Parser" from within
>the class file, instead of just "Parser"? In some cases that would lead
>to to huge class names (and a lot of typing).
Huge class names really isn't an issue. You just don't 'new' objects
very often. Unlike in C# or Java, you don't have to declare the types
of variables so you just don't end up using full class names very
often at all.
I have a PHP5 project with 446 classes, arranged in the hierarchy
(XML_Parser is in XML/Parser.php) and I use __autoload.
>Also, I've read that there is a performance problem with __autoload -
>has that been taken care of?
I never experienced any performance issues with __autoload. In fact,
a quick googling for "__autoload performance" leads to a number of
posts/articles saying how it has improved performance of applications.
This makes sense, as __autoload only loads classes on demand. With
require/include you're loading classes whether or not you are actually
using them.
>I really wish the php guys would just implement at least class level
>namespaces (they already have a patch).
I honestly think you're over-thinking this. In reality, namespaces
are simply not the issue in PHP as they are for other languages. I
just use nice long class names.
Navigation:
[Reply to this message]
|