Wednesday, March 27, 2013

Premature Quality Optimisation Is the Root of All Evil

Robert Heaton recently wrote an article "Take pride or f---- it" in which he encouraged people to write quality code. However, quality is one of the most misunderstood aspects of the software development process, and developers often get it wrong.

 Donald Knuth famously said, talking about the time and space efficiency of individual fragments of code, that "premature optimization is the root of all evil". For performance critical paths through a code base, if bad performance compromises the business requirements, good performance is an important marker of quality, but in other cases, writing super-optimised code can make things worse on quality criterion that actually matter. Most programmers now get that this specific instance of inappropriate application of a quality criterion is foolish, but still fail to grasp the general principle that other quality criteria are context dependent as well.

What do we really mean when we talk about quality?

Quality is the set of attributes / features that an output has that determine how well it meets the 'business'1 requirements. Quality can be considered not just on the final output (e.g. the final binary that you ship) but on intermediate outputs as well (for example, a source code file, or even the software development process documentation).

Quality criteria are therefore proxies for ensuring that a project is optimal for the business. Setting and achieving appropriate quality criteria helps to ensure that the maximal amount of benefit is captured, and that costs, risks, scope and time are controlled.

Using best practices appropriately can help you to set appropriate quality criteria, because they can provide an expert source of knowledge on what works for achieving certain outcomes, and what doesn't.

So where do many developers get it wrong? They apply best practices like fashion - they take whatever seems to be popular, and stick to them religiously, decrying anything which doesn't conform as wrong and bad.

Image by Randall Munroe, image license CC-BY-NC.

The first problem with this is that quality is not universal - what is quality for one project is an unnecessary cost for another. A set of best practice guidelines designed to promote reusability might boost quality for a big project with a long life-cycle, but be crazy over-engineering for a script that will only be run once. Following best practice guidelines that aim to achieve something that won't ever affect your business is not quality - it is doing it wrong.

The other problem is that 'best practices' are sometimes just popular practices or fads, and they might not actually help you to meet your business requirements.

So what is the solution? Appropriate planning (even if the plan lives in your head). Sit down and think about what your 'business' requirements are - what is the big picture you are trying to achieve? Now think about what quality criteria actually matter.

When you do this, think about how to optimise the benefits this project will bring, control the risks, reduce the cost, give a better timeline, and so on. Try to think long term if this is relevant to your business requirements.

Your quality criteria are themselves an output, so think about the quality of your quality criteria. Good criteria for assessing your quality criteria are:
  1.  Is there a justification for this quality criterion in terms of my business requirements?
  2. Is there sound evidence, or at least good quality predictions on solid theory, that it will achieve what I want it to?
  3. Is this quality criterion achievable for my project?
  4. Do the benefits / opportunities of meeting this quality criterion outweigh the costs / threats, when assessed against the business requirements?
  5. Is it specific enough to determine when it has been met?
Once you have your quality criteria, remember that they are not set in stone; you want your project and its quality plan to have continuing business justification, so you should keep them up to date, removing quality criteria which no longer make sense and adding new ones as needed.


[1] 'Business' is in quotes because it doesn't just mean making money, it means achieving whatever it was that you set out to do (for example, for a not-for-profit, business might mean raising awareness of an issue; for a hobby Open Source developer, it might mean providing a Free alternative to a proprietary system or raising name recognition).

Thursday, March 14, 2013

Lanthaps Productivity Timer Set Free

 Lanthaps ProdTimer is our flagship product - for those of you that haven't encountered it already, it runs on your Windows or Linux desktop, and reminds you when to take breaks and when to get back to work, with a coloured task bar icon and configurable sounds to remind you of status changes, and the option for occasional longer breaks.

We recently decided that ProdTimer should be released as Free / Open Source software. Lanthaps is re-orienting itself as a consulting company, and ProdTimer is more useful to our customers as free software as than it is to us as proprietary software.

Today, I ripped the DRM out of ProdTimer, pushed the source code to github as OpenProdTimer, and built fresh binaries (which are now hosted on our Portfolio page). If you have been waiting to try ProdTimer, but were deterred by the price or the closed source nature of it, try it now - you might find that increases your productivity.

I'm hoping that the community will pick up ProdTimer and improve it further in the future - and I will be reviewing and accepting pull requests that add useful features.

Wednesday, August 8, 2012

Should we disrupt the PBX market?

The business telecommunications market is cornered by big companies that charge big price tags, and as a result, small businesses are locked out of innovative phone systems with features like voice prompts, music on hold, and information features that could save time and help their business to grow.

The widespread availability of broadband Internet at small businesses presents an opportunity to change that.

Imagine if you went to the store and bought an inexpensive device the size of a smartphone that you plug into a computer at your office. Imagine if you could set up your staff directory and the prompts you want on the computer without needing to hire an expensive phone technician, and instantly you had a smart wireless PBX. Imagine if your employees could use it from their Android smartphones wirelessly to make and receive calls anywhere within 20 m (65 ft) of the device, and you could use PBX features to transfer calls, put people on hold, keep voicemail, and provide information like opening hours without bothering your staff. Imagine if you could have multiple calls on the lines at the same time, but you don't even need a traditional phone line at all - only a broadband internet connection.

We know how to bring all this into reality, but before we do it, we need to hear from you, small business owners and our potential valued customers, whether you would buy something like this, what features you would need, what features would be a bonus. We don't need a firm commitment - we are asking for your help to build a product that helps you to meet your needs and grow your business, not to sell anything just yet. If we do build the product, in addition to the benefit to your business of making sure that whatever we come up with has been built with your needs in mind, we will also be offering any business that responds a sizable discount on your first product purchase, and a free ProdTimer license (e-mail your response to andrew.miller@lanthaps.com, and e-mail us at sales@lanthaps.com to claim your free license or discount).

Wednesday, April 4, 2012

How I won the victory over myself and learned to love The Timer

Last year I completed my PhD. One of the most important battles anyone who wants to finish a PhD (or any other significant self-motivated project) must fight is the battle against procrastination. After about a year into my PhD project, interesting side projects and the addiction of learning new but not directly relevant things from the vast wealth of knowledge available on the Internet started to take up a greater and greater proportion of my time. Ironically, however, it was one particular side project that not only put me back on track, but also became the flagship product of the startup I founded after finishing my PhD. This blog post tells my story, and the story of Lanthaps ProdTimer. If you are impatient, and don't want to read the whole story, you can trial the software I produced here.

The secret to finishing independent projects is blindly simple: while the project is not complete, iterate between working out what needs to be done, and doing it. However, this is deceptively difficult to execute over long projects - interesting things that are outside of the scope of the project keep popping up. In addition, a deeply ingrained part of the hacker ethos means that it is often tempting to spend a long time learning about and working on better tools rather than making do with the tools that are already available - sometimes, this pays off, but other cases, it should have been obvious from the start that the effort invested  into making better tools would be greater than the time saved.

I quickly discovered that the force of distractions is too great to try to cut altogether - when I tried that, I kept rationalising my distractions until they were taking over again.

With eradicating distractions out of the question, my next approach was to try to control them. This approach brought me to the winning formula:
rather than let the distractions take over, instead divide up your day into productive work time and distraction time
This winning formula worked because it gave me a controlled amount of work and distraction time,  and when I was working, I knew that I could focus on my work, knowing that there would be a chance for distractions coming up.

I tried using a simple kitchen timer to execute the formula, but that doesn't really work, because it is too easy to put off re-activating the timer, and continually adjusting the timer is a hassle in itself.

Instead I created a program to manage the timing for me. I found that I tri-phase model worked best: work (25 minutes for me), short break (5 minutes for me), and long break (15 minutes for me, every 2 hours instead of a short break). The Work phase is when I do my productive work that is directly directed towards my goals. The break phases are for doing whatever I like, guilt free. Sometimes, during a break phase, I learn something new but not directly related to my work on Wikipedia. Sometimes I read Hacker News. Sometimes I go and get a snack. Longer breaks are longer but less frequent - they give enough time to learn about something in more depth, work on a side project, or go and get lunch. The phase is shown with a differently coloured icon on the task bar - with a count-down to the next phase shift optionally visible in a window.

My software was so spectacularly successful that when I finished my PhD, in no small part thanks to it, I decided it would be selfish to keep it to myself, so instead I formed a startup to polish and sell the software.

The software needed a lot of work to make it ready to sell - a minimum viable product needed to allow people to change the times of the phases without being recompiled - and to remember those settings. It needed more than just coloured icons - optional sounds on phase shifts were essential, and those sounds had to be both appropriate and legal for the company to distribute (I settled on making my own short sequences of chords in Rosegarden - but also allowing users to configure the software).

Even more importantly, the software had to be portable - it was no good if it would only run on 64 bit Linux. The initial product now runs on Windows (in 32 bit mode, but suitable for 64 bit or 32 bit Windows), and on 64-bit and 32-bit Linux - with a great deal of effort put in to make it run on a wide range of systems. Because it uses LGPLd libraries, users also have a choice between a smaller download with more static linking, or a build with all LGPLd components linked dynamically.

On top of this, I needed to build some way to sell the product, so I built a fully automated web-based store to sell the software and offer time limited trials, with payment processor integration.

It was a lot of work to get to Minimum Viable Product, especially when I'm doing paid academic work 30 hours a week, and also spending time writing papers and grant applications - and there is a long way to go yet - but luckily I have a (no longer quite so) secret weapon to help me!

Sunday, April 1, 2012

Our website is live

After a fair bit of frantic work behind the scenes getting everything ready, the Lanthaps website has launched - and our flagship product, Lanthaps ProdTimer, is available to download, try and buy.

ProdTimer is my answer to procrastination and burn out - it reminds you to take regular breaks, and it reminds you when to get back to work. This way, you can dedicate your work time slices to the important things, while still having a controlled amount of time to spend on other things. I plan to post a lot more about ProdTimer here in the future, but until then, feel free to check out the free trial at https://lanthaps.com/prodtimer.