| For something beyond mere toy examples, I would look into online language-specific playgrounds. Those allow you to run code directly from browser - and if you include basic instrumentation (timing, step counters, item/memory use counters, ...) then it becomes really easy to show how a simple change makes things either better or worse. To keep things language agnostic, you can cherrypick a different language for different purposes. That way you get to ensure that the lessons are not tied a particular language and the concepts have to apply universally.[1] For an interesting twist, maybe pick some historical examples too, to show how things have evolved in languages over time. Then, when the basic concept of the lesson is [hopefully] understood, expand to a short case study to show why the dry theory matters in practice. For example, there's an old DoS attack against DNS servers, where a 56k modem could take down a root server due to unbounded O(n^2) worst-case complexity in the hash table implementations.[0] 0: https://www.usenix.org/legacy/publications/library/proceedin... 1: For extra points, you can pick examples where a particular language has chosen an implementation with amusing problems. |