Complete coding everything before moving on to testing

In some agile methods like extreme programming, the test case for a method is written first.  This is not a very efficient way to develop software.  It is more efficient to write the code first and then write unit test cases for it after all the code for a class or group of classes for a component have been written.

One reason for this is because testing involves baggage.  What this means is that if some test cases exist for a componenet and some significant changes need to be made to that component, then the test cases will have to be changed as well.  This usually requires significant extra time and effort.  If the test cases have not been written yet, then there is no baggage and no changes have to be made to test cases because they don’t exist yet.

There are some exceptions to this.  For example, any code that involves using an outside interface that is hard to understand, has not been used before, is complex, or tricky then that code should be prototyped and tested before coding the component that uses that code.  Solve the hard tricky parts first by encapsulating them into a class or function and writing test cases that prove they work as intended.

Another reason to code all the classes for a component is due to flow.

Prev          Next          Back to efficient software development methodology practices

Copyright 2011 by Robert G. Bryan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s