When developing a program it is crucial that you have adequate planning. This is usually accomplished through writing a simple plan consisting of; IPO Chart, Test Data, Variables, Expected Result, Pseduo code and the code related to the end program.
Why complete a plan? Well completing a plan enables you to come back to all that the project your working on is aiming to do. It enables you to stay focused on your task for the project. Usually programmers work in teams which means everyone gets given a small section of the program to develop and work on. At the end of all the program when the final program is completed each programmer needs to know what others are programming. It’s also a safety net if you were ever to quit your job there is record of the program you were working on.
Below is a plan template that I use in programming – Ruby Example Plan.
IPO
The IPO section in planning a program outlays the Input, Processing and Output. Hence the IPO. Fairly simple usually says something like this:
INPUT
prompt user for variable1
prompt user for variable
prompt user for variable3
PROCESSING
calculate the answer by using the variable – “answer”
OUTPUT
Display on the screen the Number Sentence with answer after the proceeding “=” sign.
Test Data
This section is just a little bit of data that you can use to test the program out. Otherwise who knows you could be calculating false results and calling operations to run on a computer that shouldn’t have to run. Below is an example.
TEST DATA
Variable1 Variable2 Variable3
1 2 3
5 6 1
89 12 3
EXPECTED RESULT
1 + 2 – 3 = 0
5 + 6 – 1 = 10
89 + 12 – 3 = 98
Pseduo Code
Pseduo code is not the final code from the program. Pseduo is pronounced, “Sudo-code.” It is essentially what you would like the program to do in English without all the needed grammatical characters.
get variable1
get variable2
get variable2
CALCULATE answer(float) AS variable1 + variable2 – variable3
Ruby Code
This section should be titled the type code that you are programming in. For instance if your programming in C++ then title this section C++ Code.
#!/user/bin/env ruby
# Programmer: Nicholas O'Sullivan, E - <a href="mailto:nick@autechnet.com">nick@autechnet.com</a>
# Cert IV Information Technology
#
# Date Modified - 19 July 2010
# Version: 2.0
# Program Name: Ruby Practice 1
# Purpose: Calculating 3 values that a user inputs and outputting in a
# number sentence the operation performed and answer
#
puts "Plese enter the 3 numbers below as variables.\n"
puts "Variable 1: "
value_one = gets.chomp.to_f # can be f for float, i for integer, d for double
puts "\n"
puts "Variable 2: "
value_two = gets.chomp.to_f
puts "\nVariable 3: "
value_three = gets.chomp.to_f
answer = value_one + value_two - value_three
puts "\nIs this correct? \n #{value_one} + #{value_two} - #{value_three} = #{answer}"
system 'pause'
The final document produced should be a PDF or Word document that clearly displays what you are doing in your program – Ruby Example Plan.