PHP - - By Matthew Setter

Can Great Apps Be Written in PHP – An Interview Series

Can Great Apps Be Written In PHP?

I read an old post, circa 2010, on the MailChimp blog a little while ago, about their experience using PHP.

It struck a chord with me, because the sentiments they shared I’ve felt myself, and heard echoed many times over the years. What are these sentiments, you may ask?

They’re the ones which infer that PHP, despite all its successes, really isn’t a true programming language. They’re the ones which intimate that, no matter how good you are, no matter what you’ve achieved, if you’re a PHP programmer, well, you’re really not a true developer, yet.

They’re the ones which suggest, or is that presuppose, that you should really become one of the cool kids developing in Ruby, Python, or Go; basically anything other than PHP. After all, what can you really do with PHP, right?

Despite its successes, or people’s successes with it (a la Facebook, MailChimp, Hailo, Google, and others), it’s inferred we should use languages which had their foundations as pure languages; not ones which came to be a language, as PHP evolved into over time.

Here’s a few excerpts from the MailChimp post, which highlight people’s reactions to them using PHP as the basis of their platform:

Despite its popularity, PHP is considered by the programming elite, almost without exception, as one of the worst languages currently in use today

The term “good PHP programmer” is considered an oxymoron

You can imagine the horror and surprise we see when we try to tell a good developer that we use PHP to solve cool and interesting problems

I’ve both heard these sentiments expressed and, at times, felt a sense of insecurity because of them. So the post really struck a chord with me. I’ve done so much with what was once quite a humble set of scripts which helped out with Rasmus’ early development tasks.

And so too did MailChimp.

From the same article, here are some of their successes:

We use this architecture to process well over thirty million emails sent by tens of thousands of users every day, generating tens of millions of bounces, opens, clicks, and unsubscribes that all need to be handled in near-real time. We further process millions of API requests and millions of subscribes and confirmations every day.

All told, we handle well over 500 million dynamic page views a month. Our backend systems run millions of jobs every day, calculating statistics, querying geographic data, and scanning everything for bad behavior and abuse.

This is just going to get bigger and bigger as we grow by 500% or more every year

But despite this, PHP usually has a bit of a hard time, reputation-wise. At the PHP UK Conference in London on the weekend, Glen Campbell, one of the keynote speakers, expanded on this, referencing a number of links during his talk. Here’s a few excerpts from some of them:

One of the harshest, PHP: a fractal of bad design, writes:

PHP is the lone exception. Virtually every feature in PHP is broken somehow. The language, the framework, the ecosystem, are all just bad. And I can’t even point out any single damning thing, because the damage is so systemic. Every time I try to compile a list of PHP gripes, I get stuck in this depth-first search discovering more and more appalling trivia. (Hence, fractal.)

PHP is an embarrassment, a blight upon my craft. It’s so broken, but so lauded by every empowered amateur who’s yet to learn anything else, as to be maddening. It has paltry few redeeming qualities and I would prefer to forget it exists at all.

Jeff Atwood, from Coding Horror, has this to say:

What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?

He also tweeted that:

PHP is the Nickelback of programming languages.

There’s a few subtle presuppositions in that assertion, but we’ll leave that for another time.

Or how about this quote from Fredrik Holmstrm:

Every solution I’ve ever seen or developed in PHP feels clunky and bulky, there is no elegance or grace. Working with PHP is a bit like throwing a 10 pound concrete cube from a ten story building: You’ll get where you’re going fast, but it’s not very elegant. … I love PHP, and it’s the right tool for some jobs. It’s just an ugly, cumbersome tool that makes me cry and have nightmares. It’s the new VB6 in a C dress.

Are These Assertions Correct?

I won’t say that PHP applications are always shining examples of software engineering excellence. But the old adage of a poor worker blames his tools can also be attributed here.

I’ve built applications which manage political fundraising events, simplify LDAP interfacing, customise e-commerce shops and more.

I’ve seen others build affiliate networks, create large CMS’ and finance packages. I’ve seen all manner of companies offer PHP bindings, such as Stripe, FreeAgent, Twilio and more.

So it got me thinking. Am I the only one who feels that, despite PHP’s shortcomings, it’s still infinitely more than capable?

Do others have similar sentiments, and like Glenn suggested in his talk, that we needn’t worry about the negativity and just get on with doing great things with PHP? I know there are!

Feedback From Actual Developers

So I decided to get out there and interview a number of people, people with solid, practical, experience, developing applications of varying sizes with PHP and get their input.

These are developers from a diverse range of companies and backgrounds; including freelance developers, expert development teams, such as Roave, through to large companies, such as MailChimp themselves.

Here on SitePoint over the coming weeks, I’ll be sharing these interviews with you. I’m confident they will show you that despite the validity of some of the criticisms circulating about, it’s largely inconsequential.

I’m confident you’ll find that if you’re a professional, you can make serious, enterprise, applications with PHP, should you choose to do so. What follows is the first interview, with Bobby Deveaux from Twist Digital.


What Lead You To PHP?

Back in the Year 2000, I was playing a game online called Planetarion. It was a MMORPG – I loved it! I was only 15 at the time and had limited knowledge, so I tried to download the game using wget. Silly me.

I researched online how to create a PHP file (the game was written in PHP). I ended up downloading Black Nova Traders from SourceForge (http://sourceforge.net/projects/blacknova/) – I contributed and learned a lot of PHP (bad, but PHP nonetheless). It introduced me to ADODB & MySQL, and the foundations of my PHP skills. The is the primary reason I love Open Source.

What Have Been the Things About PHP That Bit You?

It’s difficult to say whether things that have bit me were due to PHP or not. But some things I do find really frustrating, even with the docs, is the age-old needle/haystack or haystack/needle issue.

It’s so minor, but I can’t remember the order for every function. Maybe it’s my bad for my choice of IDE, or perhaps I should just accept it… but come-on, array_walk and array_map having a different order?!

What Have Been The Highlights Or Redeeming Features

Over the years I’ve seen a lot of messy code. Admittedly, maybe at the time I thought it looked nice; but the great thing about the PHP community is that there are always improvements and new ideas being thrown around and it’s great to see how things have evolved.

What Are The Compelling PHP Features For You?

It’s ease. It’s so easy to throw together some code. I know some people find this the enemy, and the source of all evil, but quick doesn’t always mean dirty.

What Do You Want To See Added To The Language?

I’m not a sucker for perfection; and I’m not particularly too fussed about anything being added. The guys that work on PHP do an amazing job, and whatever they add is greatly appreciated. I like PHP for what is is. It certainly has it’s quirks, but it’s what I’ve grown to love about it.

Why PHP over Ruby, Python or Go?

I’m a Developer, not a PHP Developer – but I get paid to work on codebases which are mostly PHP, largely due to my experience. I’ve done my fair share of coding in Python and I like it. Once upon a time I used C#.NET, but that was short-lived. For personal projects though, I’ve started to use Go.

Do You See Yourself Moving To Another Language in the Future?

Definitely, I love the speed of Go. The only problem is finding time to learn how to use it effectively, and to create apps as quickly as I can in PHP.

Do You Have a Custom Framework or Setup?

I tend to use Silex as my base for APIs. For frontends I use either ZF2, Symfony2 of Kohana – depending on the requirements.

How Have You Implemented Deployment?

We currently have a release script, which basically SSH’s to all the servers and checks out a specific tag. i.e. ‘git checkout tags/v1.2.1’. I’m only a few months into a new job and we’re making a lot of changes. We’re working towards setting up a continuous integration server, but first I need to get the team writing unit tests.

We work on specific branches for every task and always deploy to a test/staging environment for QA. Our release script notifies the team of the commits between revisions and there is a ‘confirm’ release button to ensure it’s only released if everyone is happy.

What is in Your Standard Toolchain?

OSX, Sublime Text 3, Sequel Pro, Dropbox, Mou & Github, and of course, Spotify. We always use CodeSniffer to ensure code is neat, plus Sami for PHP documentation.

What Testing Tips Can You Share?

Aim for 100% coverage on unit tests. You might not get there, but make sure you aim for it. Some will say that it’s meaningless, but that’s usually because they’re writing the wrong tests.

Functional, non-coverage tests are fine when required, but if your unit tests are right then you’re probably covered. Behat BDD is worth a look if you haven’t already.. oh, and PHPSpec!

Are There Tools You Use Which You Can’t Live Without?

I’d be pretty stuck without OSX! I hop between Macs and sometimes I only have SSH. I can do everything I want with SSH and my SSH Key!

How Does Your Team Work?

When I started I managed to implement very mild agile implementation. We have a SCRUM board, but it’s not really SCRUM. The board has our stories/tasks but they have no effort/time estimate.

It goes against a lot of what I believe in, however we have a project manager responsible for managing expectations and, to be fair, it’s working really well. We can release multiple times a day via git tags and we keep the business happy.

Unfortunately due to the workload we tend to be a reactive team, rather than proactive. I’d like to implement SCRUM properly and let the project manager play the product owner role.. one day :)

Outro

So, did Bobby’s experience strike a chord with you? Can you relate? Have his experiences given you food for thought? Share your thoughts in the comments.

Sponsors
Login or Create Account to Comment
Login Create Account