F
22
c/coding-for-beginnerscharles289charles2891mo agoProlific Poster

Treating arrays like shopping lists finally made them click for me. What everyday objects help you understand coding concepts?

4 comments

Log in to join the discussion

Log In
4 Comments
sage_moore37
Okay but that's exactly the problem, right? The shopping list breaks when you try to force it to be the map for everything. So what's a better physical thing for .filter? I picture it like sorting laundry into piles. The dirty clothes are the array, and your rule is "only the red shirts." You pull those out into a new pile, but the original messy heap is still there. That makes the action of getting a new array without changing the old one feel real.
4
claire_grant34
The shopping list thing totally works for that basic idea. But how far does that analogy take you? Like when you start using methods to find or remove specific items, does picturing a physical list still help? Idk, maybe it's just me but I hit a wall trying to map something like '.filter' onto a paper list. What do you do for those more complex actions?
1
foster.jordan
Forget trying to map everything to paper. You just learn the code for what it is.
3
barbarab56
barbarab561mo ago
My cousin who teaches math uses color coded stickers for sorting worksheets. It's like .filter where you group items by a rule without throwing anything away. Analogies break down eventually but starting with familiar actions helps bridge the gap.
0