Hello,
just to add a couple of metaphors I already used in a programming course
(not in SWC, but in a Master's degree in bioinformatics).
The first one is "Your boss asks for 20 flasks of a solution. You get the
first flask, add water, add the solute, put the flask away from the empty
ones, repeat the same procedure for every flask. Do you have to change
something if the flasks are 30? 100? If you use a different solute, do you
have to change a lot in this procedure?"
The second one aims to introduce the concept of many operations on each
item, by trying to move away from the single activity per item. "We want to
compute the average height and the distribution of hair colors of the
people in the room. I could call you one by one, ask for the height,
perform the summation and, after everyone showed up, divide the value by
your number. Then I call you again, one by one, and ask for hair color. In
this way, you have to stand up twice, wasting a lot of time, while I could
instead ask for height AND hair color while it is your turn in the queue".
After that, I usually re-use the queue metaphor to introduce nested loops,
i.e. for each person in the queue a clerk asks for each item in a checklist
list.

Best,
Giuseppe


Il giorno gio 3 dic 2015 alle ore 11:43 Greg Wilson <
gvwil...@software-carpentry.org> ha scritto:

> Matt Davis built a very cool module for the Jupyter notebook called
> ipythonblocks that rendered small images using HTML and CSS -
> http://ipythonblocks.org/ seems to be down right now, but you can grab
> the plugin at https://github.com/jiffyclub/ipythonblocks.  As Guzdial &
> Ericson showed, it's a great way to teach loops and conditionals, array
> indexing, and a bunch of other things.  Mike Hansen built the
> "skimage.novice" module to provide similar functionality on top of SciPy's
> image manipulation as a bridge between the simple-but-slow and the
> real-but-harder-to-understand (
> http://scikit-image.org/docs/stable/api/skimage.novice.html).
>
>
> G
>
>
> On 2015-12-03 10:32 AM, Lukas Weber wrote:
>
> Hi Karin,
>
> I like the example about pixels in an image. For each pixel in an image
> (row by row), do something, for example convert color to grayscale. Most
> students have a good intuition about images, pixels, and other media
> examples.
>
> I think this was from the "media computation" examples in Mark Guzdial's
> "Why Is It So Hard To Learn To Program" paper:
> http://files.software-carpentry.org/training-course/2012/08/guzdial.pdf
>
> Lukas
>
>
> On Thu, Dec 3, 2015 at 11:19 AM, Juan Nunez-Iglesias <jni.s...@gmail.com>
> wrote:
>
>> Ha! I like the egg metaphor + demo. One thing I would suggest is to
>> change the variable from "egg" to "egg_in_hand". People in my workshop
>> seemed to have the most trouble with the idea that each element was being
>> assigned to the variable name in the for loop. With "egg_in_hand", you can
>> demonstrate the assignment that's happening.
>>
>> Either way, I like all the different applications of your metaphor. You
>> can teach programming *and* make a cake, all in one session!
>>
>> Juan.
>>
>> On Thu, Dec 3, 2015 at 9:01 PM, Ian Hawke <i.ha...@soton.ac.uk> wrote:
>>
>>> One example that I've used in words, and want to try in reality:
>>>
>>> Take an eggbox with one row of eggs.
>>>
>>> for egg in eggbox:
>>>     crack(egg)
>>>
>>> and then take them out one at a time and crack them (into a jug, I
>>> guess).
>>>
>>> Alternatively, number the eggs with a permanent marker from 0, and use
>>> this to display list access.
>>>
>>> Main reason for doing this with an eggbox is that it extends to two
>>> dimensions, so the metaphor can extends to numpy array examples with two
>>> indices, which always seems to cause more issues.
>>>
>>> Ian
>>>
>>>
>>> On 03/12/2015 09:24, Karin Lagesen wrote:
>>>
>>>> The more I teach, the more I realize that I am not really able to
>>>> convey what a for loop does to everybody. Do any of you have a metaphor or
>>>> something that you use for teaching it? I explain about variables and
>>>> collections, and the body of the loop, and I show examples, but I am still
>>>> not able to get through all the time.
>>>>
>>>> Karin
>>>>
>>>> _______________________________________________
>>>> Discuss mailing list
>>>> Discuss@lists.software-carpentry.org
>>>>
>>>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>>>>
>>>
>>>
>>> _______________________________________________
>>> Discuss mailing list
>>> Discuss@lists.software-carpentry.org
>>>
>>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>>>
>>
>>
>> _______________________________________________
>> Discuss mailing list
>> Discuss@lists.software-carpentry.org
>>
>> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>>
>
>
>
> _______________________________________________
> Discuss mailing 
> listDiscuss@lists.software-carpentry.orghttp://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
>
>
> --
> Dr. Greg Wilson    | gvwil...@software-carpentry.org
> Software Carpentry | http://software-carpentry.org
>
> _______________________________________________
> Discuss mailing list
> Discuss@lists.software-carpentry.org
>
> http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
_______________________________________________
Discuss mailing list
Discuss@lists.software-carpentry.org
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org

Reply via email to