💡
1
c/coding-for-beginners•kelly638kelly638•2d ago

The trick that finally made Python classes click for me was drawing boxes on paper

I spent like 3 weeks stuck on how classes and objects work in Python. Watched videos, read tutorials, nothing stuck. Then my buddy who's a senior dev told me to literally draw a box on a sticky note, label it 'Class' and then put smaller sticky notes inside it for 'attributes' and 'methods'. That visual thing finally made sense. Has anyone else found some weird non-code method that helped them get a concept?
3 comments

Log in to join the discussion

Log In
3 Comments
ellioth37
ellioth371d agoMost Upvoted
Oh man thats exactly what happened to me but with JavaScript closures. I was staring at this code for days and my buddy who teaches kids programming told me to pretend each function is a backpack that carries around its own little set of variables. So I literally put a bunch of random stuff in a real backpack and walked around the house with it, pretending functions were picking up items when they needed them. My roommate thought I lost my mind but closures finally made sense after that. Its wild how sometimes you gotta leave the computer entirely to understand code.
4
lindag33
lindag331d agoTop Commenter
Oh gosh, that backpack visual is pure genius (and honestly hilarious). I mean, it sounds ridiculous but I can totally see how acting it out physically would make the concept click - your brain makes the connection between the tangible object and the abstract code. I've done similar weird things where I draw arrows all over my whiteboard with different colored markers until my office looks like a crime scene, just to trace where variables are going. It's so true that sometimes you need to step away from the screen and make it real with your hands (or a backpack, apparently). Your roommate probably thinks you're a lunatic but hey, you understand closures now and that's what counts.
8
ryan_shah38
lol I actually read about a teacher who made her students act out variable scope with a backpack full of sticky notes in class. She had them pass the backpack around and grab notes out depending on what function they were pretending to run. @lindag33 your whiteboard crime scene comment killed me because I do the exact same thing with like six colors of marker trying to trace callback chains. It's crazy how much easier this stuff clicks when you make it physical instead of just staring at a screen.
5