I had the pleasure (pun intended) of installing a small framework of code today, which broke at least half of the
rules I've been building up for the projects I've been working on. The code illustrated very clearly why explicitly typing require_once is not only good idea, it can make the difference between clear readable code, and poor magic.
The error "
Fatal error: Call to undefined function: somefunction_xyz() in..." appears after installing the code. Looking at the file, it only contains one line.. somefunction_xyz()!
The framework is supposed to have loaded this file, but as it's not set up correctly, and therefore, it didnt happen. To me this assumption that the file is loaded is flawed to begin with. Ignoring the issue that the framework relies on function libraries, the other fatal flaw is that Frameworks should rarely load more that one 'action' file, which in turn should be reasonably self explainitory where it is getting things from.
The missing require_once makes the code very difficult to follow without inside knowledge (or heavy use of grep) of how the framework may be working, and very little is given away as clues to what should have happened prior to this error occuring.
I guess this harks back to the idea that __autoload() will encourage people to write more code that is less self documenting, almost all languages C#, Java, Python... usually have a list at the top of the page, indicating what they 'import' or 'use' to achieve the aim of the program, PHP uses the require_once to document the source of your libraries. It helps others read your code, and in PHP can also be placed close to the place you actually use the library method. Alot of these language have ways around ending up with this large import list, and often some import's implicitly load others, but in making code readable it's often worth duplicating these, just to ensure that it's readable.
So from the trenches here, please try and make your code readable, other people have to install, set it up, and as quickly as possible understand what you intended to do....