4 ms·
I'd say that after they've gained a basic familiarity with the basic ideas ("hello world", variables, basic control structures, functions), they should really b
by pcmonk 13y ago
I'd say that after they've gained a basic familiarity with the basic ideas ("hello world", variables, basic control structures, functions), they should really be introduced fairly early on to working with data structures (particularly linked data structures, trees, graphs, and the like) and how to manipulate them. Recursion is critical to manipulating these, and I think getting new programmers to think in that way is a good thing.
I think it's too common to have "instant gratification" tutorials where you learn some trick or some library to make a particular technology do what you want (for example, some little javascript or css snippet so that when you move your mouse over some text, it disappears). That's not real programming. Sure, a lot of work has to be put into learning little tricks and new libraries and whatnot, but real programming is thinking about data structures in an abstract way and manipulating them.
Get them to write a todo list application with the ability to sort the items in the list. The interface isn't terribly important, so try to get them to care more about the data structures.
Also, I've found that implementing Conway's game of life is useful. The map can be stored in several different ways (e.g. simple matrix of cells, two-dimensional linked list of live cells, quadtree as in hashlife) and manipulating each of those structures would give them techniques that are useful in many situations.