Thursday, August 7, 2008

Prototype VS Production Code


I have always enjoyed projects where the concept of prototype code is carried out in a good manor. I personally have little to no problem throwing away code that is deemed "prototype code" even if it was not intended to be a prototype. I like to ask myself a few questions about a project or feature to help me understand if what i have developed or am about to develop is indeed a prototype.

1) Do I posses enough knowledge about the feature or product to produce a well thought out high quality design? Would something concrete help me explain my lack of understanding?

2) What is the likely hood that what I produce with the knowledge at hand will be a worthwhile contribution to the product?

3) Are we sure that we will develop this using the proposed dependencies? Are we likely to add or remove a dependency or third part component?

4) How technically feasible is the task? Would a simple proof of concept boost my confidence?

5) Does the implementation feel like it is clean, broken out into appropriate units of work? How easy was it to test? Are my tests short and easy to maintain?

6) Have i given the design consideration? Am I shooting from the hip?

A quote from the book "Code Complete" identifies a very good definition of what prototype code is. It challenged me to continually evaluate my behaviors and ask myself if I am turning prototype code into production code.

"A final risk of prototyping arises when developers do not treat the code as throwaway
code. I have found that it is not possible for people to write the absolute minimum
amount of code to answer a question if they believe that the code will eventually end
up in the production system. They end up implementing the system instead of proto-
typing. By adopting the attitude that once the question is answered the code will be
thrown away, you can minimize this risk. One way to avoid this problem is to create
prototypes in a different technology than the production code. You could prototype a
Java design in Python or mock up a user interface in Microsoft PowerPoint. If you do
create prototypes using the production technology, a practical standard that can help
is requiring that class names or package names for prototype code be prefixed with
prototype. That at least makes a programmer think twice before trying to extend pro-
totype code (Stephens 2003)."

1 comment:

thinker said...

We also should see the other side of the coin. the prototype (or a part of it) could be possibly reused in production code if it meets the quality gates and standards of the product. However, the production code must never evolve from prototype. However, I believe that the intention of the prototype should be proofing concepts, design evaluation and getting feedback from users.