February 20, 2011

Iterative programs

Iterative programs are consistently reused steps within programming, the basic flowchart for iterative programs follows the steps below:
  • Establish the variable we are going to use
  • Initialize outside the loop
  • Setup the right end test
  • Construct the block of code 
    • the set of instructions that will be done each time through the loop
    • the variable must change each time or you will end up in an infinite loop
  • What happens when the iteration is done
Defensive programming
  • Assume that if you are getting inputs from a user, don't expect the user to give them what you want.
  • If you are getting something from another part of the program or an external source, expect the source and information to not be as expected.
  • Make sure that all possible paths through the code are accounted
  • Make sure there is a possible path through

    Notes from Video Lecture 2: Branching, Conditionals, and Iteration

    Going back to school...

    So, after several years and through the help of the MIT OCW initiative, I am heading back to school.  Really, I just need to get a better handle on some of the basics, and I want to get back to being able to program on my own.  I was looking at where I wanted to store my notes, and this should serve the purpose.