When programming, it’s best to use incremental development. That’s a fancy phrase for writing small portions of code (or very simple code, you could write the simplified shell of a program which is complex in theory, but simple and incremental) and then testing those incremental developments.

Purpose
The purpose of incremental development is to avoid the “frankenstein effect” where you do all this elaborate code that won’t activate or execute without copious embedded bugs. With incremental development, psychologically and computationally, coding is more rewarding. Why? Because when you code something and it runs, that’s a small victory and is psychologically rewarding. It’s computationally rewarding because you simply have the certainty that that code executes without runtime, semantic, nor syntax errors. Besides, it’s rewarding incrementally building a small portion, getting that to execute correctly, and then adding to that pre-existing clean code. It’s a headache to put hours into code, then run it and discover that something doesn’t work and have to spend an enormous amount of time debugging.

Conclusively, incremental development in coding:

  • cuts down on debugging time
  • simplifies and eliminates convoluted debugging
  • is cognitively more rewarding
  • is computationally smoother and superior

An example
Let’s say you wanted to compare x and y and then have some complex embedded function occur depending on the boolean comparison of x and y.

Check out this program.

# compares x and y. if x>y returns 1, if x==y returns 0, if xy:
return 1
elif x==y:
return 0
else:
return -1

Now that program successfully runs and successfully returns what it says it does in the comment. You know that part works. Now you focus on replacing the return 1,0,-1 with more complex things like embedded functions.

This concludes the rudimentary and helpful programming technique of incremental development.

Scaffolding
Scaffolding is code thrown into a program to test for runtime errors. Scaffolding code is always removed when the program is complete, or more likely, when the the incrementally developed sub-part of the program or function has been verified for accuracy.

Example

def adder(x,y):
        print x+y
       # print "The result is:",x+y

Here, the print before x+y is “scaffolding”. This is about as abominably simple as you can get and this scaffolding is almost not necessary because the program is so simple, but basically scaffolding tests a less complex part of the function, program, and/or code:


Advertisements

About V.P.

meh meh.

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