The framework you learn doesn’t really matter.

« »

Towards the end of my talk at phpDay in Verona, I was asked by two developers which framework I thought they should learn: Symfony or Laravel. I understand the pressure that developers feel like they’re under to learn a framework, and to somewhat “predict the future” by figuring out what is likely to be popular in PHP for the next few years.

But my answer to them wasn’t what they expected. I told them that if they were new to PHP, that they should focus on learning PHP.

The siren song of frameworks

To a new developer just entering PHP, the framework can be an alluring siren, calling from afar. After all frameworks are powerful: they abstract away much of the mundane cruft that every application must implement, letting us focus instead on writing the code that makes our applications unique.

I can see the appeal. And yet, I believe that being framework specific is a serious disadvantage to any professional developer.

Starting with a framework leaves you tribal. It also disadvantages you when your framework of choice is no longer on top or popular. Anyone developing against Kohana or CodeIgniter knows well the terror that comes with suddenly finding your framework out of date and unsupported.

Learning the language is better.

Instead of focusing on a framework, focus on the language. This has some distinct advantages.

A developer who knows the language can take any well-documented framework and be up and running in a few days’ time. I know this is true of me, and it’s true of almost every great developer I know. Their knowledge of the language makes it possible to dive deeply into the framework, figure out how it works, and most importantly, adjust it if necessary. But developers who don’t know much about the underlying language have a harder time doing this.

In addition, it’s likely that the popular framework of today won’t be the popular framework of tomorrow. Right now Laravel is hot; a long time ago, it was CakePHP. What’s next? I don’t know. But I know that I don’t want to bet the farm on a single framework.

PHP isn’t Ruby, where there’s Rails or GTFO. We have so many frameworks that it’s nearly impossible to count them all. Many of them are wonderful frameworks with tremendous power. And yet, changes in the language or the state of our industry can render a framework out of favor almost immediately (Zend Framework 1 was hugely popular, and then PHP 5.3 came out).

The bottom line

Laravel is great. So is Symfony, and Silex, and AuraPHP and CakePHP. All of them are great frameworks with tremendous potential. And yet not one of them is a substitute for understanding PHP.

Understanding the language is what makes you a great developer. So, if you’re struggling with knowing where to place your bets, bet on PHP itself. Chances are good you won’t lose.

Brandon Savage is the author of Mastering Object Oriented PHP and Practical Design Patterns in PHP

Posted on 5/19/2014 at 2:31 pm
Categories: Best Practices, PHP

Michal (@michalzuber) wrote at 5/20/2014 12:43 am:

Thank you Brandon, very good thoughts.

Phil Sturgeon (@philsturgeon) wrote at 5/21/2014 5:28 pm:

I feel like my blog post was linked to out of context in that article.

> Starting with a framework leaves you tribal.

Not really. Only ever using one framework and ignoring all other frameworks, never using them and refusing to work with them leaves you in the “tribal war” state my blog post was talking about.

Just before it you said:

> I can see the appeal. And yet, I believe that being framework specific is a serious disadvantage to any professional developer.

In the long run sure, being tied to only one thing forever doesn’t work out so well, but not for a beginner. For a beginner it can offer a serious head-start for them to hit their goals, without overloading them with a huge amount of information.

They might need that information eventually, but night right at away and not all at once. Furthermore, they might not even actually care.

I’ve said before:

> “Beginners should not use frameworks” is idealistic tripe. Not everyone wants to be a world class programmer, some just wanna ship. :)

There is no single rule. It depends on the person, their skills and their interests and what sort of thing they’re building.

This article also seems to assume that the main reason somebody would have for changing a framework is popularity and not… you know… it’s specific strengths, weaknesses and target demographic.

Thanks for the link though chap! :)

Jaik Dean (@jaikdean) wrote at 5/22/2014 3:58 am:

Taking it one step further; the language you learn doesn’t really matter. Once you know how to program, you can move to a new language pretty quickly. The only difference is that you *must* choose a language to start with,

Brandon Savage (@brandonsavage) wrote at 5/22/2014 1:19 pm:

I tried that argument once, it didn’t go as well as you would hope. ;-)

Phil Sturgeon (@philsturgeon) wrote at 5/22/2014 1:23 pm:

It would of course be great if everyone knew everything. The more you learn the better. If you only have time to learn one then ok. Whatever.

None of this matters. Everyone will have their own approach to “Well real programmers should X” and even then they forget that not everyone wants to be a “real programmer.”
Not all programmers are computer science bros either.

That’s all fine.

Witali Mik (@xBlackScorpx) wrote at 6/3/2014 3:59 pm:

I personally learned kohana, zf1 and everytime i thought i would have a powerfull tool, they stopped to develop it further.

now iam practising in my freetime to develop a project where the business rules are not dependant on the framework.

Maybe someone will practise with me as well

using there silex + doctrine but just for the usuall stuffs like routing, database abstract layer, controller, configuration, template engine the entire businesslogic is inside src folder and working with interfaces, which has to be implemented by the framework implementations.

Marty Wondergem (@xmartinj) wrote at 6/4/2014 11:06 am:

Completely misusing or relying too heavily upon a framework is a part of the development process for programmers. Copying code, modifying it a little without exactly knowing what’s going on is actually the first step in “learning the language.”

It is possible to get stuck there, but one doesn’t have to get stuck.

Jeffrey Way does a good job of describing issues that arise out of common habits, and how Laravel or Composer or PHPSpec or PHP, etc address those issues. Phil’s blogs and code on REST services speaks to that as well.

I think the blogging community needs more of this tact, rather than show another to-do app using a new language/framework feature, describe real-world situations that were helped/solved by employing a new method.

max wrote at 6/10/2014 3:03 pm:

Thanks Bro. You are very right, when you learn the language properly, you can even develop your own framework to deliver many project on time.

« »

Copyright © 2024 by Brandon Savage. All rights reserved.