Monday, January 30, 2012

Schrodinger's Code ...



Recently Elisabeth Hendrickson published an excellent article about Schrodinger's Cat and software.  The infamous Schrodinger's Cat is a famous thought experiment (by the physicist of the same name) used in quantum mechanics.  The cat is placed inside a sealed environment, with a poison gas capsule which has a 50% chance of being released each hour.

It's then covered it up, you walk away and return to it in an hour.  At this point the cat can be in one of two states – alive or dead.  But you cannot be sure for certain either way, it's 50:50.  The only way to be sure is to lift the cover and take a peek.

I will repeat again, it is a thought experiment – meaning you think about this, and not do it (that's animal rights off my back).  But it's more than a thought experiment, it's an emotional experiment too.  People like cats in general, with only the odd proto-serial killer taking exception to them.  So although even in the thought experiment you know from the logic that there is a 50% chance the cat is dead, emotionally you want and hope the cat to still be alive.  [Well maybe YOU shouldn't have put it in the death trap to begin with]

But I see the same phenomenon which I call Schrodingers Code on waterfall projects, especially outsourced waterfall projects …

Project managers will send work out to development teams, and the work will start to run late.  But that's okay because the developers are promising that everything will be done one week before release is needed.  The project is running over it's plan, but it can still be delivered.

As a tester you'll ask to get in and test early versions of what development is putting together.  But your project manager insists that would only get in the way and it would be better to leave the developers to “get on with it”.

Can you see what's happening there?  Someone has put a cover on the death trap, and even though four hours have passed when it should have been left for just one hour, they are desperate that the cat should still be alive.  Because they really need it to still be alive.  It then becomes project management by desperation.

What happens then is that the code is delivered, but under simple tests it falls over.  Under questioning, the developers admit “we were so busy getting it to you we didn't have time to test it”.  The problem is that what needs fixing means the software is far from finished and there's a lot more still to do.  The Project Manager and Business Owner conclude “everything was going well until testing got involved”.  The tester sighs and looks for a new job …

It's one of the things which have most struck me recently – what I call the death of unit testing.  Having moved not only from the United Kingdom to New Zealand but also from military software to commercial applications, it's stark and sometimes shocking on past projects.  The shortness of timescales, the ambition to deliver more functionality in less time.  Usually it's testing which can all too often end up compressed.

Outsourced companies are desperate to deliver something to the project plan, even if they know it's not tested, so they can claim they've met their contractual obligations.  And everyone hopes that a single phase of systems testing can cover a lack of testing anywhere else.  [It could happen is the reasoning]

No wonder there's a growing underground army of testers saying “it's not done until it's tested”, because until it's tested we have no idea if it's any good.

I'm a big believer in testing often and early.  I did a presentation to some developers about testing, where as an ex-developer I spoke that the greatest reward you can have is the first time you run some code you've been working for weeks on, and experience for yourself the thrill of it working.  It's something developers should be not just encouraged to do, but find the true joy in.  It's like someone making toys which they never get to play with.

What am I asking in terms of Schrodinger's Cat?  Well basically that we lose the cover, we keep an eye on the cat the whole time, and if it gets into trouble, maybe we need to rethink it all, smash the glass and rescue the cat, rather than hoping the cat gets lucky …

No comments:

Post a Comment