Unit 02 of 02
Standards and Packages
Namespaces, autoloading, common interface standards, the dependency manager and dependency injection — arrangements that either gather a change into a single wiring point or carry it to every user.
Published Updated
Lessons
- 01 Namespaces namespace, use and aliases with fully qualified names; two same-named classes kept apart by a namespace, while the same collision in code without namespaces stops the program; an unqualified function call falling back to the global function. 2 min read
- 02 Autoloading An autoloader built with spl_autoload_register; mapping a namespace prefix to a directory and PSR-4; the number of files not deciding the reach when a class file moves; a move made without updating the loader stopping the program; the mapping depending on letter case in the file name. 2 min read
- 03 Common Interface Standards Common interfaces such as PSR-3; the consumer bound to the interface while the implementation changes in the setup file; an interface checking the signature but not the meaning; an implementation that leaves placeholders unfilled silently changing the output. 2 min read
- 04 The Dependency Manager The manifest file, the version constraint and the lock file; a minor version of an unlocked dependency silently changing the output; the lock file pinning the version; the constraint guarding the major version boundary; semantic versioning being a promise. 2 min read
- 05 Dependency Injection Constructor injection, depending on an interface, and manual wiring; a service's dependency changing only in the setup file; building the dependency inside moving the change onto the services; the seam holding only as long as the contract is kept; the measurement table of twelve lessons. 2 min read