This article will hopefully give you a better understanding of PHP, and how we get here in the first place.
Too many people know PHP without really understanding what’s going on under the hood.
The big picture as well as the small details. Not just the “how” but also the “why” and the “why not”.
First, I’d like to give you a better understanding of why I’m writing this article and how we got here in the first place. Afterwards I’ll help you get a better understanding of PHP.
I’ve been doing web development (mostly back-end) since 1995 (I actually introduced Zeev Suraski to PHP). I’ve been involved in projects ranging from complex sites with millions of page views a day, to helping kids write their first PHP script. Recently I’ve changed tracks, from mostly development, to teaching PHP. The title on my business card now reads “PHP Educator”. I was a technical instructor for 2 years in the army so this comes as second nature to me.
As part of my new role I have been exposed to a lot of people who want to learn PHP. In addition, I have become more aware of existing learning materials and other resources for people who want to learn PHP. This includes the PHP manual at php.net, various php “how to” web sites, articles, books, mailing lists, users groups, etc.
While many of the ideas in this article have been in my head for quite a while, it wasn’t until I started teaching that I connected the two main ideas I’d like to write about:
- There are two very different types of PHP programmers.
- Many of the “Learn PHP” articles online are evil.
After explaining why the two different types of PHP programmers are different, it should become obvious why most online articles are evil.
In many ways PHP has changed the landscape for computer programming. It has certainly lowered the entry barrier to programming:
- It can be embedded into an HTML document.
- It has a very easy learning curve: most people can start writing their own scripts within a couple of hours.
- Most Unix-based web-hosting packages include PHP support, more than any other programming language.1
- It has given the public a whole new motivation to write computer programs: anyone who is involved in creating web pages and wants dynamic content can easily do it.
- You can even download it to your PC or Mac and run it locally.
- All of this comes without a hefty pricetag; PHP is free!
I’ll be the first to say I am very glad that PHP has opened up the door to programming to so many people. Unfortunately, some issues have arisen because of the way most people learn PHP.
PHP was written from the ground up to solve a specific task – creating dynamic Web pages. In many ways, this makes PHP different from most other programming languages. In order to be exposed to most other programming languages, you would probably be a programmer, an aspiring programmer, or someone who is heavily into computers. For these people, programming is the “end”, not the “means”.
I know I got into programming this way. I learned programming because it was fun. There wasn’t a specific task I needed to accomplish. I just enjoyed it. Later, I got my Bachelor’s Degree in Computer Science.
On the other hand, many of the people who are exposed to and want to learn PHP, don’t really want to be programmers per se. They just want to create dynamic web sites. PHP is the means, not the end.
There is the php.net online documentation as well as plenty of online tutorial sites, and all of this information is FREE. You can read a few introduction tutorials, a few How-To articles and voila – you’ve just written your first guestbook in PHP.
The problem is that you’ve been learning how to use PHP to solve specific problems and not computer programming in general. These tutorials have been feeding you fish, but no one is teaching you how to fish for yourself.
All of this brings us back to why there are two different types of PHP programmers.
I think there are two main groups that most PHP programmers fall into.
1 – People who write computer programs for their day job. Most of these people either have some formal education in computer science, or have been programming for a while and are self taught and know the fundamentals of computer science.
For simplicity’s sake, I’ll call these people programmers.
2 – People whose day job involves the web or computers but their title is not “programmer”. These are usually web designers2, system administrators, PC technicians, etc. For them, PHP is something that can add value to their work, but is not their direct responsibility.
For simplicity’s sake, I’ll call these people “designers”.
The designers are very different from the programmers.. They lack a proper foundation of computer science fundamentals. The problem is that they don’t know what they’re missing. In other words, “they don’t know what they don’t know”.
This brings us to why many of the “Learn PHP” articles online are evil.
They’re written by the designers. Of course they mean well, but the articles often explain a specific solution to a specific problem. They usually teach by example, going into detail with the “how” but not the “why”. These people had a specific problem and were able to solve it with a specific solution. It works even if it’s not the “right” solution.
If all you know how to use is a hammer, everything looks like a nail.
Before I continue, I’d like to point out that in many cases, it doesn’t matter.
If you’re writing an intranet application that allows company employees to choose what they want for dinner, who cares how it’s written. If it works – it works. Period.
Unfortunately, the “if it works – it works” concept has crept into the professional realm as well. This is one of the biggest problems a company has when trying to evaluate programmers. You can’t “see” a computer program in the same way you can see a building or a piece of furniture.
Sure you can view the source, but that means nothing to non-programmers. All the client really cares about is if it works, not how it works. This means that your code could be:
- Insecure (easy to break into)
- Inefficient (gets really slow with large data sets)
- Non-scalable (won’t work for more than 100 users)
- Unmaintainable (difficult to understand and modify)
But it works.
For those of you who want to write applications that don’t just work, first you must understand how to write good software in general. My goal is to help you understand.
In my next article, I’ll help you understand the three pillars that hold up any great PHP programmer.
As always, comments are very much appreciated.
1. OK, I don’t have the facts to back-up the “more than any other language” but please send me data either proving or disproving this.