Create a gist now

Instantly share code, notes, and snippets.

@flavius / Secret
Last active May 17, 2017

What would you like to do?

The Frameworks War

What is a framework? A framework is a cohesive set of classes which saves the programmer the effort of reimplementing again and again the same functionality shared by many projects, giving the programmer the time to focus on the innovative part of the project at hand, while not enforcing a specific code structure or execution flow.

What is a good framework? A good framework is a framework which does not violate software design principles.

When am I in the position of judging if a framework is good or not? When you master software design. Meaning: if you're able to come up with the same quality code as the best frameworks out there. This does not mean that you would have to only apply design patterns blindly, but that you can also rationalize why a design decision is better over the other.

When am I not in the position of advising others to use which framework? This happens when you're not in the position of judging if a framework is good or bad (see previous question). Also, if you don't know why globals are bad, as well as static or singletons, or if you've never written unit tests (read: phpUnit). In all these cases, you should keep your mouth shut when it comes to frameworks.

But why should I keep my mouth shut? Because it's in your interest. It's in your interest to let the PHP industry become competent. Why? Because that way, every PHP programmer will be better paid, including yourself. Ok, maybe not every one, but those competent among us (which I encourage you to become) will have a better starting ground.

How do I become competent then? If you are still asking yourself this question after reading the previous five paragraphs, then please re-read them. Now.


Ok, so you haven't re-read the previous five paragraphs. If you have, or if you know how to become competent, please skip this paragraph. Oookay, so you're still reading. This means two things at once: 1. you've read something which tells you how to become competent and 2. you still have no clue. As a logical consequence of 1 and 2, you're too stupid for programming and you should look for another industry where you'd be successful. No, I'm really not mean, I really want the best for you: I don't want you to be mediocre in programming, that's why I encourage you to look for something else. While you're leaving, note that the right answer to "How do I become competent?" in the context of frameworks was by mastering software design first. I wish you good luck from the bottom of my heart. Really. Do not take this personally and do not cry like a baby.

But there are many competent programmers, isn't there room for everyone? Since you're reading this, it means that you're among the ones who either already master software design, or want to go on this (the right) path to competence.

Which means that, in case of a job interview, being just as competent as a Java or C++ programmer, you want to start negociating the salary on a common ground with those "other guys".

In this new context, of course there is still plenty of room for everyone. Everyone is welcome to strive for competence. I want EVERY SINGLE ONE PHP programmer to become good at software design first, and THEN use frameworks.

Just as a side-note: once you've learned software design, you don't really learn a framework, but actually start to use it right away. Because you know what you're going to do even before starting to actually do it. A good software designer will switch between frameworks (or even mix them) with almost no effort and no learning curve.

The New Direction of the PHP Frameworks Ecosystem

The new ecosystem is everything based on PHP 5.3+. In this new ecosystem, it does not matter all that much which framework you use, as long as it's a well designed framework.

But what is "well designed"? You still haven't got the software design principles part I'm preaching about, right? Well, you should.

So as long the frameworks are well designed, because now we have namespaces in the PHP language, you can even mix multiple frameworks in one project - with the introduction of PSR-0, nothing stops you from doing this.

Well designed PHP 5.3+ Frameworks - the big players

Emerging or Small players

Poorly Designed Frameworks

  • Laravel: it uses a lot of static class properties and methods. Please google on why this is bad software design
  • FuelPHP: the core classes are using a lot of static class properties and methods. Please google on why this is bad software design. The same goes for the other packages as well
  • Nette: it uses a lot of static class properties and methods. Please google on why this is bad software design

Not (yet) PHP 5.3+ Frameworks

A "PHP 5.3+" framework is a framework which takes advantage of the new feature of the language and which at least respects PSR-0.

The following are not (yet) PHP 5.3+:

so they're not even worth looking at, since PHP 5.3 has been released in 2009.

Your favourite framework is not listed? Ask for a review.

Which framework should I choose?

If you're asking yourself this question, then you don't know software design.

Learn software design first, at least the basics, then try to apply the new knowledge in a PHP-only project of yours.

After this learning experience, you'll be able to decide for yourself, on a project-by-project basis, which framework fits your needs. Or even not decide it at all, but instead use a mix of multiple frameworks.

I don't think, that Nette Framework is poorly designed. Please re-evaluate your opinion...

Well after you know some Frameworks, you have to drop the idea that Framework matters;)
take a look at Clean Architecture

the Framework is just a Detail which display some HTML Code or Deliver JSON response. If youre a good Software Designer, make your Software independent of Webserver,Database,UI,Framework

My Favorite Framework Kohana 3.3 is not listed Btw ;)


flavius commented May 15, 2013

@BlackScorp exactly, that's the point, after you know software design, the framework doesn't matter all that much.

Can you have a review on Drupal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment