I'm looking for brilliant metaphors to explain the ins and outs of object-oriented programming. Know any?
So I've been stumbling through Learn Python the Hard Way, reinforced a bit by Snake Wrangling for Kids (which is great for me, even though I'm not a kid), StackOverflow questions, the embedded questions and answers at the Learn Python site, and various other tutorials and articles across the Web.
And I cannot -- cannot
-- wrap my head around the whole "passing arguments between classes and functions" business. It's been weeks that I've been trying to just kind of wrap my head around code like this
(Codepad link, all comments mine).
I just can’t seem to “get” how a variable can be passed from one class to another. Even when I do understand a particular piece of code in terms of how it works line by line, when I try to write my own, I can't grasp how the theory works in order to write new stuff, I can only ape existing models.
So I'm a bit past the super-beginner stuff (print, for-loops, etc.), and totally hitting the wall on the more OOP kinda stuff. What are some great tutorials, short courses, or illustrated examples of how classes, functions and variable-passing works? How would you explain this to a small child (which I am not) or an imbecile (which I am beginning to suspect I might be)?