One of my aims with starting my own company was to network with other local developers to work on interesting projects. Recently I got the opportunity to do just that with Shane at Enrapture. He’s been working on a team scheduling web application for a local company that’s growing, both on island and beyond. Shane was suffering from a problem that I and many other developers have experienced in the past: you become so entangled in a project that breaking out of a train of thought becomes a challenge in itself.
When this situation arises the best thing to do is to enlist the help of someone with no, or little, connection to the project. A fresh pair of eyes can often question your core assumptions and help you realise that concepts you thought were set in stone might not be so rigid after all.
The first challenge that I was enlisted to help with was a piece of performance optimisation. One of the screens in the application shows a week view of all the teams and what appointments they had for each day. Before I set to work on this screen we ran it through Blackfire.io, a PHP application profiling web service (more about this in another article). The output from Blackfire revealed that the page was taking about 5-6 seconds to load, on average, and that most of this time was taken up with over 500 queries to the database. The number of database queries became my immediate target of optimisation. Before getting into the code, I set myself the target of getting the screen load time under 2 seconds. I viewed this is as an achievable target in the day I had to work on it and would be and acceptable load time for the client.
One of the core assumptions that had become engrained in the application as Shane was developing, was that the schedule for each day, for each team, had to be calculated individually. Talking through this with him, it was easy to see how this had come about. The week view was an extension that had been added to the month view for a single team, which itself was an extension of another view. This extension, of an extension, of an original piece of functionality is one of the easiest ways core assumptions come about. It’s easier to build on something that already exists rather than thinking about it as a new piece of functionality – especially when deadlines and budgets are tight!
With a fresh perspective and no core assumptions, I was able to work alongside Shane to reduce the number of database queries from 510 down to 1. Not only that but the page load time was only 0.3 seconds. Not bad for a days work.
Many people will be nervous about enlisting the help of an external developer to help in such situations. If an IT manager calls in help to help out his team, the existing team may view it as a challenge to their abilities. Or the existing developers may be hesitant to suggest it to their managers, believing the manager might take it as a sign of weakness. However, in both these situations I would say that all parties should view as a sign of strength and commitment to the overall outcome of the project. After all, many projects fail as a result of not being able to get past core assumptions that get embedded in development teams.