Conceptualizing Objects In PowerShell

So during a break at the Metro Detroit PowerShell User Group‘s (#MetDetPSUG – thanks to @JMathews87 for thinking that one up!) second session of PowerShell Basics, I was having a discussion with my buddy Sean (@harperse) to help some of our members conceptualize how objects work and behave in the pipeline.

This, arguably, is one of the toughest concepts to teach someone who’s been working with ‘prayer-based parsing’ command line environments.  I myself had a hard time finding the switch in my mind to stop looking at just what was being handed to me on the screen, and realizing how an object and it’s properties change as it flows from one cmdlet to another.  But once that switch was flipped, PowerShell stopped being a basic scripting tool to me, and became something far more powerful.

So we came up with an analogy, and presented it to the class.  Once I was done presenting it, I could see the light bulbs going off in the room.  So I present it to you:

Pretend you're grabbing an apple from a bushel.  We'll call that Get-Apple.  
The apple we have is a tangible object.  This object, type: Apple, has properties.


Just to name a few.  Now, the Apple object also has Methods:

-Throw (That was Sean's idea.  I think he was implying something. :) )

So we take the Apple object and we run it through a press (Get-Apple | Press-Apple).  
The output object we get is Juice.  Now this new object may have some of the same 
property types as the original object, but the may have different values.  It may 
also have some new properties and methods as well.  For instance, you could use the 
method Drink with the object Juice, where you couldn't drink an Apple object.

So what do you think?  An appropriate analogy?  I’d love to hear some thoughts on this.