I think educators should take some kind of prebuilt program that is simple, fun, and interesting... and use it as sort of a library to introduce to students.
For example... let's say there's some simple fruit ninja clone or something. You start out with a whole, mostly functioning program and have them fill in a very simple part. Like make it so that when you touch the screen, it spawns some fruit.
Then have them change it so that when they touch the screen, it has like a 25% chance of spawning a bomb.
We're talking simple stuff, too... like the changes would literally be like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
/*
Student is given this:
*/
void screenTouched()
{
// student inserts their code here
}
/*
And their solution might be something like this:
*/
void screenTouched()
{
double val = getRandomRealNumber();
if( val < 0.25 )
spawnBomb();
else
spawnFruit();
}
|
So it's the same basics: variables, function calls, if statements, etc. Only instead of it being in a stupid console program nobody cares about... it's in an awesome game and they can actually see how their code changes are affecting it.
Eventually you take away the modules and tell them "okay... now write the code for the 'spawnFruit' function"
And so on and so on. You eventually work down until they're doing the basic drawing and all that.
Not only does this keep them interested because their code is more tangible, but it also teaches them about modular design, program structure, etc, etc, etc. And it's something everyone can jump into right away.