<div dir="ltr"><div><div><div><div><div>> I like to say the class is a "mother ship" and serves as a kind of "home base" or "platform".  How about an "amusement park"? <br>...<br><br></div>I don't think any of that is any better. <br><br></div>When explaining OOP, I have two points I try to drive home.<br><br></div>0. you can do anything in any language any way you please.  OOP does not give you any new capabilities,  it is just a way of keeping your code organized and readable.<br><br></div>1. I describe a parent class and some of the subclasses used in my video processing system<br><br></div><div>parent: find a list of videos to work on, iterate over the list, self.work() on each one.<br></div><div>work is defined in the subclasses: <br><br></div><div>subclass 1 - encode <br></div><div>subclass 2 - upload <br></div><div>subclass 3 - email the URL to the presenter <br></div><div><div><div><br><div><div><br><br><div><br><br></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 20, 2016 at 3:53 PM, kirby urner <span dir="ltr"><<a href="mailto:kirby.urner@gmail.com" target="_blank">kirby.urner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><br></div>I want to suggest that the much-used metaphor (by me included): <br><br>"class is a blueprint, with instances the buildings made from it" <br><br>(houses usually) is a good start, but not nuanced enough to take us all the way to the end of our story.<br><br></div>These days I've taken a two pronged approach:  yes, OO is meant to model<br></div>how we think normally, about things with properties and behaviors.  <br><br>"The language gets out of the way and lets you think in terms you're already familiar with, from work" and such PR, some truth in it...<br></div></div><br></div>... However (big pause), OO also is it's own knowledge domain with its own concepts and those are better faced directly and dealt with than dismissed as mere noise.  <br><br>The blueprint metaphor, in being so simple, is maybe too simple, and therefore  dismissive, at least if left in place for too long.<br><br>So yes, OO has its cost, the knowledge domain that is OO with all its twisted tails of multiple inheritance and the method resolution order.  <br><br>But learning that little overhead is more than worth the price of admission (the PR again).<br><br>The whole idea of inheritance, and of static and class methods, undermines this simplistic beginning of "blueprint" and so could become corrosive vectors of entropy (leaking sense), if not contained within more fitting metaphors.<br><br></div>I like to say the class is a "mother ship" and serves as a kind of "home base" or "platform".  How about an "amusement park"?  <br><br>Each self brings its little __dict__ to the theme park, but all the "rides" (the "stuff happening") are anchored in the class's __dict__.  The self parameter is like an empty seat in a ride, which the rider's self then fills.<br><br>This so-called "blueprint" is where the methods are happening, which is so not what it's like in the case of houses.<br><br>The many instances (the selves) are but little bags of state, little "var stashes" (uh oh, JavaScript creeping in... :-D).<br><br></div>Anyway, ya catch my drift, right?<br><br>If we over-stress the blueprint metaphor they'll not be as open minded about blueprints having their own "batteries included" and doing stuff on their own, no "selves" need apply in some cases (not all methods need a self).<br><br>Literal blueprints don't light up and do stuff all on their own like that.<br><br>Our classes often behave a lot more like objects with a life of their own. <br><br>... and that's true of course as they're each instances of the type "type", one more example of what that "bag o' tricks" we called 'a class' might look like.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Kirby<br><br><br></font></span></div>
<br>_______________________________________________<br>
Edu-sig mailing list<br>
<a href="mailto:Edu-sig@python.org">Edu-sig@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/edu-sig" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/edu-sig</a><br>
<br></blockquote></div><br></div>