Dec 2013
“There are only two kinds of languages: the ones people complain about and the ones nobody uses”
– Bjarne Stroustrup, Creator of C++
< ?php $things_i_dont_miss_about_you = array(); ?>– Jeremy Clark, Simian Uprising
I’m starting to become a reasonably good developer. My lecturer told me so since I just passed a 4th year programming course as a first year CS student. Granted, I probably shouldn’t have been there to begin with but it was nice validation.
I think it means from the outside I’ve crossed some arbitrary threshold of technical competence whereby you’ve stopped being seen as junior and are an authority figure. Which is odd because I wouldn’t consider myself to be very good yet and very much junior.
How would you measure if you’re a good developer, besides some silly test? The best way I think you can tell is by looking at other developers. One of my friends Shayden Martin is one of the best programmers I know. He can write functionality in an hour that will take me a day. So in the broad sense I’m not very good.
Which is to say I don’t really like programming. I like it as an intellectual task and can be quite fun but it’s not something I could do endlessly without feeling a bit unwell. If I were to go into the business world I think I would be better at the business stuff than I would be a developer. But definitely would be technical.
As a result, have started getting into language flame wars and asked by people wanting to begin programming where they should start. Getting into arguments seems to be a defining trait of programmers who start to know what they are talking about.
The main reason is because I chose to learn PHP. Worse, because I actually like it. I really like PHP. Yet, I think a lot of programmers feel like they have to constantly justify PHP as a language choice. “You didn’t learn Ruby? What about Rails? It’s so beautiful.” Nope. Since I might be responsible for a number of new beginners to start learning PHP, I may as well explain the reasoning further. So I can defend myself when claimed to be contributing to the information cascade and downfall of the profession.
The major reason I like PHP is because it’s what I learned first. I think all programmers have a certain affinity towards the language they learned at the beginning and were good at. Almost like riding your first bike. It’s the tool with which you made all the mistakes and developed the confidence to progress further. You will always feel a sense of attachment to the bike and a sense of belonging to others who rode the same type of bike.
When I first got into software I knew most of what I would be writing would be web software. So chose a language best suited, or more precisely only suited, for the web. I also knew that people would always have to sell things so electronic commerce would be a good area to specialise in.
My foray into the field of software was as a 14 year old with a WordPress install. I wanted to start writing a magazine for school and after a lot of googling came across WordPress.
You can use WordPress without having an understanding of the inner workings of the internet. In fact, for a really long time I believed the backend of a WordPress site was the backend of the internet. I’d go to websites and genuinely believed the backend of the site was the backend of WordPress. “You mean all websites don’t look like this when you login?”
This was around the same time I believed Internet Explorer was the only way you could access the internet. It has Internet in its name afterall. The first in a string of lessons about file naming conventions.
It’s probably worth asking, what do you hope to achieve out of programming? If the answer is to just be able to implement ideas and not interested in exploring interesting technical problems or deeper recesses of the technology stack. Immediately you can rule out anything low level and a lot of the history. Software has reached a point that you do not necessarily need to understand the layers beneath it to write clean code that works and serves a purpose.
A programming language is just a big toolbox. And each tool is designed to complete a particular task. And you use the tools in different ways to solve problems. The choice of tool is largely innocuous but rather an indication of the amount of satisfaction a person gets from programming.
A good programmer can overcome the shortcomings in any language the same way a professional tennis player could still play high quality tennis with any tennis racquet, minus the time it would take to pick up the syntax. They may not be able to play at peak ability but would still be an excellent player. So from the perspective that any sufficiently talented developer can overcome the setbacks of poor language design, the choice of language shouldn’t actually matter.
The difference between languages largely comes down to taste. Sure there will be types of problems that different languages have a greater affinity for solving but a lot of this is so edge case it doesn’t really matter. And if you can’t find a library or framework that fixes this setback then you shouldn’t be using that language.
I would say the average programmer doesn’t utilise 70% of the functionality of a given language anyway so a lot of the hatred is about form and style not function and is a matter of preference. Language wars boil down to carpenters arguing over which type of hammer is better to use with a certain type of nail to make a certain type of proverbial furniture.
Deep in my heart, I can’t honestly say I can empathise with a person who enjoys writing Java code. And without meaning to that fear of the foreign translates into a dissatisfaction with people who like Java. It’s when people start to believe a language choice is a reflection of personality that the problems start to emerge. That types of people gravitate towards certain languages.
But a programmers job is to write code to serve a purpose, usually some business need. Therefore the code they write and their mastery over a language is an indication of their livelihood. Whenever something strays into the path where a persons worth can be derived from their use of a certain thing, however wrong that manner of thinking is, it’s going to create factions.
Rather than get into arguments over specific language features I’m going to go into why PHP became so popular and why I think it’s likely to stay that way. And if something is both useful and popular, and likely will remain so, there’s not really any good reason not to learn it. So the recommendation to learn PHP is therefore not bad advice.
Once you get over the syntax and technical stack understanding barrier, it becomes a lot easier to learn. Much easier. PHP is one of the easiest programming languages to learn. In fact the learning curve is near rollercoaster steep and few languages will make you feel like you are accomplishing as much, even though you may not be.
There is something to be said for how you feel when you program. PHP has an elegant feedback loop in the sense that the programmer feels really good after they write some functionality in PHP even though it looks ugly. The same way when you do a hard thing, you feel good about it afterwards.
This isn’t the case so much with Python or Ruby because the syntax is prettier. When you write functionality in those languages you don’t really feel like you achieved something, partially because you didn’t type as much. You feel like the language did it all rather than you the programmer did.
It tricks you into thinking you are doing something hard by just being not straightforward. I have a friend Jacqui Beech who when waiting for a tram, will prefer to walk from one stop to the next, just so she feels like she is progressing even though it makes no difference when she finally gets on the tram.
One of its major problems happens to also be one of its strengths. It’s web based. Which means you’ll never choose PHP to say write desktop software. So use is limited to the internet. But since the web won as the mechanism of action in the delivery of software, is not much of a hindrance.
There’s something to be said for picking one very specific task and doing it well. PHP started on the web and stayed on the web and as a result made the web a better place to be. Whereas a lot of languages like Python and Ruby began on a desktop and then migrated to the web with the help of frameworks.
Defending PHP is something of a precarious position to be in. You would not debate that it is a well designed language because it isn’t. It’s widely acknowledged how awful it is. I’m aware how much PHP sucks. From the first moment you look at the ugly syntax, you’ll experience a wave of nausea reminiscent of difficult and unwieldy high school math problems. Like looking at hieroglyphs. But after you get the hang of it. It becomes fairly intuitive and easy.
A lot of the rants against PHP are outdated with many of the uglier features having been deprecated and improvements added. What people forget is that the language is constantly changing and many of the poorer aspects of its design are slowly being remedied or obfuscated away.
How can something that looks this ugly be easy? It’s because it follows fairly predictable rules. If you learn HTML and CSS first, PHP will make a lot more sense because it behaves in a similar way. It’s because PHP is a scripting language that was intended for the web, so you can weave in and out of HTML with PHP scripts. In fact you tend not to save files as HTML anymore. All your files are saved as .php as invariably they all have chunks of PHP lying around.
Because it’s easy to write it’s also easy to end up with spaghetti code that is all over the place, since you write a lot and don’t fix it. I write code the same way I write English. The first thing I do is write a jumbled mess of ideas then go back and make it coherent and expand on the good points and delete the points that don’t matter. But it also means I have documents full of jumbled incoherent ideas.
But it’s not just easy to write, it also just works. It has that set and forget quality about it that such few things have. It’s common to have .php files sitting on a server and then to come back years later and for them still to be running without any hassle. When something has both the qualities of being easy to write and easy to learn, the conclusion might be that it’s probably not worth doing. But that would be false in this case. Because it is only easy by comparison within a field that is already hard.
Programming is a very difficult task for most people. It requires a mental flexibility that few people want to exercise. Because it uses parts of the mind that most people aren’t used to using. Kind of like when I first did Yoga and felt like my thighs were on fire because I wasn’t used to using them. The best description I’ve heard is that it is like sustained problem solving for long periods of time and requires conditioning in a manner of thinking to become good.
I think one secret advantage that not a lot of languages have is a popular CMS like WordPress. PHP has a few to choose from. Because you can install the CMS as a base template then extend the functionality as you see fit so can hack together rudimentary systems very quickly. It amplifies greatly a persons ability because there is already a jump off point.
I’m going to go out on a limb and say that PHP has the best, or at least most extensive, database functions of any other modern scripting language. There’s a reason why it’s assumed you are using MySQL when people talk about PHP development. And that the most popular SQL Graphical User Interface tool is called phpMyAdmin and in book titles you see PHP and MySQL as if they are two parts of the same thing. It’s because they are used so frequently together its near assumed by non-technical people they are binded.
The breakthrough moment for PHP came with the proliferation of MySQL as an opensource database alternative. This was back in a time where big companies used to sell databases as the main means of using one. So a free, lightweight, easy to use alternative would have been a godsend. As the web became essentially a giant interface to a database. PHP had the best and easiest to use functions to interface with MySQL so it grew in proportion which turned out to be exponentially. As web apps moved from a file-based architecture to a database driven architecture, the tectonic shift happens.
I don’t think people realise just how popular PHP is. It’s popularity is definitely underrepresented and if popularity is a signal of influence as it is in presidential elections, you’d conclude PHP to be the most influential voice on the internet. Besides Javascript which isn’t really a back end scripting language anyway. This is not entirely true as the pendulum tends to swing towards the vocal minority.
Roughly 81.3% of the internet at the time of this writing is written in PHP. I look at that figure and think, why would you learn anything else?
Popular sites that all use PHP include: Vk.com, Tumblr, Yahoo, Flickr, Photobucket, Digg, Mailchimp, Alibaba, TaoBao, Facebook, Wikipedia and nearly all major content management systems like WordPress, Drupal, Magento and Joomla.
But so much of its popularity is due to legacy. Rewriting an entire codebase is a non-trivial task and most companies do not want to bear the cost of switching. Patching and updating is much cheaper. It’s big systems that want to switch but can’t since they’ve invested too much. That level of inertia is also conjusive to creating a lot of employment. Which is why PHP developers are some of the most readily hireable.
A lot of the joy in programming a particular language is a function of the community supporting it. So you can always find helpful tutorials and documentation. Pretty much every shared server comes with support for PHP already installed. The user will run into very few if any configuration problems. And because it’s so popular there are a lot of libraries and the community is so vast, there will always be people to help or open-source projects to work on.
Something interesting to note is how old it is. PHP came out in 1995. This is an important point. PHP was popular in 2000. It was popular in 2005. It was popular in 2010. It’s still popular today. There’s a trend emerging. Things evolve quickly in technology. For a programming language to be popular for 5 years is an achievement. To be popular for 20 years is near a miracle. But popular is one thing, to power 80% of the internet is an entirely different order of magnitude.