Class Autoloading
| Newsgroups | gmane.comp.cms.xaraya.devel |
|---|---|
| Organization | Xaraya |
| Message-ID | <[email protected]> |
To explore this idea (from my previous post), I've pushed the classrename scenario, which renames the classes in the DD module, more or less along the lines of the PEAR naming scheme (name reflects the folder hierarchy the class is in). I'm no big fan of long underscored class names, but I think the tradeoff is worth it in this case. Over a hundred sys::imports were removed, along with a cluster of files which were basically doing nothing but making sure some classes were imported. Granted some of this may have been past sloppiness, but the point is that using the autoload mechanism automatically ensures that only what's actually needed is loaded. Like the consistent use of interfaces, saves us from ourselves. Extending this to other modules is straightforward, since by convention the modules all have their classes in the "class" folder. In the case of the core it's less clear where the disadvantages begin to outweigh the benefits, as the class structure of the core is not as homogeneous and simple as that of the modules.