With my departure from Zend this week I figured now might be a good time to reflect on the past 5.5 years. I will still be working with Zend as a contractor, most specifically to make sure the ZendCon 2012 content is handled properly along with some other tasks. But I will be spending my time being self-employed, working on mobile applications. There have been a few ideas I’ve had toying around in my head for a while and it’s probably time that I put my money where my mouth is.
I do like working with client/server-like architectures and so I intend to be building apps that have a fair amount of server-side processing to back it up. More details on that to come in the next few months.
I have decided that, for the time being, to use PhoneGap for my frontend development. There are several reasons for this. 1) HTML 5 is at the point where you can create compelling data-driven applications, 2) I didn’t want to have to learn a bunch of new languages/ecosystems to get up and running, 3) I wanted to use my existing skill set. OK, 2 and 3 are about the same, though a little different.
So the question was what to use for the backend development and, to nobody’s surprise I presume, PHP is my chosen way to go.
You might think that “Duh, the Zend guy picked PHP” but that’s not the whole story. When I first started using PHP I didn’t like it at all, but I learned it. My preference was actually Perl and Java. Tried my hand at C but pointers keep messing me up, even to this day. I have no idea why. But I got the call saying that Zend was looking for a consultant and I figured I’d give it a shot. How I got past the interview process, I don’t know. Maybe they were desperate. I liked the language but I was more interested in the challenges that I would have to overcome as a consultant.
But now that my work life is switching gears I have to make the decision again. Do I continue to do work with PHP or do I choose something newer and flashier to get the job done? PHP was my choice and it remains my choice. But why? Here are 10 reasons.
- PHP is stupid easy to scale – In the unlikely event that any of my projects go viral I will have the need to scale quickly. PHP does it quite easily due to its shared-nothing architecture. I can drop in more servers and increase my cluster size by orders of magnitude with very little configuration.
- I won’t need experts – If the event that my new ventures grow and I need to hire on more programmers I do not need the best and brightest to get the job done. PHP just works, in many cases. If you have an organization that needs to hire the best and brightest you are probably doing it wrong. The best and brightest are expensive, moody and prone to boredom. PHP allows you to set up processes that can allow ordinary programmers do extraordinary things. Very, very few languages can do that.
- It is tied to the web – HTTP is an imperfect protocol. But it is prolific, for good reasons, IMHO. PHP is bound directly to HTTP. You can run it in non-HTTP environments but it is built for HTTP. Since my communication will be over HTTP, PHP makes a lot of sense.
- When it fails, it doesn’t fail hard – Granted, you can fail spectacularly with PHP, but it probably won’t be PHP’s fault. Because PHP cleans up and starts over for each request, one request will not corrupt another. Other languages need a lot of plumbing to handle that. PHP does it by default.
- Frameworks – There are a plethora of frameworks to chose from. While some may consider that a drawback, I consider it a strength. If you need something that supports a complicated, or enterprise-like application you have the likes of Zend Framework or Symfony. If you need something simpler you have Silex or Slim.
- Best documentation on the web – Sure it looks like it was stylized by Tim Burton’s Joker but the content is prolific. Every function and method call has some kind of documentation and a great number of functions have tons of examples. Not all of the examples are good, but there are enough of them that you can get moving in the right direction quite easily. The only thing I wished that was different was that you could log in with Twitter or something like that to propose a change. I have enough logins as it is. (Correction, you can log in and edit the docs with a Facebook login). But even so. Best. Documentation. Around.
- Tons of blogs – PHP developers love to blog. Notoriety in PHPLand is based largely on how much you share information with other people and lots of people take this to heart.
- The PHP Community – This could also be seen as a 7(b). But there is no shortage of people who are willing to help you on IRC, Twitter or a host of other places. You just need to know where to look. Special mention must go to Cal Evans and Michelangelo van Dam who have put up with me and done more for me than I ever could have reciprocated, for various reasons.
- It integrates with everything – There are tons of interfaces to third party systems. Some of them are native like MongoDB or Memcache, some of them are PHP-based like Pusher. And that’s not surprising, really. PHP powers a third of the web and is used by banks, transportation, governments with tons of business critical applications. PHP should be a wide open target for anyone attempting to make a play for web-enabled applications.
- Dynamic typing – “But how do you know if you’re working with an int or a string?” By using your brain. HTTP does not do typing and so PHP does not do (strong) typing for scalars. Quite frankly, it makes complete sense to do it that way. Want an int? Cast the damn thing and stop complaining. Dynamic typing significantly reduces the amount of code you need to write and error conditions you need to check for.
- It plain works – Programmer’s have it wrong. The technical solution is not the end goal. Technology should be an enabler. Do you have a wonderful technical solution that doesn’t solve a problem? Bye, bye. PHP solves problems faster, easier and with a lower cost of ownership than almost anything out there. A lot of that is based on “assumptions” (or shortcuts) that PHP takes to solve a problem. Most often those shortcuts work, and the workarounds are very easy to implement (I’m thinking mainly about strict type checking here).
<Also, comments will be liberally deleted if you’re going to be an ass about this post />