Reply to Re: Accessing Class Method

Your name:

Reply:


Posted by Jerry Stuckle on 09/18/07 16:18

Michael Fesser wrote:
> .oO(NoDude)
>
>> @Michael - I currently use __autoload, which is a neat shortcut,
>> albeit it has the same speed impact as *_once (in my case, even
>> greater, because of directory traversing).
>
> I also traverse a lot of class directories, but only if the requested
> class could not be found in the class cache, where the locations of all
> classes are stored. In such case the cache has to be refreshed.
>
>> How I (or Steve for that matter) include our files is not (and never
>> was) my point however. I was just saying and still am - Using require
>> over require_once makes you think of what dependencies you'll have in
>> any given request (every single request is unaware of the dependencies
>> in the previous request and has its own dependencies).
>
> Knowing beforehand which classes will be required to handle a particular
> request is pretty much impossible in my framework. The request handlers
> themselves decide which of them will be responsible for answering the
> request and which other objects might be necessary for doing that. It's
> even possible that a handler instantiates some objects and then forwards
> the request to a sub handler, which in turn might need the informations
> provided by the parent handler.
>

In a properly designed framework, you can predict not only what classes
will be required, but what methods in those classes.

>> It's true that
>> this kind of approach makes you think in terms of configuration rather
>> than automation (not sure if that's the word), but having to make a
>> delegator in every single controller (for example), makes you think
>> hard about what you're doing wrong (in some cases it just pisses you
>> off).
>
> I think more about modularization and code separation. Each component is
> an independent thing and takes care of its own dependencies.
>

Very true. Each class is responsible for itself, and calls other
classes for other required resources.

>> However, I do think that making someone structure his own dependencies
>> (or using some method to overcome having to define them) will make him
>> _think_ in terms of an application, instead of a collection of
>> objects. Telling him, he can have a dozen files, each one having a
>> bunch of require_onces for all of his dependent files won't get him
>> much farther than continuing with the procedural style thinking, only
>> with objects as capsules for functions.
>
> Ever written Java programs? A typical Java class often starts with a
> whole bunch of 'import' statements. Of course a 'require_once' is not
> the same, but quite similar (IMHO).
>
> Micha

Exactly.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация