Teaching Programming
Typical approach to learning a language:
- Present everything the person needs to write a simple program
- Have them write the simple program
- Layer on top
The problem with this is that in a language like Java, step 1 is a lot of stuff. It takes a long time for that much stuff to make sense to a beginner. By then more stuff has been layered on top. This makes it very hard for beginners to decode and understand the basics.
Alternative idea:
- start with an assignment statement and a flow control
- With just these basic flow control constructs can be demonstrated
i = 1 tot = 0 top: tot = tot + i i = i + 1 if (i < 11) goto top
This is a repeat until loop. Learning the various control structures this way will make it easier for beginners to grasp them. It will also provide the chance for a person to understand them better so they can choose wisely when to use which.
More importantly, that basic syntax could be taught day 1. In the first week, beginners could be writing code that did stuff. Simple I/O could be covered at end of week so student could then get a real positive feedback early in the cycle.
Another benefit of this approach is that it gets the concept of gestalt across. The above example is nothing but assignment, simple arithmetic and an if. Individually, these are relatively easy concepts. Combined in this manner and you have code that does a summation. The combination (sum) of the individual parts implements a more complicated concept. Very early on a beginner could see the power of combining simple commands. They could also see that the order and logic are critical in turning commands into an "algorithm".