What is Programming?
Specifying a detailed set of instructions telling a computer
how to perform some task.
We will learn how to DESIGN programs (not just write them).
Five steps in the design process:
-
Understand the problem
-
- What is this program supposed to do?
- What kind of information is it given?
(What is the input?)
- What kind of results is it to produce?
(What is the output?)
- What formulas or techniques will be needed?
-
Do a small example by hand
-
Working out an example by hand helps to further understand
the problem, and also provides some test results for
later.
Doing this example can also help develop the algorithm in the
next step.
-
Write an algorithm for solving the problem
-
After working out an example by hand, you can write down a "recipe"
for how the problem will be solved.
This is a step by step list of what needs to be done.
-
Translate the algorithm into a programming language (like C)
-
Once you learn the C statments available with their proper
"grammar", this should become an "easy" step.
-
Test the program
-
Run the program with your test data. Does it work? Does it
work with other data? Later we'll try to "break" the program to
find cases where it might not work.
Methods of approach:
-
Top Down
-
In the top-down approach, we start with the description of the problem.
We break that up into "modules", each of which do a part of the
problem, and repeat the whole process on each one of those modules.
-
Bottom Up
-
In the bottom-up approach we start with a simplified version of the
problem; get it working; than add new features and capabilities
until it solves the entire problem completely.
-
Reality
-
In reality, we approach problems a little bit both ways -
some top-down, some bottom up.
to Overview.