Skip to main content

At some point I know I’m going to have to learn Swift and get my head around the implications of PHP 7 (and, I guess, 5.6, since I didn’t pay much attention to it when it was released). Despite spending a roughly even amount of time between writing mobile code and server code these days, I’m far more motivated to dig into Swift than PHP.

That may be an obvious statement to make. It’s clear that Swift is a new language with plenty of hype around it, and learning it will have a positive impact on my skill set. I’m unlikely to stop spending the majority of my time working on iOS apps so it makes sense to focus on where the future of the platform lies.

Moving away from Objective-C just as I’m beginning to feel like I’ve cracked it might be a little galling, but there’s no mistaking the sense that other developers are moving on and I don’t want to be left too far behind (I’m more than happy for others to go ahead and tell me what works and what doesn’t!).

I still believe, as I have since Swift launched, that given the instability in its syntax it’s still not yet wise to use it as the primary language in large critical projects if one is already experienced with Objective-C. It could be used to write tests or in separate modules and frameworks maybe, but I would hesitate to write the majority of a codebase in it.

Aside from the obvious risk of rework as syntax changes, I just wouldn’t be happy writing code I know I couldn’t count on, and somehow that feeling of optimism and security is crucial to me if I’m to do my best work.

With Swift 3 due to launch later this year though, and a promise that its arrival will signal the end of this period of substantial change, it’s definitely time to take Swift seriously. I can finally read articles without hearing that little voice in the back of my mind, warning me that I’m wasting my time learning something that might soon be irrelevant. I mean, that’s always a danger in this line of work, but when things breaking is a certainty it’s a concern that’s difficult to ignore.

Perhaps the most intriguing aspect of Swift right now is the fact that it was made open source at the end of last year, along with an updated version of Apple’s Foundation framework. This raises the prospect of being able to write incredibly fast, secure Swift code outside the Apple ecosystem – on a Linux server, for example. This is something that lots of people are excited about.

Enthused as I am by this, I can’t help but feel bittersweet at the prospect of PHP no longer being my go-to language on the server.

Bipsync_Learning_Swift&PHPFor some time I’ve pined for a way to take advantage of my familiarity with PHP in other situations – like mobile apps – so I could be more productive. But first JavaScript, and soon in all likelihood Swift, have instead made the journey from the client to the server, and I’m beginning to ask myself why I’m not just becoming as productive in one of those languages instead. JavaScript and Node are getting nicer and nicer to work with, and I’m already quite experienced with the former.

Two factors mean I won’t be giving up on PHP just yet. PHP 7’s release, bringing with it not just a panacea to the performance issues that have always held it back but also a rejuvenated community that suggests more improvements are to come, is one. The second is that it makes up a substantial part of the Bipsync codebase (along with Objective-C, JavaScript, Python and, yes, Swift), since many of us are familiar with it and know intimately what it can and can’t do – we’ve been able to move very fast as a result.

To a certain extent I think I’ve learned all I need to do 95% of what I’ll ever need to do with PHP.

The older I get, the simpler my code gets. I don’t feel pressured to use newer features like yield if I can achieve what I want without them.

The addition of closures in version 5.3, enabling us to use functional approaches like map/reduce much more succinctly, was the last feature introduced to PHP that I can remember fundamentally changing my approach to coding – and that came over 5 years ago. It’s very rare these days that I find myself wishing PHP could do something it can’t. That’s a good thing. I’m not saying the language shouldn’t evolve – just that I don’t need it to.

Right now I’m working with more platforms than ever before while trying to write less code in fewer languages. I’m happy I can rely on PHP and Objective-C when I need to, but I’m excited to think what I’ll be able to achieve with Swift, JavaScript, and whatever succeeds them in years to come.