Home | Benchmarks | Categories | Atom Feed

Posted on Thu 30 October 2014 under Python

Former PHP developer

Around March 2011 I sat down at home and began going through the poll app tutorial for Django 1.3. After that I built a blog in Django. After that, I didn't care if I would face long periods of unemployment, I wanted to stop developing software in PHP, both personally and professionally, and focus my efforts on being a Python developer.

At the time I was working as a PHP developer at Bloomberg. In September 2011, I spent a few hours quitting work on a Friday and on the following Monday I had a contract with a digital agency in Shoreditch, not far from Bloomberg's offices in East London.

I was to build a video editing and research tool for the agency's client, the UK's Royal Mail. The tool let users search through subtitles, highlight them, use the time points of the subtitles to crop the section out of the video they were for and then all the short video clips could be strung together into a single movie - much more interesting than anything I did up to that point in 2011.

After a few weeks as a professional Python developer I felt bad that PHP code I wrote wasn't using the best practices, even at the time of authoring, out of ignorance of not comparing PHP syntax and idioms to other languages. I ignored a lot of criticism of the language for a long time. A lot of that software I wrote will live on running and being maintained for some time to come. I wish I could apologise to the new maintainers, if only I knew who they were.

I want to walk through a comparison of ecosystems and pedigree between PHP and Python which eventually led me to stop developing software in PHP.

Language founders

Guido van Rossum, author of the Python programming language has contributed to BSD Unix as far back as 1986, he spent 7 years at Google building their Google Cloud offering and is now at Dropbox. That is a fantastic CV.

Rasmus Lerdorf, the creator of PHP, worked at Yahoo from 2002 till 2009, a company that has a hard time outshining Google when it comes to technical innovation. I can't find any of his achievements at Yahoo during that time but I know they don't have a PaaS service that's competitive with Google App Engine.

One of Lerdorf's famous quotes is "I don't know how to stop it, there was never any intent to write a programming language [...] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."

Fellow founders Andi Gutmans and Zeev Suraski have almost nothing of interest in their careers mentioned on their respective wikipedia pages beyond living it large off of PHP.

The latests versions

I'll admit that updating a programming language and pulling its respective community into the latest version is difficult to accomplish.

Python's biggest problem with Python 3 is that Python 2.7 does most jobs so well that the community has been slow to move to Python 3.

PHP 6, which had been worked on from 2005 till 2010 has been abandoned and will never see the light of day.

Code quality

In August 2013, Coverity, a software quality and security testing company, analysed CPython and stated "Python has achieved a defect density of .005 (or .005 defects per 1,000 lines of code) and has eliminated all high-risk defects in its codebase.". Of the 996 defects they uncovered, 860 were fixed by the Python community at the time of the press release.

To compare, in 2011, only 70% of the PHP 5.3 code base had unit tests. Unit tests prove you're code might be broken, no tests ensure your code is broken.

But Facebook is written in PHP!

I had a look at their Open Source site and they do say the early site was built in PHP. They then go on to say how they've used and contributed to Hadoop (written in Java) and memcached (written in c). Tornado, an evented web framework written in Python, was originally built by Facebook for their messages service.

Being able to make sense of user's data for advertising purposes seems like a big area of focus for their engineering efforts. Their messages functionality is a major use case of their service and probably deserves as much credit to their success as the wall functionality.

But it's not 2004 anymore. Would Facebook start many of their new code projects in PHP today? I looked at the 20 most recently updated projects on Facebook's GitHub page. 5 were in C++, 5 in JavaScript, 4 in Java, 2 in Ruby, 1 in Python, 1 in Objective-C++, 1 in OCaml and finally, 1 in PHP. PHP doesn't seem to be their go-to language for many solutions lately.

But (some) PHP projects have wide adoption

It's great that Wordpress is popular and Facebook have gotten so much mileage out of their PHP code base. This doesn't mean PHP is better than Ruby or Python would have been for either of these solutions.

PHP is an artefact and not the way of the future. Every new programming language one learns will offer them a new way of solving problems and a new perspective on how to interact with computers. I encourage every PHP developer reading this to take a deep breath and consider porting your PHP projects to another language.

Thank you for taking the time to read this post. I offer both consulting and hands-on development services to clients in North America and Europe. If you'd like to discuss how my offerings can help your business please contact me via LinkedIn.

Copyright © 2014 - 2024 Mark Litwintschik. This site's template is based off a template by Giulio Fidente.