Dependency Injection in MediaWiki

Today I read the documentation for how Dependency Injection is done in MediaWiki.

I had a few small nits to pick (such as their statement that services should be stateless) but… fair enough.

For myself I don’t usually use Dependency Injection and a Service Container, instead I prefer the Service Locator pattern which I find is simpler and more economical to use, especially in PHP where there is a single process per request.

Extreme late binding

There’s a famous quote from Alan Kay that you will see bandied about:

OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.

I think I agree with him, but I often find myself wondering quite what he meant by “extreme late-binding”. I suspect he means that object instances can redefine stuff they inherited from their concrete class. If your OOP platform doesn’t support that, you can emulate it with data and API.