Friday, January 18, 2013

Laravel 4 dilemma


Like many folks in the +Laravel community, I’m struggling with whether to stop developing in Laravel 3 and switch to Laravel 4 now, rather than later. I’ve watched the Laravel 4 screencasts, read the ‘what's new and improved...’ blog posts and tutorials, lurked in the IRC channel, read the issues and related comments on GitHub, seen the questions and answers on StackOverflow, checked out the UserVoice suggestions, the Twitter feeds, the Laravel 4 forum and of course the excellent and ever-improving new docs. There’s a lot there to like, and fear. A lot to digest too.

I have a relatively heavy investment in both the time spent selecting Laravel 3 over other frameworks (which included deciding to stick with +PHP) and in learning L3 (not there yet). But I’m only a few weeks into putting together a Twitter Bootstrap, Backbone, Laravel v3 site, parts of which are behind schedule, that’s basically due in about 6 months.

I’d be happy to keep working in L3 if I thought that it would be easy to port a fairly sophisticated site (lots of bundles, lots of 3rd-party dependencies and integration) from L3 to L4, but as I see more people using the beta I’m becoming increasingly concerned about important parts of L3 that aren’t being carried over into L4 (bundles for instance), with no clear guarantee that they ever will be, as well as aspects of L4 that significantly differ (changes to routing and PSR-0 class names immediately come to mind) as well as other incompatibilities related to the switch to Composer, more reliance on Symfony components, and the increased use of IoC. Laravel 4 seems like a significant upgrade in both functionality and complexity, losing some of what made it more fun (and productive) in the first place.

It’s starting to look like it’s going to require a significant amount of work to port a L3 app to L4. It’s also looking like a lot of the work I’m currently doing in L3 is handled much more effectively in L4. For instance, the changes to routing make routing both easier (resource routes) and more sophisticated (regex). But ‘resource routes’ can’t currently be ‘named routes’, breaking named routing references. So can I use them? Not really, not without names. Will a naming convention be included at some point? Unclear -- and this is a problem.

I know L4 is currently just an early beta, but traditionally a beta version is expected to be feature-complete but buggy. I know that the trend is to release feature-incomplete alphas and call them betas, but it’s hard to reconcile this with a development framework on which I depend. I know too that L3 has had a somewhat rolling feature set and this has been a source of both praise and criticism. It’s seems that L4 is unlikely to lose features at this point, but it also seems likely that it will be some time before it stabilizes. I know that the Laravel developers are working their butts off and that some of what appears to be instability is just not yet documented. But I also see that some of the changes they’ve made in L4 may not stand up in the face of growing resistance from a rapidly expanding L3 user base — they don’t have the same freedom that +Taylor Otwell  had when he upgraded Laravel v2 to v3.

You see, I come to Laravel from +Symfony2, not CodeIgniter like so many who have embraced Laravel. I started working with Symfony around v0.8 and have some experience (mostly bad) working with a framework that changes significantly under my feet. For a while, the Symfony team helped by providing conversion scripts that made the bulk of the code changes required to move from release to release (there was still a lot of work), but these stopped working for me around v1.2 and I never did upgrade my older apps to v1.4. I stopped using Symfony entirely with v2 because it was pointless to port my oldest (and most stable) apps and it was actually easier to work without a framework for most of the work I was doing.

So it looks to me like Laravel is headed down the same road, and perhaps this is inevitable. My experience with Symfony pushes me to embrace L4 as soon as possible to minimize the amount of time spent working in a less-effective, but stable, older version that I eventually must abandon. But the current lack of stability in L4 keeps me where I am in L3. Meanwhile I focus on the frontend, setting up tests and stubbing out the backend, and flirting with other frameworks.

Just had to get that off my chest.