Developer happiness - the whys of Laravel

Niklas Modess
8 December 2014

I'm a developer. I've been that for a very long time, actually for almost 15 years now. When we developers talk about why we should use a certain technology, it's always directed towards other developers. Unless this happens in a workplace when developers need to convince management people about choice of technologies. This is what I will be trying to do here, convey the whys of Laravel for people that aren't developers. You could perhaps be a designer, manager, project leader or maybe you're just interested in what the heck we developers talk about from time to time.

What is Laravel?

Do not get scared by this: Laravel is a PHP framework. PHP is the most popular programming language for building dynamic web applications. It is estimated that it powers at least 80% of all web sites on the internet. There is a bunch of other languages out there but nothing that even comes close of the popularity and spread of PHP.

A framework in this context can be thought of as pre-written functionality that solves generic tasks, so you don't have to reinvent the wheel. The fundamental principle for a web application is that you receive a request (user visits the site in a browser) and then you return a response (what is shown in the users browser). This might seem like a very simple task, but the complexity behind this and all possible ways you can deal with it can be overwhelming. When you use a framework like Laravel, it handles it for you. Then you can focus on building the application instead. 

Many features comes out of the box, such as communicating with a database, authenticating users, localization (multiple languages), sending e-mails and validating data sent from the users through forms. This is just a few examples of what the framework does for you. What this helps us with is that it speeds up the development of the application. All of us want the application to be built as fast as possible.

And why write something again that other people have put a lot of time and effort into already making it great? It's is actually a rather thin layer and a lot of glue. The principle behind the framework is that it has taken all of the best and tested components out there, glued them together, sprinkled some magic for us developers on it and released it to us. So the most part of Laravel isn't actually written by people that code Laravel. The people that code Laravel identify the best possible solutions out there already, and then packages it in a great framework where all the components are tied together.

What about Wordpress?

Laravel is just one among many, many frameworks available. You've probably heard of Wordpress? Then there are many well know in the developer community such as Symfony2, CodeIgniter, Silex, Aura, etc. You don't need to know the names of these though. And even though Wordpress is one of the most well known frameworks, both for developer and non-developers, it's really a big pile of crap that no developer wants to work with.

Why Laravel?

So why is Laravel a better choice than <insert one of the other frameworks here>? I have to respond with the kind of annoying answer: it depends. What I can say is that I would not choose any other framework if we're talking about a generic web application. I would only go to another framework if the application is very niche. That would be if it's extremely reliable on performance for example. But as a boilerplate framework, Laravel is my weapon of choice.

Keep developers happy

What everything boils down to is the quality of the code. A key metric in this is keeping developers happy. Happy developers are productive. Happy developers write good code. One of the best ways of keeping them happy is letting them work with good tools and preferably tools they want to work with. Most of us developers does not like to work with badly written code. Bad code will only contribute to an environment that produces more bad code.

Find more happy developers 

Not only that it will make it easier keeping your developers happy, it will make it easier to attract new developers! There is a shortage of good developers, and the fight to get them and keep them is a bloody battlefield. Why make it harder for yourself by not being able to include work with the best web technologies in your job listings?

Code that tests code

Something called "unit testing" have gained a lot of traction in the PHP community lately and Laravel excels at making everything unit testable. In a nutshell it is writing code that tests your actual code. A kind of meta-code for the quality of the "real" code. You can actually verbalize it quite easily, like: when a user submits the sign up form with an incorrect e-mail, I want to assert that an error is returned to the user. This is then translated in to code and the running of the tests can be automated so you know that your code is working as intended. Again, software quality.

Prototyping

Since everything is put in place for rapid development, prototyping can be a very efficient business tool to use. Making a first version of something and get user feedback on it is invaluable. If you can cut down time and cost on those prototypes, just go for it. It will make it easier throwing stuff away that didn't really work as well.

Niklas Modess has been a full stack developer for over 15 years. During this time he developed and deployed a great variety of applications. The scale of these applications have been from a few hundred users to over 250 million users. Open source contributor, mainly as creator and maintainer of Git Pretty Stats. Organizer of meetup group Laravel Stockholm and author of Deploying PHP applications.