I tought a highschool level intro class in C++ programming. Sadly, it was very short, only 1.5 weeks of 2 hours per day, so we didn't even have time to cover classes.
What I would like is to walk the class through implementing a naïve Brainfuck interpreter, optimizing it, then implementing a Brainfuck-to-C compiler and optimize that.
It would bring a whole lot of understanding I didn't gain until much, much later.
After that, a simple text based adventure game engine to illustrate data driven programming.
That would show the difference between hard coding behaviour in assignments and creating actual usefull applications. It would also show that doing it properly isn't necessarily more difficult, and definately less code.
> What I would like is to walk the class through implementing a naïve Brainfuck interpreter, optimizing it, then implementing a Brainfuck-to-C compiler and optimize that.
Nowadays, I would find that an awesome assignment, but your high school students would hate you.
I remember having to do a similar compiler assignment in C in college. I think that it was the key assignment for making students believe that programming is absolute drudgery and in no way fun. It was the culmination of the semester, and considering how hard many of the students were working, there was frustration that this was all they could make after a semester. I think that your plan will not go well, and could quite possibly sour your students on programming for life. If you teach the text game first, though, that would make a world of difference.
What I would like is to walk the class through implementing a naïve Brainfuck interpreter, optimizing it, then implementing a Brainfuck-to-C compiler and optimize that.
It would bring a whole lot of understanding I didn't gain until much, much later.
After that, a simple text based adventure game engine to illustrate data driven programming.
That would show the difference between hard coding behaviour in assignments and creating actual usefull applications. It would also show that doing it properly isn't necessarily more difficult, and definately less code.