2003-12-03 23:06:10 UTC
* BUMP * :)
Also, something to consider: I've been looking a lot at xaraya lately and in particular noticed that every module API function is not in its own file, and additionally every "view" is also in its own file. The big advantage of course, is that if you're displaying blocks from a bunch of modules, you don't the whole API for every module when you really need just one function.
Contrast this with our approach. Maybe I've misinterpretted how we are structuring things, but the DAO (probably with a "model" or service on top of this) would serve as the API for a module. To be a class definition, it has to be located entirely within one file. That means any time we access any module we need to load the whole API. The advantage of course is that it is very easy to make the API for a similar module (we just extend the API of another via inheritance).
Anyways, with previous reports of smarty class loading times and adodb loading times (I recently read 26 msec to load adodb), it seems like load/parse time is going to be a big part of total script execution time. (This assumes people don't use a 'php accelerator', which I believe is the vast majority of people. Corporate usage may differ.) This seems like an important thing to optimize.
What would this mean in terms of changes to our approach? A little. Views and actions could still be classes, as could forms. Template handling would remain the same. Several services could remain unchanged. However, 'models' and DAOs would need to be split into more "single-functionality" bits. Each bit could be a class: zNewsAPIArticleGet, zNewsAPIArticleEdit, zNewsAPIArticleDelete, zNewsAPIArticleGetMany, etc... We could still access things via a service:
$user_service =& zLoader->getService('user');
$user1234 =& $user_service->callAPIFunc('getById', array('id'=>1234));
So calling things is a bit (lot?) more complicated and awkward. Also we lose some major advantages of OO. If we add a method in a base class, it is automatically present in any derived classes. No longer so - we would need to explicitly create a new file and create a class which inherits the new 'method class' (???). But this is not entirely true, our service could be written to look up the 'base method class' if we hadn't explicitly derived it. We can "approximate" most of the aspects of a normal OO approach.
Well... what does everyone think? Is this complexity a too-high or stupid price to pay for smaller load/parse times, smaller memory usage, etc...? What are the (specific) major disadvantages of this approach? etc etc. Input please!! :)