Future Creep – You aren’t gonna need it!

How many times have you added an additional parameter or bit of logic to your code because you thought it could be useful and it’s easier to add whilst your already changing the code?   If you are your introducing Future Creep!  and should stop doing it.

What does Future Creep mean?

If your from from an XP (Extreme Programming) background you would know this better as YAGNIYou Aren’t Gonna Need It!   I actually prefer the term Future Creep I first saw on the post, beware of future creep by Jamis of 37 signal.   Everyone understands the terms Scope Creep and Feature Creep and its easy to spot these, although often ignored.  Future creep is the adding of additional code by the developer because they can see a possible future requirements.

DONT DO IT!

You may think, hey it’s only gonna take me a couple of minutes to add this additional parameter which I can see being really useful in the future.  You add the code and then move on,  from that point forward that additional code needs to be maintained, every time a developer interacts with your code they need to read it and understand it – often taking more time as that bit of the code is never actually used, which leads to uncertainty about the code.

It happened to me

The reason I wrote this blog post was an example of future creep on a recent project that had a measurable impact on time and effort. The future creep was was simple, the developer was writing a light weight logging library and decided as part of the Logging.Log() method that if the code had a HTTPContext they would also initialise the current web using SPContext.Current.   None of the code within the internal methods made use of this it was just setup and passed into the method.  This in itself does not sound to bad and for most scenarios the code did run with a valid SPContext h0wever this future creep caused a number of issues which forced developers trying work around it

  1. The logging library could not be used in code that had elevated privileges as SPContext.Current throws an error if accessed under a different security context
  2. The logging library could not be used where a HTTPContext existed but no SPContext, as was the case for some of the Exchange integration code

Having battled with solutions to the second scenario and getting comments about not wanting to make changes to the Logging Library because the dev was not comfortable with the way it had been implemented I challenged the original author of the code as to the requirement for SPContext.

The answer:  Future Creep

A few minutes later the extra code was refactored out, and the library could be used.

Lessons Learnt and how to prevent it?

Don’t do it,  resist the temptation, remember:

The best way to implement code quickly is to implement less of it.

The best way to have fewer bugs is to implement less code.

And adopting techniques like Test Driven Development force you down a path that doesn’t allow it.

This entry was posted in Agile, Development and tagged . Bookmark the permalink.
  • http://www.wildwires.com Stacy Draper

    I've always called it Carpe Diem Developoment.

    After reading your work and watching your interviews it's without a doubt that you are a huge TDD proponent. I'm not for or against it, I think it really depends on the given situation. But isn't TDD Future Creep itself. After all the idea is that you are going to modify the code in the future right? And TDD hedges that bet.

  • http://www.21apps.com AndrewWoody

    accept

    Andrew Woodward | Principal Consultant | 21apps | Tel: +44 1691 829372 | Mob: +44 7970 126829

    MVP – Microsoft Office SharePoint Server – MVP Profile – Follow me on Twitter – Read my Blog

  • http://www.21apps.com AndrewWoody

    Fixed typo in the title :)

  • Pingback: SharePoint Daily for March 16, 2009 - SharePoint Daily - Bamboo Nation

  • IamAcoder

    Don't wish to be a total pedant, but it's actually FEATURE creep.

  • http://www.21apps.com AndrewWoody

    IamACoder, personall I would refer to FEATURE creep when the code in question actually add's some additional feature. FUTURE creep as in this post is where the developer add's some additional code to support a possible future feature. A small but significant difference

  • http://allowunsafeupdates.com Matt Taylor

    I always admire (and envy to an extent) people who take such a definate stance. Your words will certainly make me think twice the next time I am tempted to do something like this but experience tells me that the only time you can ever be gauranteed to make the right judgement is in hindsight. I have many examples where my instinct to add somthing outside of the requirements has ended up paying dividends but equally I can remember situations where I caused myself (and possibly others) more work by doing the same.

  • http://www.novolocus.com Andy Burns

    Depends what you're doing, and who you're talking to. I'm not sure I agree with never adding support for future functionality – you have to use judgement. I guess I'm with Matt on that.

    Example – last year I wrote an Outlook 2003 to SharePoint 2007 plugin. The customer insisted (with absolute certainty) that emails would always be saved as one content type, and I could just hardcode the form to fill in the item's metadata. They also kept telling me to “just 'hardcode' everything” 'cos the integration would only be used on their system, and clearly it'd make development so much faster ;)

    I judged that they didn't know what the hell they were talking about. It was clear to me that they would need to save emails as different content types, and it'll be a cold day in Hell before I “just 'hardcode' everything” – not least as I need to be able to test it on my system!

    Adding the dynamic generation of the form to fill in the content type data was a fair bit of effort – a lot more than building a fixed form. If this functionality had never been used it could easily have been seen as future creep. A week after I'd finished it they needed to save emails as more than the one specific content type. The customer was quite chuffed to discover that we could support that and wouldn't have to spend time in change control.

    I think that if you've got a clear and tightly defined requirement then yes, just get it done. And there is a temptation for developers to try and be clever and gold plate things (well, some developers, anyway). But I wouldn't just ignore what I think is likely to happen in the future, especially in some cases where adding the extra functionality in later is much harder than doing it up-front.

    And while less code is good… …we are talking about SharePoint here! ;p

  • Pingback: Software Quality Digest - 2009-03-18 | No bug left behind

  • Pingback: The difference between “Future Creep” and writing good code « Brian Farnhill

  • http://www.21apps.com AndrewWoody

    Andy,

    Your stumbled on one of my other favourite topics with the line… 'not least as I need to be able to test it on my system!' So the code you added was not so much Future Creep but part of creating testable code.

    I may be stretching your point somewhat, but I'm still convinced that in the long run and even taking these examples into account not adding Future Creep will result being more productive, producing better quality code.

  • http://www.21apps.com AndrewWoody

    Andy,

    Your stumbled on one of my other favourite topics with the line… 'not least as I need to be able to test it on my system!' So the code you added was not so much Future Creep but part of creating testable code.

    I may be stretching your point somewhat, but I'm still convinced that in the long run and even taking these examples into account not adding Future Creep will result being more productive, producing better quality code.

  • http://www.21apps.com AndrewWoody

    A great related article talks about agile document, and the You Aren't Gonna Read It approach.

    http://www.agilemodeling.com/essays/tagri.htm

  • Pingback: The difference between “Future Creep” and writing good code | Brian Farnhill