|
Posted by NoDude on 09/18/07 09:11
@Steve - The term "coding style" was a very poor choice of words, what
I was referring to was require over require_once. My initial reasoning
(for myself_ to use require over requireonce came from an early
release of APC which had big issues with require_once. Maybe I'm
justifying my usage of require, claiming it to be better, but that's
how I see things. I didn't mean to criticize an y of your work (which
I've never seen anyway).
@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 did however use an AS3-
like import mechanism while I was writing php4 code. I also had
preconfigured dependencies for most of the models and pageControllers
in my applications (the total preconfigurations were not that
numerous).
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). 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).
Let me also state that I'm a fan of automation (I would much rather
have cakePHP over symfony for example), I even use lazy loading in my
aplications. I would be nuts if I had a require 'something.php' all
over the place (which I once had, years ago).
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. I've seen this kind of
thinking in at least half a dozen colleagues, also in myself when I
was starting out with OOP using php (which was not very OO at the
time).
P.S. I was top-posting, because I was under the impression this is the
preferred method in this group.
[Back to original message]
|