Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
A design of a solution can be concisely and precisely expressed as an algorithm (using the data structures and data flow diagrams from the problem definition step).
2. Control flow charts
An algorithm is a precise step by step method for solving a problem. A control flow chart (or flaw chart) is a pictorial form of an algorithm. Flowcharts are difficult to draw, process, and update. Flowcharts do not easily scale up to handle large programs.
Control flow charts went out of style in the 1970's, but people continue to use them. Avoid flow charts. Data flow (and other) charts are still very useful.
3. Flaw charts
Fallacy: Control flow charts are a good way to specify algorithms.
A flow chart has the following properties.
difficult to understand (like a puzzle to be solved)
makes it hard to establish correctness
is often not updated when the program code is updated and thus out of sync
Control flow charts are not useful. Instead, use pseudo-code.
[UML jobs, Alan Kay on bricklayers]
5. Armstrong R&D
In the 1980's, when starting to working at Armstrong R&D as a computer physicist, I ask some programmers, more than once, what a program did and showed him the code.
The programmer started to explain each line of code and what that statement did.
That was not useful. A flow chart is like that.
6. Control flow charts
There are many charts that are useful.
A data flow chart can be very useful.
A control flow chart for an algorithm intended to be coded in a programming language is not very useful.
7. Pseudo-code
Instead of a flow chart, pseudo-code is used.
The pseudo-code idea developed in the 1970's as part of structured programming in order to express algorithms in a precise textual way such that reasoning about the correctness of algorithms and code could be facilitated.
8. Flow charts and pseudo-code
Pseudo-code is a written form of an algorithm (that is easily processed using computer text editors) and should be closely related to the final program form.
9. Pseudo-code for polygon area
Get units and number of points
Set total area to 0.0
FOR EACH pair of adjacent points\
(x1,y1) and (x2,y2) DO
IF the pair is the first pair THEN
Set the base (x0,y0) to (x1, y1)
ELSE
Calculate triangle area of points\
(x0,y0) , (x1,y1) , (x2,y2)
Add area to total area
END IF
END FOR
Output total area of the polygon
▶
+
-
1. Start with 6 nodes.
2. Process from 1 to 6.
3. Node 1. No triangle yet.
4. Node 2. No triangle yet.
5. Node 3. Triangle area of 1 2 3.
6. Node 4. Triangle area of 1 3 4.
7. Node 5. Triangle area of 1 4 5.
8. Node 6. Triangle area of 1 5 6.
10. Musical analogy
Provide the pseudo-code to the student in the first course.
Creating your own music is like creating pseudo-code.
Learning an instrument is like learning coding.
Playing an instrument is like coding pseudo-code.
Students learn with examples of how to do things.
11. Course assignments
Example: Pseudo-code for determining the area of a polygon.
This is an end-of-course goal. Work back from goal to previous assignments (top-down, backward chaining) to get subgoals.
Distance between two points (for perimeter)
One triangle area of three points
Various loops and data structures - variables, arrays, records, etc. (refactoring)
Assignment sequences are designed (by the teacher) top-down. Assignments are done (by the student) bottom-up.
12. Programming course
An introductory programming course should emphasis both ideas and mechanics of programming, but not require a high level of intelligence as in requiring the design of solutions for problems.
Computer science: too hard, requires too much intelligent problem solving
Business: to easy, does not cover ideas or mechanics needed
My opinion (since about 2000): The introductory programming course should be the same for all majors. After that course, the student can decide which direction to take, provided the registrar and departments can handle such changes.