Friday 14 May 2010

Standing on the shoulders of giants - why I love PHP development

Anyone who knows me might have heard me talk about the benefits of open source software, but it is something that, if you're not technical, often goes over people's heads. I wanted to use a specific example to demonstrate why the open source principle is so good.

I'm doing some work at the moment for Nuvola's long standing client, AzteQ Solutions Ltd, to expand on the inventory management extensions we've already built to their job and management system. Specifically, they need to print physical pick and packing notes for their warehouse operatives, one of which they will carry around the warehouse while they pick the job, and the other which will be attached to the package when it gets shipped. They wanted automation in this - pick jobs should just appear on the printer, rather than the warehouse staff having to go to a computer and print them. The pick and packing notes should also be saved as PDFs.

Having a remotely hosted web application do this presented a bit of a problem, until I came across internet printing protocol (IPP), which basically uses the same technology that my browser will use to publish this article to send a job to a printer over the internet.

Being a good PHP developer (that's the programming language we use), I immediately Googled 'PHP IPP' and quickly found that someone had already built a nice library of code which would handle all of the printer connection and job for me. There's also a similar library which I've used before to create PDFs from web pages.

So here's the beauty of open source. Rather than spending days having to get to grips with creating PDF documents automatically, and then more days working out how to send stuff to a printer over the internet, I was able to write about 4 lines of very simple code (open connection, set file to print, send print job) to do each function. Someone else had done all the hard work!

Easy life for a lazy programmer then, I hear you say! Well, possibly, but the way in which open source works tends to go something like this: Somebody has a need to do something a bit out of the ordinary on a particular project. They write some code to do it and that code works well. Then, when they have time, they sanitise the code a bit so it can be used by anyone, and publish it so that everyone can benefit. Why do they do this? Because they've had the benefit of re-using other people's work themselves in the past, and want to give something back. Everyone (including clients and end users) benefits in terms of shorter development times, simplified testing and reduced costs. As I said, standing on the shoulders of giants.

So, when do I plan to give something back? Well, Nuvola's framework does contain quite a lot of nice, reusable libraries and bits of code. Some of it is rather woven into the fabric of the framework itself and so difficult to package in a way that someone could just take it and plug it into their own project, but other parts are much more 'detachable' and certainly candidates for being shared. Watch this space - I'll be publishing some of those libraries in the coming months.