PHP Interview With Chris Hartjes The Grumpy Programmer Of The PHP Community

About This Interview

This is the #7th set of PHP Interview to help aspiring PHP developers and PHP fans alike to get inspired by listening from those PHPeople who are already highly involved into the PHP Ocean and *being there* taming the waves and surfing better than ever to make themselves an Awesome PHP Expert both in their own eyes (for self-accomplishment) and for the PHP Community.

On the other side, this is an opportunity for new PHPers to get to know their “PHP Elders. I hope you will derive as much fun to read my interviews as I’m having by interviewing those awesome PHP people.

A Small Intro..

The Grumpy Progammer
Chris Hartjes – The Grumpy Programmer

In this edition I talked with Chris Hartjes (@grmpyprogrammer), the co-organizer of the GTA PHP User Group (@gtaphp). Chris is a real Grumpy PHP Programmer! But grumpy in a very positive sense though. He focuses his effort in applying and transcending his best practice ideals with the codes he write. I would tag him as the “perfectionist programmer“; he will not hesitate to scrap his piece of work if he finds a fault or a room for improvement and start all over again with that “eye for perfection”. In this interview, he will talk a bit about those coding best practices fortunately.

But despite his Grumpy-ness in the PHP Coding World, the Elephant herder (aka Chris) is very much appreciated for his smiling attitude – as The Icon Of The PHP Community Cal Evans vouched in his own interview with Hartjes back in 2007 (@CalEvans); indeed he is another valued player in the PHP Community. At the time of this writing, as per wefollow.com, he is ranked as the 28th (out of 2,558) most influential person for #php and as the 5th (out of 106) most influential person on Twitter for #cakephp. You can find his presentations on slideshare – some of his talks include:

  • Building Testable PHP Applications
  • Modern Application Stacks

If I Had To Compare Him With A Football Player

Since Chris asked on Twitter (and I take that as a challenge 😛 ) :

@grmpyprogrammer

I would surely tagged him as Eric Cantona  who is The King Of Old Trafford, Man Utd. A perfect match as far as the attitude and philosophy is concerned. 😉 Some characteristics of Eric:

  • 101% grumpy both on the pitch and off the pitch – But grumpy for a good reason, live your passion. No passion, don’t play football!
  • You cannot argue with what Cantona says, just know that his ideals are right
  • He played excellent football, and will be an excellent Coach too if he is with the best Team – his Best practice suggest that given the best environment and best tools, the Best cannot be anything else apart from “Being The Best!”

And Now The Interview…

1) Please tell us a bit about yourself

I describe myself as an Internet plumber or electrician. I’m not the type who makes good-looking web sites or builds intuitive interfaces for people. I do code behind the scenes making sure that everything is working the way that it is supposed to. Like a plumber who is trying unclog a pipe or an electrician trying to make sense of some old wiring, I spend a lot of time staring at code and trying to figure out how it is even supposed to be working. I’ve been doing this sort of thing since 1998, mostly with PHP but with some Javascript and Python being used too.

I write books, my latest being “The Grumpy Programmer’s Guide to Building Testable Applications in PHP“. I’ve been blogging for a long time over at TheKeyBoard and are posting many, many times a day via my Twitter account. I also love speaking and attending conferences.

I’m a born-and-raised Canadian, having lived my entire life in and around Toronto. I currently live in Canada’s fastest-growing community, Milton, Ontario.

2) How you started with PHP

I first started using PHP early in 1998. I don’t remember what version. I chose PHP because my employer at the time wanted a dynamic web site but did not want to pay for Windows server licenses. I had used Perl a little bit in college, and I don’t remember why I didn’t say “well, I know a little Perl so let’s see what is out there to help me build a web site?” I’m pretty sure my Perl skills today are at the same level they were back then: non-existent.

3) How do you find PHP now as compared to when you first started

I find that PHP changes in big leaps forward, not slow incremental changes. The biggest change between now and then is all the work put into OOP structures in an attempt to make it easier to build things. In my opinion, the inclusion of traits is just the latest in a serious of additions to make it easier to go all-in with reusing and extending objects in PHP. It should make the framework people happy. 😛

Little by little we are seeing additions that just match better to how other web-capable scripting languages do things: closures and short array syntax immediately come to mind.

4) Based on your experience, what are the good and bad parts of PHP

The good part for me is that PHP by default encourages you to “share nothing” in your architecture. That makes it easier to build horizontally-scalable applications so long as you actually understand the challenges you face there.

I think a bad part of PHP is inconsistency in parameter order for internal functions. Anyone who has worked with PHP for any short period of time sees how hard it is to anticipate which of ‘haystack‘ or ‘needle‘ is going to come first for the array manipulation functions.

5) What would be the Top advice to a PHP beginner

I did a blog post related to this topic, so I can summarise it here: understand that PHP’s best role is as glue that binds components together. I think understanding that is the key to writing good PHP.

6) To someone who wants to become a better PHP developer, what is your advice?

Get onto Twitter and find out what other PHP developers are doing and how they are solving problems.

7) The best PHP book you’ve read

I used very few PHP books while learning PHP itself since I could find so much information online. If I were to recommend one book, I found “PHP Master: Write Cutting-edge Code” by Lorna Mitchell (@lornajane), Davey Shafik (@dshafik) and Matthew Turland (@elazar) to be very useful.

Disclaimer: I personally know all three authors and will not receive any compensation for promoting the book. I paid for my own copy. 😛

8) A PHP blog or resource you highly recommend

phpdeveloper.org (@phpdeveloper)

9) The IDE that you use

I use Vim with a whole bunch of plug-ins. I am constantly evaluating new plug-ins to see if they assist me with my current set of tasks. I use the following right now:

  • vundle (to organize my plugins)
  • supertab
  • vim-powerline
  • tagbar
  • vim-addon-mw-utils
  • tlib_vim
  • vim-fugitive
  • vim-repeat
  • vim-unimpaired
  • closetag.vim
  • Gist.vim
  • surround.vim

10) How do you debug your PHP code, do you use something like xdebug or krumo..etc?

I debug using a variety of strategies:

  • ad-hoc unit tests
  • lots of error_log() statements
  • analysing output of API calls for consistency

When I do need to look at performance I use XDebug and xhprof, depending on the mood and the amount of time I have to set up all the associated tools.

11) A PHP framework you use and would recommend

I don’t have one favourite framework but I prefer to use ones that promote modularity and allow you to only include the modules you want to use. No more kitchen-sink frameworks for me.

12) A unit test framework you recommend using?

PHPUnit but I am starting to like Behat as I can trick non-technical people into writing test cases for me.

13) Your LAMP stack comprises.. ?

Ubuntu + Nginx + MySQL + PHP + PHP-FPM, always the latest stable versions of them too.

14) One PHP person that you admire and what strikes you about him/her

Rasmus Lerdorf (@rasmus). Listening to him speak about PHP always reminds me of how it really should be used.

15) One function that you like (or which you tend to use frequently)

error_log()

16) One PHP Community that you recommend

I have learned more from following PHP developers on Twitter than from any other sources.

17) In the next 5 years, how do you foresee the PHP ecosystem

5 years on the internet is like 50 years in offline life. I have no idea what it will be like.

18) Recently Microsoft has also started actively to concentrate on PHP, any comments on that?

It is in Microsoft’s best interests to do everything it can to make as many languages as possible run on their server platforms. This doesn’t impact me much since I do not use Microsoft operating systems to do development work or as a production platform, but it will make life for those who work in Microsoft-only environments easier.

19) If you had to go back in time, would you still choose PHP? What would you do different?

I wouldn’t have learned the things I know now if I hadn’t chosen PHP. Wouldn’t change anything.

20) Things that you’ve learned from being part of the PHP Community

I’ve learned that it’s very easy to pay things forward by helping others the way you’ve been helped.

21) How would you define ‘The PHP community’ to someone new to PHP

To me, the ‘PHP community‘ is the collection of people who use PHP to solve problems and are willing to both ask questions and share answers about the things they’ve done.

22) You are also the co-organizer the GTA PHP User Group;

i) Could you tell us a bit more about meetup.gtaphp.org and what are the good “parts to take home”

We choose to use Meetup as the home page for the group because they provide all the tools we needed to get people involved in the group and keep them interested. I couldn’t imagine creating all those tools myself and then gluing them together.

ii) Can you please tell us what it takes to create a php user group, the challenges, the responsibilities and maintaining the group, etc..

That first meeting was really the biggest hurdle. We had our first one with just 5 people in a coffee-shop. From that we went to a co-working place that was hoping to use us to drive customers their way…and they soon stopped returning our emails or bailing out at the last second on making the space available to us. We discovered another co-working space with a really accommodating owner and we’ve been having our meetings there ever since.

For me personally, the biggest hurdle was having the right set of tools to communicate with the group. I don’t mind speaking to the group so finding topics to talk about was easy. Once we had the tools, we settled on a regular schedule (first Tuesday of every month) and a regular location.

23) Do you believe it might be correct if I say that “The PHP Community is the most generous community when it comes to sharing of knowledge, helping each other and promoting it’s cause (i.e PHP) freely with passion”?

I don’t think the PHP community is any different from the Ruby or Python communities: full of passionate people ready to share knowledge, help each other and evangelise the language. I don’t see as much hate towards Ruby and Python in the PHP community as I see sent back the other way.

24) The best conference you attended would be..

For just building up my PHP skills, I haven’t been to a bad PHP-centric conference yet. For building my overall skills, attending CodeMash (@codemash) two years in a row has really helped me to see what other people are doing.

25) Can you please share the good, and may be not so good moments, of being part of all the conferences you attended

The good? Making lots of friends and learning new things.

The bad? The hit my ego takes whenever my talk proposals are rejected. I really put a lot of thought and effort into deciding what I want to talk about and always feel disappointed when I get rejected. Especially php|tek (@phptek). C’mon guys, you’ve shut me out for 6 YEARS IN A ROW!

26) What are the main aspects of conferences that can really help a PHP guy to get better in his progression

I go to conferences to hear really smart people talk about things they are passionate about. Boring presentations or deliveries will cause me to start fiddling with my laptop or phone. Engage me and you have an admirer for life.

I also go to conferences to match faces to the names (or Twitter accounts and IRC handles) that I talk to on a regular basis. The conferences are about people first and technology second. Come out of your shell and talk to people! Don’t be afraid to ask questions as you never know what awesome answers you are going to get.

27) You’ve been building web applications of all shapes and sizes since 1998. Could tell us a bit about the challenges that marked your spirit and how well PHP performed or has been useful in solving those challenges.

I cannot think of a single time where PHP was the factor that prevented a problem from being solved. The challenges are understanding the problems you are trying to solve and convincing the people who set the deadlines that you need more time than they will give you.

28) As a strong believer in the power of best practices:

i) how would you define the meaning of “best practice” to a beginner?

I define a best practice as something that other developers have discovered over time that allow you to solve problems efficiently with an eye towards future modification.

ii) Has there been any instance where you had to choose the “it works, let’s use it” VS “no, let’s make it work according to my best practice ideals”

Every day I have to make that choice. 99% of the time I choose “make it work according to my best practice ideals and are willing to take the criticism and abuse that always accompanies those types of decisions.

iii) Could you tell us what are some of the best practices you believe in and would strongly preach to anyone

Some of the best practices I promote:

  • if you’re not writing automated tests you are just hoping things aren’t broken
  • readable code counts more than clever code
  • loosely-coupled code is more maintainable than tightly-coupled code
  • never stop learning

iv) Would you recommend a beginner to focus on best practice right from the start, or when would you advice a beginner to “start learning” about best practices.

The Internet is full of terrible examples of PHP code, and that makes it tough for beginners to look at code and make the judgement of whether it is good or not. After 14 years it only takes a quick glance for me to make that determination.

If you’re starting out with PHP I would focus on the best practice of having loosely-coupled and readable code. You’ll learn all that other stuff through the mistakes you make along the way.

v) From the many companies that you have work for, “how easy is it and how difficult is it” to make a company adopt best practices? And how is the response of the dev team for this “way of coding”?

I have found it difficult to convince companies of the value of anything beyond “do whatever it takes to get it done” because it is often hard to see the benefits of things like automated testing before you actually implement it. It usually takes a spectacular failure or three for people to understand that there are better ways to do things.

Most of all, a lot of developers fear change. They don’t want to do anything different than they have already been doing and when they hear people like me talking about this sort of stuff they can feel intimated and overwhelmed. I was once there too but I was determined to figure out a better path to get me where I wanted to be.

29) You are also a big believer in the power of automation. Could you please share the mindset that, according to you, is important to get things right at the very beginning itself.

Computers are awesome at doing what you’ve asked them to over and over and over again. So why do so many people want to do things manually when it is easy to get the computer to do it for you? I think that if you start off a project with the idea that we are going to automate as much of the developer work-flow as we can, only good things can happen.

30) The day you realised “You’ve made it to the A-List PHP arena” ?

I don’t know about the A-list stuff. I’m clearly on the B-list. I felt like I got to a certain level of recognition when I started hearing from people who said “I was looking for info about X and Person Y told me you’d be perfect to talk to about it.

31) Why you are successful and why others are not?

People will think my comments to this question will make me look like a douche-bag, but that comes with the territory. I think I have become successful due to my willingness to share things I’ve learned and not being afraid to put myself out there. By always striving to be the best I can be, good things seem to happen.

32) What is the secret (or should I say the msytery) behind all those “Grumpy-ness” (since you like to amalgamate this word with most of your online names/pseudos)

The whole Grumpy Programmer thing is a way to create a “brand” for myself. I am quite grumpy when I am sitting in front of a computer writing code, as I see lots of stuff that could be done better. My own stuff included. I cannot be the only one who feels this way, so I decided that I needed to find some sort of brand or label to wrap around the things I was doing. Sure, it’s over the top at times and some people might not find it funny. I feel vindicated by my decision to create the Grumpy Programmer every time someone buys my book or asks me to help them with a problem they are having.

The Internet is an awesome place and I think being the Grumpy Programmer is right where I fit in.

Now Do Your Part!

1) Help diffuse this interview to the PHP ecosystem – Share, tweet and spread the word to your audience ==> That would be a FREE way to thank me 😉

2) Make a comment below using the comment form – I’m sure you can at least say 1 word about this interview

{I’m thankful to your response(s)!}


4 Comment(s)

  1. Thanks for this interview, I like Chris’ blog and this post as well. The big red centered questions are really annoying though!

  2. Helo, I don’t understand this code:

    $phpPost->_title(“PHP Interview”);

    Isn’t the underscore used for private functions? In that case it can only be $this->_title(‘XY’);

  3. @DevMonk:
    Thanks for the comment and for pointing out the annoying red color.. I will try to adjust it asap. Any color in mind?

    UPDATED(March 2012): I have updated the red color to the new Light Blue color 😉

    @Hello:
    hello Mr Hello! 🙂 Urm, don’t you think your comment is kinda off-topic to this post? 😀 But anyway, thanks for at least making a comment, I appreciate! 🙂
    Yep, “theoretically” your point is correct in a “coding environment”. But for the “Theme and purpose” of my blog, I have amalgamated {coding + presentation + convey information} to make it what it looks like… 😉

    Cheers!
    //Wasseem

  4. Hy guys,

    I discover this article by surfing to set up my own server Throw the LEMP stack and I discover much more today.

    Tanks for this great interview and usefull informations.

    davask.42



Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.