Docstoc

Program Design

Document Sample
Program Design Powered By Docstoc
					The design process

n   How do you go about writing a program?
    q     It’s like many other things in life
        n      Understand the problem to be solved
        n      Develop a plan of attack (we call this the algorithm)
        n      Execute your plan of attack (write the program)



             Problem               Algorithm           Implementation


                Problem solving phase          Implementation phase
Program Design
Algorithm
n   A sequence of precise instructions which leads to a
    solution is called an algorithm.
      A simple example: calculate the sum of two number
      step 1: input first number
      step 2: input the second number
      step 3: add those two number together
      Step 4: output the sum


n   Any similar example in our daily life?
Algorithms
n   The biggest error you can make in
    computer programming
    q   Skipping the “Develop the Algorithm” phase
    q   Hard to see with the simple programs we write
        in this course, but more difficult programming
        tasks impossible



          Problem          Algorithm     Implementation
              Edit/Compile/Debug(test) Cycle

                                      Edit
                                   (vi, gedit,
                                      etc.)
    Runtime Errors                                     Compiler Errors
                            Save File



                Execute
No Errors                                          Compile
                (a.out or
                                                    (g++)
                 xx.exe)
                                 ‘Clean’ Compile



      Done

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:0
posted:5/8/2014
language:Unknown
pages:5