The application already has a Mailer interface and eleven classes depend on it. The transactional-email service being brought in ships a client with a different method name, a…
$this->load->model(‘order_model’) reads as a convenience and is a service locator: it reaches into a global singleton, constructs whatever it finds, and attaches it to the controller by a…
Generators are usually introduced as a way to produce a sequence lazily, and the arrow is described as pointing one way. It does not: yield is an expression,…
Every CodeIgniter 2 project reaches the point where four controllers need the same authentication check. The framework has no container and no interface to implement — the extension…
An optional collaborator — a logger only configured in production, a cache that may be switched off, a discount that may not apply — produces the same three…
Setter injection and a service locator both let a class acquire a collaborator at the moment it happens to need one, so nothing about the class announces how…
A payment provider’s SDK ends up referenced in a controller, in two models, in a console command and in nine tests. Changing provider then means changing all of…