About This Interview
This is the #9th
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..
In this edition I talked with Stuart Herbert (@stuherbert), a highly highly and highly experienced software engineer. His interview is packed with insights and experienced thoughts. Herbert is one of those rare experienced geek who also teaches the principles of T’ai Chi Ch’uan. Stuart has been involved in almost everything out there in the Programming sphere; he’s a conference speaker, author of books, author for magazine articles, does pod-casts, volunteer developer for Gentoo Linux, contributor and lead to open-source PHP software like PHIX, has been a founder of the University of Sheffield’s Computer and Software Society growing it to over 1,800 members, and so much more as you will read below.
And Now The Interview…
1) Please tell us a bit about yourself
Oh gosh – I’m never very good at this bit – I always struggle with it when I reach this bit of a conference’s Call for Papers submission form 🙂
There’s a professional bio up at stuartherbert.com if you really want to read the full version. Don’t – it’s very dull, and best left for recruiters who get paid to do that sort of stuff 🙂 The short version is that I’ve been programming for nearly 30 years now (yes, I’m old enough to have programmed computers using punched card), and along the way I’ve done a whole heap of roles with names you might recognise (especially if you’re in the UK). I started contributing to open source projects many years before the term “open source” existed, and was involved with Gentoo Linux back in the day.
Right now, I’m looking after testing for DataSift, and probably most recognised in the PHP community for Phix, a tool that aims to set you free from the Framework Trap.
2) How you started with PHP
A little over 10 years ago, I inherited some day to day responsibility for the self-service portal for a major mobile phone network. It was a bespoke solution built by Netscape, running on top of J2EE and Netscape’s server-side products and several million pounds worth of Sun hardware. (The hardware came with an on-site dedicated Sun engineering team to look after it – very nice!) The primary user database was Netscape’s LDAP Server – the original NoSQL many years before it became a fad – and we also had Netscape’s Calendar Server in the stack too – the original server-side Javascript. I think we spent about 10 grand a piece on the UNIX workstations each developer needed, and I wouldn’t be surprised if we spent the same again in licenses for the developer tools needed too. With nearly half a million users, it was a big site for the UK at the time.
And it stank. You name it, it was painful – running it, debugging it, extending it. During the very worst times, it felt like you could set your watch by how regularly the J2EE server crashed.
The final straw for me came on a particularly hot August bank holiday weekend spent in our office. There was just me and a senior engineer from Sun. We were the only people on-site, which meant that there was no aircon that weekend, and the mercury crossed the 30C mark whilst we were there. Between us, we had the full source code for the entire software stack – ours and theirs – all the way down to the bare metal. We had no shortage of crash dumps and reproducible test cases.
But even with all that, we still couldn’t stop it crashing. The stack was too dense, the interactions between layers too intertwined, and the guts of Java at the time too fragile, for us to be able to get to the bottom of the problems. That was the catalyst for me to start researching alternatives.
I’d built websites in the mid-90’s using Perl + CGI, and already knew that the CGI approach didn’t scale well. Plus, all too often Perl gets used as a write-once language. J2EE was at the opposite end of the spectrum, and it didn’t scale well either thanks to over-complexity and a share-everything mentality. What I wanted was something that was simple, pragmatic, and reliable.
That’s PHP in a nutshell.
3) How do you find PHP now as compared to when you first started
Bigger. Faster. Better.
You could do a lot with PHP v3, but the steady increase of OO functionality over the years has certainly made it easier and easier to build larger applications in PHP. I’ve maintained 100,000+ line apps written in C, and 100,000+ line apps written in PHP, and when the codebase gets to that sort of size, OO starts to make life a little easier as the years go by.
The steady performance increases are most welcome too. There’s still a place for simple webapps that retrieve data from a database, pretty up the content, and push it out to the browser, but these days, web-based apps are much more about solving real business problems – and that means doing real work in PHP. Plus apps work at a different scale now to what they used to have to do. Buying and hosting server-class hardware in proper data-centres is bloody expensive unless you can do it at real scale, and being able to serve a lot more users in less rack space is a very welcome thing.
The community has changed beyond all recognition too in that time. I was a speaker at Marco’s first conference – the php|cruise of 2004 – and back then there were no PHP conferences in the UK, and if memory serves just two of us from the UK doing any conference speaking (Alan Knowles and myself). Today, there’s not one but two major PHP conferences right here in the UK, and dozens of UK-based conference speakers. It’s been fantastic to watch happen, and see new generations of developers discover PHP.
4) Based on your experience, what are the good and bad parts of PHP
If I had to pick just two, I’d say that PHP’s two major advantages over the competition are its execution model, and the PHP Manual.
Every time you run a PHP script, your script is starting from a clean slate. There’s no in-process state that you have to worry about. Your code is in complete control, and the only state that persists between each run of your script is whatever state you’ve decided to store. This goes a long way to making your code _deterministic_, which is a key property of making code reliable. It’s incredibly resilient too. I’ve seen webservers melt under heavy demand, and once the demand returned to normal levels, the website started serving pages again – no reboot required, no restarts of anything needed.
The PHP Manual is, for me, PHP’s killer feature over the mainstream alternatives, and the folks who have contributed to it over the years deserve a lot more recognition than they’ve had to date for what they’ve built and maintained. All you need is a web browser, and you’ve got full access not only to what remains the definitive reference to PHP, but also down at the bottom of many pages there are helpful explanations and examples left by readers. Compare that to the alternative web-development platforms, where before long you’re looking through Amazon or O’Reilly’s Safari looking for a book to fill in the blanks, and hoping you can find something that isn’t too out of date.
Bad parts? There’s nothing really that comes to mind.
5) What would be the Top advice to a PHP beginner
Don’t just learn PHP – also learn how to setup a webserver, and how to setup a website.
In all seriousness – the trend today is for developers to neither know nor care how anything works, and instead to look for tools, scripts – people even – to do everything for them. Don’t be like everyone else. Start small, by learning how to configure a webserver, and how to configure DNS so that your website is available on the Internet. Once you’ve done that, you’ll find that you’ve already started to build up a list of further things to learn about.
6) To someone who wants to become a better PHP developer, what is your advice?
Learn how to model – how to look at a piece of software, and break it down in your head into an architecture that could be coded from scratch. Become a software archaeologist – take apart code written by other people, to see how they’ve solved a problem. Figure out why.
Then figure out why you’d do it differently 🙂
7) The best PHP book you’ve read
There’s a story someone once told me about the great Muhammed Ali, that it was only towards the end of his career – long after the fights that he’s famous for – that he felt that he’d learned how to truly throw a punch.
That sums up why I don’t read many books written about PHP. You get the odd exception, such as Derick (@derickr) writing about DateTime handling, or Ilia writing about PHP security, but in general, I’m afraid that I think that most of the folks writing PHP books just haven’t been doing it long enough to have learned anything interesting to be worth sharing.
8) A PHP blog or resource you highly recommend
planet-php.net (@planet_php) for blogs, and Twitter for following (and engaging) with many folks in the PHP community.
9) The IDE that you use
I’m currently using Sublime Text 2 (@sublimehq), after many years of using Netbeans (@netbeans). ST2 is a programmer’s text editor, rather than a full-blown IDE, but its sheer speed (and not rendering fonts like we’re still in the 1990’s) make it a joy to use.
10) A PHP framwework you use and would recommend
I don’t use any of the existing PHP frameworks. They’re great for consulting gigs where you get to lob the code over the wall and run away before it explodes – which is also Agile’s main use case – but if you’re the customer on the other side of that wall, the long-term costs of using frameworks certainly give much pause for thought. I’ve been bitten by that personally – something that I’ve talked about at conferences in the past.
If I had to recommend a framework, then I’d recommend either Zend Framework (@zfChannel because it has the larger user base, making it easier to hire folks who have seen it before) or Symfony (@symfony because they innovate, and they’re not trying to copy Rails). But do you need an application framework? Content frameworks such as WordPress, Joomla and Drupal suit a lot of use cases better than the application frameworks do, and should be considered where appropriate.
And don’t forget the non-framework framework too – PHP itself 🙂
11) A unit test framework you recommend using?
PHPUnit. (@phpunit) Does everything you need.
12) Your LAMP stack comprises.. ?
Right now, at work, it looks like this: http://highscalability.com/blog/2011/11/29/datasift-architecture-realtime-datamining-at-120000-tweets-p.html …
13) One PHP person that you admire and what strikes you about him/her
I don’t do hero-worship. People are just people, and putting them on pedestals is imho very unhealthy for all concerned.
But what I do admire is how few of our community seek out a life as professional speakers and commentators. You go to a PHP conference, and the vast majority of the speakers are talking about things they have done, the lessons they have learned. They’re sharing their professional experiences. They’re not there to sell books or expensive consulting sessions. I think it’s very healthy, and long may it continue!
14) One function that you like (or which you tend to use frequently)
isset().
ProTip: If you’re using in_array(), have a think about restructuring your data so that you can use isset() instead. You might find it helps performance a little bit.
15) One PHP Community that you recommend
PHP North West. (@phpnw) They’ve come out of nowhere and raised the standard for PHP conferences this side of the pond.
16) The never ending debates on PHP would be.. ?
I don’t care 🙂
Seriously – they’re a colossal waste of energy, and become dogmatic or ego-driven – or both – and everyone involved just ends up looking like a tit. Get out there and solve real problems for people, and at the same time accept that it is perfectly fine for others to solve the same problems in different ways.
17) In the next 5 years, how do you foresee the PHP ecosystem
That’s difficult to say. On the one hand, PHP is a mature solution where much of the innovation has rightly moved into user-space (ie, into frameworks et al). The web that it serves up is relatively mature – HTML5 is hardly a radical departure from what has gone before, for example. Steady as she goes appears to be the order of the day.
But five years ago, I’m sure both RIM and Nokia felt the same way about their ecosystems. Ask them how that worked out for them 😉
I think the biggest change we might see could come from a completely unexpected direction. There’s a lot more uncertainty regarding energy supplies than in the last two decades, and if both households and data centres start to see energy shortages, our much-beloved scripting language might have to adapt to a reality of life on much slower, lower-powered servers.
18) Recently Microsoft has also started actively to concentrate on PHP, any comments on that?
They’ve been doing it for a long time now (I remember a Microsoft patch to IIS back in 2004 that stopped PHP crashing, for example), and I think it’s a good thing.
There are more and more people who have only ever known Windows, and who are completely lost if you show them an old-fashioned command prompt. Having PHP available to this wider audience – being more inclusive, if you like – is good for everyone.
I also think Microsoft’s involvement has helped increase PHP’s credibility amongst the wider developer community. I remember a time when you’d have to be circumspect when trying to sell a PHP-based app into enterprises, simply because you’d used PHP. There’s a lot less of that these days, thankfully, although amusingly the last time I experienced this personally was at the hands of an ex-Microsoft employee 🙂
19) How would you define ‘The PHP community’ to someone new to PHP
Why does it need defining? Giving it a definition limits what it can be.
20) The best conference you attended would be..
It would have to be the php|cruise. A week in the Bahamas, talking about PHP … how do you top that? 🙂
21) Can you please share the good, and may be not so good moments, of being part of all the conferences you attended
The good parts are the same, no matter which conference you go to … when someone says something that starts you thinking for yourself, that gives you something to go and explore, something to pursue. It might be when you’re listening to a talk, or having a conversation over lunch, or late at night when there’s only a few of you left propping up the bar, or even on Twitter afterwards. Those are the moments that conference-going is really about.
The not so good? The worst one for me was not being able to make ZendCon (@ZendCon) last year, because I couldn’t get medical insurance for the trip. I had to cancel just before I was due to travel, and that let a lot of people down.
22) What are the main aspects of conferences that can really help a PHP guy to get better in his progression
Go find people at the conference who have an interest – or experience – in something you’re interested in. Go talk to them. Ask them questions. Listen, and then ask more questions. If you don’t like what you’re hearing, ask more questions. This is what the socials are for. The speakers all understand this, and honestly, if you see us all together as a group at the socials it’s only because no-one’s coming up to us to talk to us.
Don’t go to a conference and be a passive participant. You can do that at home or in the office by reading blogs.
(As an aside, if you _ever_ go to a PHP conference and find that a speaker has no interest at all in talking to conference attendees after they’ve done their talk, please please _please_ do go and complain about this to the conference organisers!)
23) If you could change one thing with PHP, what would that be?
trigger_error() and that whole legacy way of error handling in PHP. I’d rip it all out (including out of extensions) and replace it with Exceptions. Done right, it would improve the quality of everyone’s PHP apps overnight.
24) Which was the worst programming mistake you did?
I once tried to rewrite a 10 year old C application (about 100,000 lines in size) in C++. This was back in the mid-90’s, when no two C++ compilers could agree on the language semantics nor on what the executable output should be. I had to abandon the work after 6 months because of all the compiler bugs, and there was nothing that I could salvage from the effort.
25) Do you recommend using database layers and ORMs like Doctrine? If yes, what database “framework” you use and would recommend?
No. I can understand the attraction of using an ORM to cut down on the amount of code that you have to write, but honestly, you’re much better off learning how to write SQL for yourself in the long run. It isn’t hard, and once you’re comfortable writing SQL, you’re probably much more productive than your colleagues still struggling with the ORM 🙂
SQL isn’t a portable dialect. Even if it executes, there are so many important differences between database servers from different origins (e.g. MySQL and Microsoft SQL Server) that you end up having to write server-specific SQL to get the best performance out of each of them. I haven’t yet seen an ORM that can do that, because they have no way of understanding what you’re trying to achieve.
26) What is your opinion on Traits and what’s on your mind for using them?
Really looking forward to them. They’re a very pragmatic alternative to multiple inheritance, which is a nightmare that we don’t want to visit upon ourselves. I’ve been using (@SaraMG) Sara Goleman’s Runkit extension for many years to achieve something similar, and whilst Sara did a great job with Runkit, this is a feature that works best when baked into the core product.
27) What is your opinion on PHP 5.4 and what important (new) features you think PHP programmers will need to focuss on or to take advantage on.
I think it’s a healthy way forward after the years of work that went into PHP 6. I don’t think that there’s anything huge in there, just lots of little improvements that together make for a nice step forward for PHP.
I think that the built-in webserver might just prove to be one of the more important features. I’m gobsmacked at how few people today can manage something as basic as setup a local website on their dev box. Being able to just run ‘php -S localhost:8000‘ to fire up a web server for testing purposes is going to help them out enormously.
28) You are a strong believer in good engineering, good management:-
i) How would would explain the concept of good engineering to someone new to PHP and what mindset should one have to adopt good engineering?
Architects dream of what could be, whilst scientists inquire of the truth of what might be. Engineers – we sit in the middle. We make dreams reality by learning how to harness the true nature of the resources available to us. We’re the ones who actually build real things for others to use, and we do it from a position of understanding – we don’t just know what, we know why too. We leave guesswork to amateurs, and we leave poor practices to bedroom programmers.
ii) Could you tell us what are some of the best practices you believe in and would strongly preach to anyone
It’s going to be much easier to answer that later in the year. I’m part of a group of PHP users who want to raise the standards of skills and professionalism in our communities. We’re calling it the Digital Engineering Educational Programme (#deep), and we’re working on creating a professional development framework that we hope can guide people like your readers throughout their careers.
iii) Could you tell us a bit more about the good management part
A good manager makes the difference between looking forward to going into the office on a morning, and spending all day waiting for when you can get out of the place – or counting down until you’ve served your notice period and you’re out for good.
The main problem I’ve seen with managers over the years is that very few people with ‘manager’ in their job title actually are managers. Most of them have a main role, with the management aspect simply tacked on the side of what they do. As a result, their workforce isn’t their main focus – it’s more the thing that stops them doing what they’re really employed to do.
Another real problem is that many people hired or promoted into management roles bring no obvious qualities to the job. If you put someone in a position of authority who cannot earn the respect of the engineers, you’re not going to get the best out of those engineers, and the organisation will never achieve what’s truly possible.
I have seen places which have struggled because of bad engineering, but I’ve seen many more places that struggled more because of bad – or downright terrible – management. And when you go and talk to these managers, yes, some of them are just blithering idiots who should never have been given the role in the first place, but most of them? Most of them are doing the best they can, having never done the jobs of the people who work for them, and having had no actual management training at all.
Everyone deserves good management. Life’s just to short to have to work for the blithering idiots, the power-crazed, or the just plain lunatics 🙂
29) As a Lead Engineer and/or a Technical Manager :-
i) Has there been any instance where you had to choose between “it works, let’s use it” VS “no, let’s make it work according to my best practice ideals”
Many times. Just as many “it works” shortcuts create ticking timebombs, so equally many “best practices” are just over-engineering that do nothing to prevent future costs. What matters is being pragmatic – is something fit for purpose, and is it fit to use? Anything that gets in the way of either of those measures costs you money, doesn’t save you money.
One of the things I’ve noticed that’s common to the better developers is that they have what I’d call “best habits” rather than best practices, and you can always tell who will become better developers in time because they’re always asking the same question: why did you do it that way?
ii) “how easy is it and how difficult is it” to make a company adopt best practices and good engineering principles? And how is the response of the dev team for this “way of coding and way of doing”?
Oh, it’s a bloody nightmare, and it always seems to come down to individuals with a legacy to protect – either a legacy code base that they’ve built up over time, or some position of seniority that they wish to protect by stifling change.
The problem with legacies is that they give your competitors opportunities to take away your market share, and internally they make your good people lose interest and find jobs elsewhere. You invariably end up with a small group of people who are the ‘in-crowd’ in a firm, and everyone else is seen as being outside that group. Those kind of silos tend to be incredibly unhealthy, and they’re also bad for business.
30) You’ve been working for so many companies and projects of all sizes and shapes. Could you tell us a bit about the challenges that marked your spirit.
Bad management has been my recurring challenge in my professional life. I’ve been lucky enough to work for some amazing managers, and that only makes the bad ones stand out even more. As I get older, I’m getting less and less tolerant of bad managers wasting everyone’s time. Don’t hire smart people and then ask them to do stupid things! I’ve reached that age where you stop going to weddings and start going to funerals, and you do start to feel how important the little time is that you’ve got left.
31) You have a lot of passions:- for good engineering, good management, Linux, web-based applications, photography, walking, and T’ai Chi Ch’uan. How do you time manage yourself, how do you plan all your activites and also taking time for your personal life?
Much of that _is_ my personal life 🙂 The walking I haven’t been able to do for a few years (I was in a car accident in the summer of 2009), but the rest … it’s mostly about what I feel in the mood for on any given day. Big plans don’t tend to work, whereas breaking things up into small chunks does.
32) The day you realised “You’ve made it to the A-List PHP arena” ?
*chuckles* oh dear. Lorenzo (Lorenzo Alberton @lorenzoalberton, a fellow PHP conference speaker and the Chief Technical Architect at DataSift) and I was arguing about this very point just last Thursday night, on our way to the #phpuk2012 pre-conference social. I have to thank Marc Gear (@marcgear) of Moo for inadvertently shooting down my argument and proving Lorenzo’s point in a very amusing way 🙂
I don’t consider myself an A-lister of any kind, and certainly not in the PHP arena. I’ve never been a contributor to PHP itself. When you run PHP, there isn’t a single line of code in there that I’ve written. I don’t participate on any of the PHP mailing lists. I don’t sit on any advisory boards for any PHP companies or large community projects. I don’t run any PHP user groups. There are many many folks who have talked at more PHP conferences than I have.
33) Why you are successful and why others are not?
I grew up with the advent of home computers. My first programming language was machine code – not assembly, but programming directly in hexadecimal bytes. That sort of thing teaches you a lot about how computers actually work, and it gives you a great foundation to learn from. As you move from place to place during your career, it’s very very helpful knowing the details of how a lot things work, and especially being able to work comfortably at different levels of the stack simultaneously.
It also teaches you how important it is to know _why_ things work. Things become so much easier when you’re taking advantage of what they’re meant to do rather than trying to force them to work in a way that isn’t natural for them. It’s the same principle that T’ai Chi Ch’uan is built on, which is why I enjoy teaching that so much.
Another reason is that I abhor the expert. An expert is someone who places most value on what he or she already knows. They stop learning, they stop listening, and they start to believe their own PR. They also have a nasty habit of becoming insecure and defensive as the world moves on and starts to leave them behind. We in the West love our experts, but my advice to your readers is to always be the beginner. Place the most value on what there is to learn. Look to learn all the time, from everyone that you meet. Keep trying to see things from different points of view, and from multiple points of view at the same time.
Finally, I’d say that there’s no substitute for having done something yourself, from having tried it and lived with the consequences. Put it to the test yourself. Explore it. Make it do real things – avoid trivial examples. Find its limits, and its sweet spots. Don’t regurgitate what you’ve heard from others, even people with good reputations in the community. Don’t rely on what you think you know. Rely on what you actually know. And be prepared to make the time to keep building up that knowledge.
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)!}