Remix.run Logo
CodeMage 3 days ago

> Keep in mind the goal is to teach someone who has zero ideas about datastructures what they are, not to give some analogies to an experienced software engineer.

I agree, which is exactly the problem I have with your objections. If you're teaching data structures to a kid with zero knowledge, you do it gradually, rather than trying to turn them into an experienced software engineer right from the start.

Start with an oversimplification and then build on top of that. The point of an introductory example is to focus on a single concept or a single aspect, and communicate it in a way that is intuitive to someone with no knowledge of it, without overwhelming them or distracting them with additional details. Then, once they've grokked it, challenge them to find flaws in the oversimplification and use that to teach the next concept.

> Ask a kid to draw you a mock recipe, you won't just get a list of steps in return.

Depends on the age. When they're young enough and haven't actually done any serious cooking, kids tend to think that recipes are a series of steps.

Hell, a lot of adults I know, when I ask them something like "how do you make X", start by explaining the steps instead of laying out all the ingredients and their quantities.

This is exactly what I'm talking about when I refer to overwhelming or distracting your students with additional details. You're not trying to build a cookbook app, you're trying to teach someone about a specific data structure.

> Ingredients have quantities attached. If I tell you to make a cake you need sugar, an egg and flour and give you all the steps but no quantities, you're not making a cake. A map is the obvious choice for storing ingredients.

If you're trying to teach sets and your domain of choice is cooking, it makes sense to start with a "list of unique ingredients". You're focusing on uniqueness as a property of sets. Then, once you've explained sets, you can point out that a list of ingredients without quantities isn't very useful, which gives you a great way to introduce maps.

As a bonus, if you've already taught your students about tuples, you can then compare a set of tuples and a map, drawing parallels and pointing out important differences.

> At best it would be somewhat understandable if it said a map can be used for a cookbook, with dish names mapping to recipes, but even this would be a stretch and assume a dish can be made in a single way.

Again, you're thinking like an experienced software engineer. Yes, you can totally assume a dish can be made in a single way if you're teaching kids.

If I'm introducing "string" as a concept for the first time, I won't immediately start explaining the difference between a byte, a Unicode code point, and a glyph.