▲ | CodeMage 4 days ago | |||||||||||||
Okay, maybe I'm dumb, but I don't get how the first 3 are "simply plain wrong". They're open-ended enough that I have no trouble imagining how you could use those 3 data structures for those 3 purposes, so I must be missing some aspect of what you're trying to say. | ||||||||||||||
▲ | iLoveOncall 4 days ago | parent [-] | |||||||||||||
It's not that they cannot be used. You can use any data structure for any purpose if you torture it enough. It's that the metaphors are terrible. > "a list can be used for a recipe" A recipe is not just a list of steps, it's also a list of ingredients, potentially an introduction, some pictures, etc. Ask a kid to draw you a mock recipe, you won't just get a list of steps in return. > "a set can be used to list all the unique ingredients you need to buy for a week's meals" 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. I agree that ingredients are unique, but they have attached data which is just as relevant as the ingredient itself. > "a map can be used for a cookbook" I just don't understand how a cookbook is supposed to represent a map, it just doesn't make sense, not even with the additional context of the previous metaphors. 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. 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. | ||||||||||||||
|