Mark Needham

Thoughts on Software Development

From Prototype to Delivery

with 3 comments

Projects often reach the interesting point where the prototyping and development phases intersect and there are some interesting decisions to make.

From a development point of view the biggest decision is what to do with the code that has been developed.

When developing prototypes the focus tends to be on getting something to work quick and dirty. Not a lot of time is put into considering edge cases or error conditions or any of the other niceties that are needed for software to be usable in an enterprise environment.

There are generally three choices with regards to what to do with the code:

Throw the code away

This would be the favoured choice all things considered as it means that the team can get the dual benefit of writing good quality production code TDD style while also taking on the lessons learnt during prototyping.

If this approach is to actually happen then expectations of the client need to have been set extremely well. It needs to be made clear to them during the prototyping phase that what’s being written is throwaway code and is not production quality.

It is very easy for the client to see the output of prototyping and believe that functionality has been implemented and can now be rolled out.

From their point of view what they would see (from a UI level for example) from code written as a prototype or as production quality code may be no different, and they may think that you are just wasting their money by writing the same thing twice unless this is well handled.

Keep the code and retrospectively refactor it

This option is the middle ground between the two extremes. We keep the prototyping code but add some tests and refactor the code in retrospect.

The code produced probably won’t be as clean as if it had been written with a TDD approach, but it will allow the project to be delivered more quickly in the short term at least.

Edge cases probably won’t be investigated as thoroughly as if the code is written from scratch with complete analysis, but more cases will be considered than if it was not tested at all.

Keep the code as it is

The final option is to keep the code written during prototyping and add edge cases and error conditions around it.

This is the most risky approach because although we have working prototype code we lose the set of regression tests that we would have if it had been developed in a test first approach.

Our mind set will now also be more inclined to think that a piece of functionality is complete and we may end up missing important edge cases which only rear their ugly head when the code is in production.

In a perfect world every prototyping session would result in the code being thrown away and then rewritten using the lessons learned in the initial attempt.

As it is not, it does make me wonder whether it would be best to sacrifice some of the speed in the prototyping phase to write better code and remove some of the pain that will otherwise be felt later on.

Written by Mark Needham

August 18th, 2008 at 10:39 pm

  • Jeff Santini

    At the risk of being vilified for making analogies between industries. You would never see Boeing or Grumman add functionality to an airplane prototype then sell it as the “real” thing.

    I think the real problem is communication. A prototype needs to be fast to build and demonstrative of some key point or points that the envisioned app will enable.

    To try to make it a better platform for the actual application degrades its ability as a prototype. I.e. it is either not developed as quickly therefor more costly than necessary for a prototype and/or less clean therefor a poorer demonstration of the key concepts it is prototyping.

    Seperation of concerns and all that.

  • http://thoughtworksuk.wordpress.com kashan

    It really depends on how detailed the prototype really tends to be as well as how it is written, and if the business logic is obeyed. If the client wants low-fi prototype, go for Powerpoint presentation, or a code with a basic flow where you know what the user will do. We had a javascript heavy prototype which was stripped down to the bare minimum when it came to the real code as business logic guided most of the things to be in the code behind. Which helped with the non-functional requirements (page loading in less than few ms).

  • http://benhutchison.wordpress.com/ Ben Hutchison

    “In a perfect world every prototyping session would result in the code being thrown away and then rewritten using the lessons learned in the initial attempt.”

    For me, a perfect world is one where you *dont* have to redo work twice, ie every prototyping session would result in basically sound code, that can reach completion through incremental evolution, adding regression tests, and refactoring.

    For me, the “throw your work away and start fresh” message seems overly idealogical. This is supported by your observation that it is rarely followed in practice.

    I dont think the airplane metaphor in the previous comment is accurate: while aircraft builders dont extend the physical prototype instance, they do extend a prototype’s design. That more akin to what goes on in code.