The PHP Hierarchy of Needs
We had a lecture about Unit Testing in our local PHP user group last week. I really like these meetings because there is usually good interaction between some very experienced developers and some very inexperienced ones.
Following the usual “but why is it better then just running it in my browser and seeing that it works” question made by one of the younglings, we got into a discussion of why Unit Testing it so good, and especially, why is it such an addictive practice and why people who do it (including myself) tend to love it so much.
And then it hit me: I love Unit Testing because it makes me feel good about myself. Whenever I’m down, I can just type “phpunit AllTests” or whatever and see all my tests pass - Hundreds of them, and instantly. My code works - and I get reassurance from the impartial, objective and always truth-telling machine. Hooray!
As I realized that, the importance of self-esteem reminded me of vague, distant psychology classes from a different life - and funny pyramid shapes started forming out of nowhere.
It didn’t take me a lot of time to come up with the rest - so I hereby give you (drumroll…) A Theory of the Code Monkey’s Motivation, AKA The PHP Hierarchy of Needs:

It is actually quite simple, and understanding it can give you an insight to what I think makes a programmer happy and in peace with himself and his work:
- Physical needs: A Keyboard. I mean seriously, you don’t need much more in order to call yourself a PHP programmer. You’ll probably also need a browser so you can access the PHP manual, and something like notepad to write code in.
Those of us used to higher physical standards will probably use a fancy IDE - but it’s still in the physical needs layer.
- Safety needs: A Dev Server. In psychology, after you’ve got the basic physical needs, you need to secure them. In the PHP world, once you can actually write code you’ll probably fuck something up on your customer’s (or company’s) live servers.
You need safety - and that usually comes at the form of a development PHP environment. Something that will make sure you can fuck things up in your code, but have a safety net.
- Love and Belonging: Source Control. Sooner or later, you start realizing you work in a team, and a team needs special tools. Source Control systems such as Subversion, CVS or even Git if you’re really hard-core are the first step. This category also includes bug tracking systems, API documentation, and all sorts of groupware tools.
Maslow also puts sexual intimacy in this category - well, when you’ll spend the night committing, merging and rolling back with your team mates, you’ll know why.
- Esteem: Unit Testing. Assurance and reassurance are important - and unit testing gives you automatic reassurance. You know it works, you know it’s covered, and you feel good about yourself. You gain confidence in your code, and in the code of your team mates. You respect them and they respect you (well, as long as you don’t break the tests).
Even when you change something in your code which causes tests to fail - the mere fact that you (or one of your mates) was smart enough to cover it by a unit test, makes you feel all warm inside.
- Self-actualization: Refactoring. If there’s one thing that makes me feel even better than what seeing those tests pass does, it’s refactoring: making something that already works work even better, faster or in a more efficient way without breaking it or rewriting the API. I spend two hours on it - and now it runs twice as fast, and all tests pass! what can be better?
This is where your elite programming and design skills as well as your creativity come into play and help you solve problems. Besides, if you can refactor it, it means you’ve been doing a good job so far.
Oh and one more thing: it feels even better to refactor someone else’s code - doesn’t it? Perhaps the sixth stage in Maslow’s Hierarchy should have been “Being better than the other guy”
BTW I ripped the Pyramid drawing off of Wikipedia, and its licensed under the LGPL. That means you can reuse it - the SVG source with the changes I’ve made is available here.















What about satisfied customers?
If you are in a company you might want a well defined product as part of the safety step to be sure you will not need to write the whole thing again
Hi,
You know as well as I do that most developers don’t care about customer satisfaction - unless they happen to be business-oriented and very developers are (and for good reasons!)
Also, this pyramid is for PHP developers - not for QA engineers