[nycphp-talk] Include vs Include_once
John Zabroski
johnzabroski at yahoo.com
Fri Nov 30 23:51:57 EST 2007
--- Daniel Convissor
<danielc at analysisandsolutions.com> wrote:
> Hi John:
>
> On Fri, Nov 30, 2007 at 12:13:14AM -0500, John
> Campbell wrote:
> >
> > What is
> > the better programming logic, that doesn't just
> duplicate the
> > behavior?
I want code that is correct, explicit, fast, and in
that order.
> Take the time to strucutre the logic to only include
> a given file one
> time. For example, including critical files up
> front. While clean logic
> can't eliminate all uses of include_once, it can get
> rid of most.
>
> --Dan
Just curious...
How do you address the fact __autoload magic method is
part of the global namespace and that when two blocks
of code with the same signature are loaded on demand,
the function closest to the top of the stack is
selected?
Do you even use __autoload directly? If so, do you
think your comments above contradict using __autoload
as a best practice for structuring code? Do you use
spl_autoload_register, and if so, how?
In my humble opinion, it is these questions that truly
complicate inclusion semantics in PHP. I've never
seen a deep, penetrating, and acceptable reply to
this, and usually I'm told to take the time to
structure things properly. However, such a suggestion
ignores the fact maintenance programming can create
*gaps* and *overlaps* in logic that cause two
functions to exist in the same namespace, introducing
*defects* into the code, causing an *infection* when
the loader is called, and infecting program state when
the defect is executed.
[I hope this doesn't come across as criticism of PHP.
Of course, other languages like Python can be just as
painful managing namespaces. I'm fishing for flexible
solution I'm unable to come up with myself.]
____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
More information about the talk
mailing list