Skip to main content


Showing posts from February, 2014

Laravel is Good, Facades Aren't

I've been working on some Laravel 4 based packages lately which inevitably results in me also looking at other packages.

I've noticed sometimes that people use facades at times that give me pause. The most troubling being from inside their model classes.

A quick google turned up this video which assures people "there's still an instance behind everything, we're fine".  Everything mentioned in the video is true except that there is a very glaring omission.

Scope What usually goes out the door at the start of a long series of mishaps in software design is scope.
When the desire to obtain a solution is stronger than the desire to consider the implications of a firm approach, mistakes are sure to follow.  Sacrifices like this are made due to the assumption of a high cost to developing carefully.
What really is happening however is a false dilemma, being responded to with a convenience decision.
It's very easy to write model code like this:

class MyModel e…