By Stuart Herbert

Welcome to my blog.

I write about software development, especially in PHP, T'ai Chi Ch'uan / Taijiquan, and my photography.

You can learn more about me by reading my bio.

You can reach me at

Latest Photos

Bridge Over The Falls
Avebury by Moonlight
Avebury by Moonlight
The North Face Of Corn Ddu
Corn Ddu and Llyn Cwm Llwch
Corn Ddu
Easter Cross
The North Route Up Pen-y-Fan
Remove Tape Before Firing

Why We Test: My Talk @PHPOxford

Posted in Stuart on PHP on November 3rd, 2015.

Last week, it was my pleasure to present a new talk to the PHP Oxford user group, called “Why We Test”. A huge thanks to Oliver for inviting, and to everyone who came along.

Another Fantastic PHPNW Conference!

Posted in Stuart on PHP on October 8th, 2015.

I’m back from this year’s PHP North West Conference, and finally have a few moments to talk about what was (yet again!) another excellent year.

I was there to present two talks – Introducing a Quality Model For MVC Applications, and Ways To Measure Your ORM’s Cost. It’s the first time since the php|cruise back in 2004 that I’ve presented twice at the same conference, and brings me up to something like 15 unique talks and workshops presented over the last 11 years.

Are you a good scout? – PHPNW15 Track 3 from phpboyscout

I want to highlight one talk in particular from this year’s conference – Matt Cockayne talking about being a good code scout. This talk got promoted from the Unconference track to a spare slot on the Sunday morning. I’ve been thinking about pitching a keynote about how we all need to be great ambassadors for PHP, and I think Matt’s message would make a great keynote for our community.

Whether I’m speaking or just attending, I always enjoy the PHP North West Conference. Their conference team always do everything that they can to make each conference the best that it can be. In my opinion, the explosion of quality, community-based PHP conferences in Europe owes much to the example set particularly by PHP North West. We’ve come a long way from when I started speaking back in 2004 :)

I’m really grateful that conference committees here in the UK – both PHP North West and PHP UK – continue to give me opportunities to come and talk at their conferences. Whether it’s about the problems of framework lock-in, component-based architectures, Git workflows, or indeed about driving quality, I’m often talking about things years before the PHP community moves that way. My work is often about solving problems most people don’t yet realise that they have, and that can’t be an easy sell, both within the committees that select talks for conferences nor to attendees when they’re buying their tickets.

This year’s conference may be over, but there’s no rest to be had.

  • I’m already preparing another talk to deliver to the PHP Oxford user group later this month, called “Why Do We Test?” – expect plenty of ethical dilemmas in this one
  • November sees me once again volunteering at Aberystwyth University, coaching 2nd year Comp Sci (and related) students on job hunting
  • I’ll be speaking at PHP Surrey at the start of January 2016, possibly on writing a test suite for PHPFastCGI – you should come just to watch Andrew give his PHPFastCGI talk, it’s cry-out-loud funny

… and I’ve promised both Glasgow PHP and The Edinburgh PHP User Group that I’ll come up and present to them before the end of 2016.

Talk: Ways To Measure Your ORM’s Cost

Posted in Stuart on PHP on October 8th, 2015.

Here is the original blurb for this talk …

Your project has adopted an ORM such as Doctrine because it’s the quickest way to hook your code up to your database. Things are looking up, and your website is about to take off. Aaaand then the first complaints start to come in that your site isn’t coping with the new customers. You can’t find a problem in your own code. Could it be the ORM that’s the problem? How can you tell?

In this talk, Stuart will show you how you can use off-the-shelf open-source tools to work out what your ORM is doing, and whether or not it is the cause of your performance problems. He’ll show you how to measure the database itself and the ORM code, as well as providing useful strategies to reduce the cost of your ORM without having to abandon the ORM altogether. Finally, he’ll show you how you can extend these techniques to other parts of your application, so that you’re never in the dark again.

Here’s the original blurb for this talk …

Your integration, functional and non-functional testing gives you a good idea if your code will work on Production. But how do you go about measuring the quality of code that already seems to work? How do you make that measurement repeatable? How do you share it with clients in government, finance or other large enterprises who are looking for a 3-5 year shelf-life from your code?

In this talk, Stuart will introduce you to SQuaRE, the international standard collection for software quality. He’ll give you a tour of all of the available and upcoming standards in this area, before taking a deep dive into the Product Quality Model from ISO/IEC 25010:2011. He’ll explain what a quality measurement is, how you link them to your project’s quality criteria, and how you incorporate them into code reviews, QA teams and management decisions.

You’ll leave this talk ready to start measuring and improving the quality of your product or service, with the tools you need to not only maintain quality but also to keep increasing it over time, even when faced with staff turnover.

In Defence Of The DSLR

Posted in Stuart's Photography on August 15th, 2015.

This afternoon, I’ve seen several folks on Twitter sharing a well-meaning story called Please Don’t Buy A DSLR. Each time, the tweet echoed the same sentiments: DSLRs are too difficult to use, and they’re too large and bulky.

And that got me thinking.

You see, the SLR as a platform is one that I’ve grown up with. I’ve been shooting with SLRs for the best part of 20 years now. The SLR isn’t just my camera of choice, it’s the one that I know best. Hopefully some of that comes through in the photos I’ve posted here over the years.

But it also means that I don’t see the SLR in the same way that you do, if you’ve been using your camera phone or point-and-shoot compact to date. I’ve never seen the SLR that way, because it was my first kind of camera.

I’m not sure if I’ve ever given much thought to whether a DSLR is too bulky, or too difficult to use. Well, there was that one time I was shooting with a monster Sigma 400mm lens …

Are DSLRs Too Large And Bulky?

Well, the fact that I need a dedicated camera bag alone makes it hard to argue against the idea that it’s bulky. The camera and lens straddle the entire width of the backpack. There’s nowhere for a dedicated macro lens to fit. And the 400mm zoom lens that I have my eye on? I’ll need to find a bigger backpack before I can buy that. My camera bag is already much bigger than my hiking rucksack.

This thing is heavy too. I hurt my right arm earlier this year moving an old amp that I was getting ready to sell on. Until a couple of weeks ago, I couldn’t handle my DSLR camera body and lens because of the weight. I’m not sure how long it will be until I can try an all-day shoot again.

So yes, DSLRs are undeniably large and bulky. But are they too large and bulky? I think that depends on whether you see yourself as a photographer, or whether you prefer to take photos.

When I go out with the camera, I’m going out specifically to do photography. The camera isn’t tagging along on some other adventure. The camera is the reason why I’m going out in the first place.

The majority of my camera bag is taken up by my lens collection. With the DSLR, I can switch lenses to suit my subject and my distance from the subject. I get real zoom, not a fake digital one where you’re losing detail or image quality. I get precise control over what’s in focus in the shot, and what’s out of focus – a key part of the artistic side of photography.

A perfect example of what I mean is this shot taken last year in the Brecon Beacons.

Llyn Cwm Llwch

In this photo, I’ve been able to make Mike the subject of this photo by making him the only part of the shot that’s in focus. At the same time, the photo works because you can still see what he’s doing – trying to capture Llyn Cwm Llwch on his camera phone. That was possible because I could use the zoom the frame the photo.

The rest of the bulk is the camera body itself. Combined with my lenses, I can shoot handheld in moonlight …

Avebury by Moonlight

… or handheld in a conference hall (it’s so dark the laptop screen is the main source of light!)


… or I can take shots like this.

Pratt and Whitney Double Wasp

When it comes to challenging conditions like these, you can’t overcome physics. You need to gather enough light to have an image to capture. You need large lenses to gather that light, and you need a large sensor to capture that light without capturing too much visual noise at the same time.

Try and replicate these shots yourself on your camera phone to see for yourself.

Are DSLRs Too Difficult To Use?

To deliberately take a great shot with a DSLR, you need both technical mastery of your camera and artistic mastery of the medium. Of the top of my head, this includes:

  • ISO speed – sensitivity setting of your sensor
  • aperture size – controlling the amount and angle of light hitting the sensor
  • shutter speed – controlling the length of the exposure when you take your picture
  • focal length – to frame your shot
  • focal length combined with distance to subject – to control visual distortion
  • focal length combined with distance to subject and aperture size – to control depth of field
  • focal length combined with ISO speed and shutter speed – to control camera shake
  • height of the sun – to influence the colours in the photo
  • angle of the sun – to control the blue of the sky
  • angle of sunlight reflecting off the subject – to control highlights and shadows
  • the histogram in the camera – to check for good contrast and exposure without over-exposing the shot
  • image composition – who or what is the focus of the photo?
  • image background – what else is visible in-frame?
  • timing – what is moving? where is it moving to? where do you want it to be when you click that shutter release button?
  • breathing – keeping the camera still so that the shot isn’t blurry

… and so on. Boy, does that seem like a lot of things to be juggling at once when taking a photo. No wonder photography seems hard!

I’m going to let you in on a secret. The whole time I’ve been taking photos, I’ve only once managed to capture exactly the photo that I wanted to. Once. Here it is.

Merthyr Road In Mist

That’s a shot from the end of the road I live on, taken during one of the rare winters where we actually had enough snow to be worthy of the name. Previous weekend, we’d driven along the road on the way to do Christmas shopping, and I’d pictured that exact scene as we carefully made our way out. It’s the one and only time that the final image is 100% what I wanted to capture.

If you’re interested, that’s a success rate of less than 1 in 10,000. It might be closer to 1 in 50,000.

It doesn’t mean that the other 99.99% of my photos aren’t good. With well over 1,000,000 views on Flickr to date, I must be doing something that you like. But yeah, taking photos is hard. Here’s some examples to show why.

Passing By

That shot was taken (handheld again!) one evening in London. There was the technical challenge of shooting at night, where one stable primary light source (the sun) is replaced by lots of competing and sometimes chaotic primary light sources (street lights, shop displays, passing vehicle headlights). The subject is a silhouette of a passerby, reflected in the window of the Museum of London. I had to frame the shot, work out the required exposure, find an angle to manage reflections, all before the passerby had walked by.

Lighting The Way Home

That shot was taken on a walk through the woods at Beyond the Border one year. The main technical challenge was getting precisely focused on the light whilst throwing the leaves behind out of focus. Then there’s the need to find an angle to show the electric cable. It’s black, and could easily disappear because I’m reducing the amount of light that hits the sensor in order to show up the filament of the bulb.

Outside The Core

Some flowers planted in a display at the Eden Project. Should be very simple, right? But what about the shadow being cast by that low sun? The shadow means that the part of the flower that’s nearest the lens is much darker than the leaf on the other side of the plant – and that’s reflecting the sun quite brightly. What’s the best angle to capture the flowers and their stems? Did you notice the building’s wall in the background? Did you notice the lines running along the wall? They’re as much a part of the photo as the flowers are.

Breitling Wing Walker

My last example – a wing walker putting on a show at the Bristol Balloon Festival one year. Any time there’s sky in the photo, I’m thinking about where the sun is. The camera sees a different shade of blue depending on the angle between the sun and the lens. I need to hold the camera steady enough whilst tracking a moving object. Empty blue skies make for boring photos. I need to wait until there’s clouds in shot to make the background more interesting. I need to wait until the moment the wing walker is doing something that will look interesting in a still photo.

In each and every photo that’s worth publishing, from the simplicity of some flowers in a display to the complexity of one of the world’s leading cities at night, there’s always a lot that the photographer has to do to get the shot. Some of it is technical, and some of it is artistic.

If you replace a DSLR with a different kind of camera, does anything become easier? Well, in a word, no. At no time in any of those photos was the DSLR adding any complexity to the shot. If anything, the DSLR often made these shots easier. I’m not sure that any of them could have been duplicated on a camera phone, or on a compact camera that didn’t offer full control over shutter and aperture speed. And several of those shots benefitted from being able to use lenses that you can’t get on camera phones or compact cameras.

The complexity is inherent to photography as an art medium, and is down to physics (light) and composition (artistic taste). All that the DSLR does is expose you to that complexity. Nothing more.

Other Points In Favour Of DSLRs

The DSLR platform brings some important advantages over other types of camera.

I’ve already mentioned physics – the gathering of light, and the capture of light whilst controlling noise. Indoors, late at night, or more northernly or southernly you go, this becomes more and more important. It’s nearly always very dark indoors, and by definition it’s dark outside late at night. No surprises there. But, if you live in Canada or the States, you might not realise that it’s much brighter outdoors there than it is here in Europe. We’re much further north than you are. That makes it much harder to take good photos with smaller kit.

Phase detection auto-focus systems are, for me, the next advantage of the DSLR platform. This is an old technology, but it works almost flawlessly. And it’s fast. By contrast, contrast-based auto-focus systems are slow, inaccurate, and struggle to track subjects well or work in low-light. I’m sure that one day there’ll be enough computing power in cameras to overcome these problems, but right now they’re very hit-and-miss systems.

I must not forget manual focus. The ability to switch the motor off, and dial in the focus entirely by hand is an important artistic tool when combined with manual aperture control. Works best if you’re lugging around a tripod (more bulk!).

Inter-changeable lenses are important. Other platforms (notably micro four-thirds) also have inter-changeable lenses, but only the two leading DSLR platforms (Nikon and Canon) have an extensive range of lenses both from the manufacturer and from third parties such as Sigma. And the quality of those lenses … oh my.

I haven’t mentioned flash photography, as it isn’t something I do. But it’s another area where the DSLR platform offers a major advantage over other camera types.

DSLRs are very versatile tools. You can mix and match bodies and lenses to optimise for the kind of photography that you enjoy the most.

This is all good stuff, but it isn’t what prompted me to post in defence of the humble DSLR.

Final Thoughts

I work in tech, and it pays for my photography hobby. Over the last few years, there’s been a steady rise of a culture that I wasn’t aware of before. Somehow, it’s become acceptable not to know what you’re doing or how anything works. Sometimes it’s presented slightly differently – that’s there’s far too much for anyone to know – but the sentiment is the same. We’re moving from the days of the meta-ignorant to an active cult of the ignorant.

As many of the people I follow on Twitter work in tech, it is this culture spilling over into photography that I saw this afternoon. And honestly, I’m deeply deeply uncomfortable with the notion. It isn’t a culture that I grok.

Because I don’t understand it, I don’t want to call “bullshit” on it, and I don’t want to call people out who promote this culture. I don’t walk in their shoes, and I don’t see things through their eyes. I don’t know what the barriers are that are stopping you from learning the things that I have been able to learn.

The best I can do is offer to teach what I know. So, if there’s enough interest, I’ll make the time to put together an easy step-by-step course to the humble DSLR and basic digital photography. It’ll be a group course, run online, and there will be plenty of homework involved.

Just let me know if this is something you want.

Catching Up On Recent Talks

Posted in Stuart on PHP on August 12th, 2015.

I’ve given several talks to user groups over the last few months, around the topics of testing and performance. I hope that you find them interesting and useful.

When To Mock

Mocking has not only become a mainstream practice in recent years, it has also become the default practice for many developers. In this talk, I present three questions that you should ask yourself first whenever you’re deciding if a mock is the right way to test your code, and some insight into how over-mocking ends up making your tests no better than having no tests at all.

This talk was presented to PHP Dorset in November, 2014.

How Much Does Your ORM Cost?

Whenever you use an ORM, you’re trying to reduce the time it takes to ship your code. But what are you trading in return? This lightning talk introduces the idea that ORMs aren’t entirely “free”, and hopes to start you thinking about how you might go about measuring just how much that ORM is really costing you.

This talk was presented to PHP South West (where I was once the answer to a pub quiz question – my claim to fame!) in April 2015.

The Mad Science of Testing

I’m a firm believer that good testing is also good science, and in this talk, I hope to convince you too. And if we’re going to be scientists, we might as well be mad scientists, because they have all the fun :)

This talk was presented to PHP Berkshire in June 2015.

Goodbye, Phix

Posted in Stuart on PHP on March 2nd, 2015.

Back in 2009, I spoke at the PHP UK Conference about the pain of living with PHP’s fledgling frameworks, and I returned in 2011 to promote component-driven applications:

Back then, PEAR was the only tool available for distributing components. It was built in a time when hosting and sharing code was hard, and although PEAR made it possible to create components in PHP, PEAR never made it easy to do so.

Phix was an open-source tool that I wrote to sit on top of PEAR and make things easier. It gave you an easy-to-use build.xml file for Phing to automate all of the common tasks, a standardised file layout so that you could just drop in your code, and integration with Pirum so that you could build and publish.

Today, we don’t need any of these tools. PEAR has been replaced by Composer, and it’s so easy to use that there’s no need for Phing or a build.xml file. The PHP FIG standards have given us our file layouts, and as for publishing … today, all you need to do is push to GitHub and publishing happens automatically.

We no longer need Phix, and that’s a good thing.

Bridge Over The Falls

It’s been an incredibly busy summer for me, but I did manage to get a little bit of photography in during September. I finally managed to dig through the photos last night, and this one immediately jumped out at me. I hope you like it as much as I do :)

Be Careful Where You Walk

As a belated birthday celebration at the end of January, Mrs H and I spent a day at the Royal Navy Fleet Air Museum at Yeovilton. We’d had a lot of fun with our cameras at Scotland’s National Museum of Flight, and ever since we’ve been looking to get to more air museums.

My first shot this week is the first shot I took in the museum – a close-up of the wing of a Supermarine Walrus. I just love the texture of this wing, and the unusual footprint painted on really caught my eye as we descended the ramp down to the floor of Hall 1. I’m assuming that the footprint is there to show maintenance crews where it is safe to step without putting their foot through the wing.

Copyright (c) Stuart Herbert. Blog | Twitter | Facebook
Photography: Merthyr Road | Daily Desktop Wallpaper | 25×9 | Twitter.

Llyn Cwm Llwch

Last weekend was our warm-up day for the 3 Peaks Challenge. We walked up to the summit of Pen-y-fan and back twice in just over 5 hours. I was expecting my knee to be a major doubt for the walk, but it turned out that I’m so unfit that the knee was the least of my worries :(

I did take the camera with me for the first ascent, and snagged this shot on our first trip down. I hope you enjoy it.

On a technical note, despite good conditions, this ended up being the only shot I took that was worth publishing here. Shooting exclusively at f/2.8 on a full-frame camera body isn’t a good decision for landscape shots, especially if there’s no foreground subject to focus on. Lesson (hopefully) learned.

I’ll be back on Monday with the first of my shots from the Fleet Air Arm Museum at Yeovilton, from a shoot I did for my birthday this year. If you enjoyed my photos from Scotland’s Museum of Flight, then hopefully you’ll enjoy these too :)