Wednesday, February 29, 2012

Why Is programming an unnatural activity?

For my P2PU course I have been looking at "Novice" programmers.  And in one of the papers we were asked to read Mark Guzdial asks:
“Why?” Is programming an unnatural activity? 
Could programming be made easier in a different form? 
Could programming be taught in a different way that makes learning easier? 
Or maybe we just have no idea how to actually measure what students know about programming. (1).
My main problem with the Guzdial paper (this was more my problem than a problem with the paper) is I felt it didn't provide enough details or specifics on "Why it is so hard to learn to Program?"  I need specifics and examples to get my head around things.  Roy Pea, was a great find and perhaps not surprisingly (for me at least) the Resnick article was very useful. 

Pea (et al) talked about three classes of bugs:
  1. Parallelism Bugs
  2. Intentionality Bugs
  3. Egocentrism Bugs
Parrallelism Bugs
The Parallelism Bugs, is basically an "assumption of different lines in a program can be active or known by the computer at the same time or in parallel".  For example, look at this code:

If (Size == 10)
    print "Hello"
For Size in range(10):
    print Size
  
When High School students. in their second year of programming course, were asked what they thought the program would print 8 out of 15 predicted "Hello" would print after "10".

Intentionality Bugs
The Intentionality Bugs, is the idea in the child's mind that "the program has goals and knows or sees what will happen elsewhere in itself."

Egocentrism Bugs
The Egocentrism Bugs, stem from the belief that there "is more of their meaning for what they want to accomplish in the program than is actually present in the code."  Funny, I see these kinds of bugs all the time in my code and those of other experience programmers :) 

The Super Bug
He concludes that all these derive from the Super Bug:

The idea that there is a "hidden mind somewhere inside the programming language that has intelligent and interpretive powers."  Not surprising since most of kids experiences are with semi-intelligent beings (aka Parents)

Resnick, noted that: 
"This sequential paradigm does not match the way the real world works: people and animals act in parallel, objects interact in parallel. As a result, many real-world activities can not be modelled in a natural way with sequential programming."
He developed a concurrent or parrallel version of Logo (Multi-Logo), so the kids had a language/environment that more closely matched their view of the world.
SideNote: I used to think and say that Concurrent Programming was really really hard.  I had plenty of evidence to back this up and had heard and read much smarter people than me saying the same thing.  Then I encountered Etoys (and later Scratch) and started teaching these to kids.  And realized that Concurrent Programming is actually easier (although you do have the added complexity of syntonization issues) .  The problem was not the topic/idea, it was the language we use to think about it.
Resnick noted that "In general, students appropriated the idea of agents sending messages to one another quite easily."  Too bad we don't teach more Smalltalk.
He identified three types of bugs specific to concurrent programming:
  1. Problem Decomposition Bugs
  2. Synchronization Bugs
  3. Object Oriented Bugs
Problem Decomposition Bugs
"These bugs arise out of students' difficulties decomposing problems into actions to be performed concurrently by multiple agents."  Here there are two types of decomposition:
  1. functional decomposition - dividing a problem in to simpler sub-problems (what needs to be done)
  2. agency decomposition - dividing the functional pieces among different agents (who does it) 

Synchronization Bugs

"These bugs arise out of students' difficulties coordinating and orchestrating the activities of multiple agents."
These bugs he divides into two type: Unintended Sequentiality and Unintended Concurrency. In these cases the student expected Sequetiality and got Concurrence (or vice versa).

It seems that in designing Multi-Logo to deal with synchronization he provided two mechanisms: ask and demand.  Where when you "ask" an agent something (ex: flash light -  for 20 seconds) the request is queued up to be executed in the order received. When you "demand" the agent interrupts what is going on to perform the request (or it might simply put it at the head of the queue, I am not sure).  It is interesting, at least to me, that Scratch, developed later by Resnick and his team,  got rid of the ask and demand and went with a "broadcast" "wait" and "do for X seconds" to allow for synchronization.  I believe this simplifies and avoids a number of problems for novice programmers.

Object Oriented Bugs
"These bugs arise out of students' confusion among different types of "objects"  Multi-Logo has multiple types of objects: agents, turtle, and on the Lego Interface box (think early NXT) ports and sensors.  Part of this confusion may have been the overloading of "halt" which for an agent, 
Another quote for Guzial: 
  • " our current programming languages do not allow people to program the way that they think about the tasks"
  • Section: "Making tools better by shifting to Visual Programming"
  • "having students build their own visualizations had significant impact on those students’ learning."

Resnick's Lessons Learned
"It is a good idea for students to "play agent"--that is, act out what each agent is supposed to do. This activity requires a group of students, each playing the role of a different agent."  I really like this approach with novices and often warn students "Step away from the computer and no one will get hurt".  Having them act out the program and program each other is a good way to do this. 
In designing Multi-Logo he realized he did not go far enough in parallelism: "An alternate approach, of course, is to change the design of MultiLogo to match students' preconceptions. For example, I could redesign MultiLogo agents so that each agent could do several things at the same time, in line with students' expectations of "excessive parallelism."  He later did have agents that can do several things at the same time.  
He also discussed the idea of design the environment match the students pre-conceptions. Would be interesting to find out what problems it solves (and those it doesn't) and what new problems it creates.



If you read this far, thank you.  And as a way of thanks, if you haven't already seen this it is a real treat.


Lastly if you notice any "bugs" in this posts thinking, please comment and let me know.


References:
NOTE: If you have limited time, I would recommend reading (2) then (5), then for a real treat watch the Brett Victor talk (7)
(1) Why Is It So Hard to Learn to Program - Mark Guzdial 

Sunday, January 22, 2012

What Do You Want Your Learners to Learn?

These are the questions for this weeks P2PU class



  • Who are you trying to help?



D. Rillin Kill Age: 6 (going on 16)
Always wants to know why.  Finds the worksheets and seemingly arbitrary rules boring.  She does not understand math and why we invert and multiply.  Enjoys drawing and chatting with friends. Likes games and puzzles.  Her friend Sadie is home schooled and she wonders if that would work for here too, but her Mom worries about where she will get the material and books to teach her. 



Grandma Moses is concerned about her grandkids: Bela Bartok who loves music and composing, Ira Caull who loves storytelling and animation and her grandson Horatio Algebra (location unknown, but could be any number of places) who really likes math.  Her village just received a bunch of these new fangled laptops and she is wondering how her kids can use them to learn and better their lives.








I.M. Shirley Wright is a teacher. He is bright and likes to be the one who knows everything.  He now has to adjust to these computers in the classroom, which he has never used before and kids seem to learn faster than he does.  His main fear is that the kids will find out his middle name is Shirley and make fun of him.  He prefers they call him Mr. Wright.







What will they be able to do (or do better)
after learning what you're trying to teach them?

What I want them to learn depends on what I am teaching, but in general I strive for these three habits of mind:
  1. Learn to test their ideas (and the ideas of others)
  2. Get in the habit of reflection
  3. To know (or at least try) things multiple ways

Now Greg asked us to be specific and to describe "the simplest task they care about."  I agree whole heartedly that kids learn best when its about something that matters to them.  The challenge is how can you teach something that matters to a class of 20 to 30 kids?  Perhaps some kind of self selecting set of options where kids learn programming concepts around different topics (art, music, stories and games) or one class where the different topics are taught and then during the class kids will have an opportunity to work on what matters to them.  The Scratch Curriculum Guide Draft seems to take the latter approach. I also like that the guide has "Reflecting" sections in each lesson. I have not used this Guide to teach a class yet, but will try to do so some time this year.



Okay so, Greg also asked us to be specific, so let me try to give a specific example of how I try to teach the three habits listed above.  So ...



1. Learn to test their ideas (and the ideas of others)
I will often say things that are obviously false (like "As we all know Sun rotates around the earth" or "The earth is flat").  Then when I get the stunned look on kids faces, one of them usually corrects me and says the Earth rotates around the sun.  To which I will respond, how do you know?  They will usually tell me their teacher told them or they read it in a book. At which point I will ask do you believe everything you read (or everything a Teacher says?)  I will then point out to them the obvious fact that if they watch the sky, they can see that the Sun is moving or how can the earth be round? Why don't people on the bottom fall off?  This also leads towards lessons on you can't always believe your senses (for which optical illusions are a lot of fun and I have them create some).

Okay, so how does this relate to programming and webcraft. Good question, I diverge a lot when I teach :)

If you read my other posts you will probably know that I use Etoys a lot (I also teach kids python and math).  Later I will try and post a video using Etoys to explain how I would teach the above three habits of mind.







How can you tell during the scope of your teaching that they've learned what you hoped to teach them?
Well I teach mostly homeschoolers and develop "educational" material for OLPC/Etoys.  In the first case when I work with kids directly I do not give final exams (or any exams).  I ask them to work on projects they are interested in and then ask them questions and listen. In these cases the classes are small at most 8 and I can manage it. Of course the problem is this does not scale.

In the case of OLPC users, I never see the kids who use the software, most don't have internet connections and even if they did, I am not sure how I would get feedback on their thinking, other than asking them to write about what they learned.  I could ask them to write two scripts to do the same, thing but that would be BORING.  This is a real challenge.

One potential way to deal with this (at least the reflection part) would be to have them do the Mathematical Shapes challenge and then have a page that shows them the scripts they wrote for each challenge. This would get them to look at what they wrote and I could ask them to what's the same and what's different about these scripts.


One final and I think important point.  Sometimes kids learn things which are NOT what you hoped to teach them but are important lessons anyway.  Its important to be open to different directions kids may take, even if they are not the ones you intended.  If they are going off in a different direction, it is most likely because its something that is more interesting to them, and thus they will learn.

Tuesday, January 10, 2012

Organizing Instruction and Study to Improve Student Learning - Part II




One of our first tasks is to review this post on the Software Carpentry blog, which compares Greg's attempt to teach online with these research-based best practices.

The following are the recommendations my responses to recommedations 3 & 4 of the research study, along with my thoughts and reactions to these recommendations and how to apply them to teaching young kids 8-16 programming:


3) Combine graphics with verbal descriptions. Combine graphical presentations (e.g., graphs, figures) that illustrate key processes and procedures with verbal descriptions.   

Here I think I do fairly well (although more with math than programming), in providing visual metaphors/analogies for concepts and on occasion creating animations that kids can play with. Where I need to improve is thinking about how to move them from the visual metaphors to working directly with the abstract.



4) Connect and integrate abstract and concrete representations of concepts. 

Connect and integrate abstract representations of a concept with concrete representations of the same concept.
So I can only think of one case where I succeeded at this, that is where I had the kids program themselves (they were the turtles who had to walk a square vs drawing one).  This worked well in that it helped teach the kids the need for precise formal language. 

Now one area I would like to try and I think fits this are the algorithmic sorting dances similar to this one: 



Wednesday, December 28, 2011

Organizing Instruction and Study to Improve Student Learning

I am taking a P2PU course:

One of our first tasks is to review this post on the Software Carpentry blog, which compares Greg's attempt to teach online with these research-based best practices.

The following are the recommendations of the research study, along with my thoughts and reactions to these recommendations and how to apply them to teaching young kids 8-16 programming:

1. Space learning over time. Arrange to review key elements of course content 
after a delay of several weeks to several months after initial presentation.
I would say I am not good at this, I tend to cram a lot of learning into a small period of time.  I need to think about this and how to incorporate review of key concepts.

2. Interleave worked example solutions with problem-solving exercises. Have 
students alternate between reading already worked solutions and trying to solve 
problems on their own. 
While I have thought about about providing kids "good literature" to read (aka, well written pieces of code) I rarely do it in practice.  Instead I try to find kids who write good code (or better code) and ask them to show that code to the class while complimenting them on what I see are the important lessons for all to learn from that code and the way it evolved.

For example I teach using the 40 mathematical shapes 
challenge from Barry Newell's Turtle Confusion (1988).  I first ask them to draw simple shapes triangle, rectangle, and pentagon.  These 
first few examples easily lead to a more generalized solution, which with some careful questioning or simply asking them to look at and compare and contrast their solutions, leads them to the "aha" moment of seeing a more general solution that solves all three shapes (and more).

Now how do you do this with "Free-Range Students" (not sure what is meant by that, but I assume students outside of a traditional classroom setting who are self learners) is a much harder challenge.  One possible method would be to do an "Etoy Challenge" type project.
"Etoys Challenge" is a Tutorial embedded in the Etoys image where a select set of scripting tiles are available and visible for the learner to solve a particular problem/challenge.  So after they complete the various challenges (drawing the triangle, square and pentagon), I could have the Etoy project show them their different scripts all on the same page to facilitate easier comparison.  I would then ask them "What's the same about these scripts and what is different".  Still not all kids will get this and a teacher/mentor to guide them would be needed.

Now the report did not mention (at least not in this section, but I guess they did in a way in other recommendations) what kinds of "worked examples" work best.  For example in their report they show a Worked Algebra problem:
Below is an example solution to the problem:
“Solve 12 + 2x = 15 for x”
Study each step in this solution, so that you 
can better solve the next problem  
on your own:
 12 + 2x = 15
      2x = 15-12
      2x = 3
       x = 3/2
       x = 1.5 
Now using Algebra as an example (because it is a lot easier for me to explain my point using an Algebra example than to come up with a programming example)  What I would do if teaching this and incorporating examples is to:

  1. Show there is more than one way to solve the problem.  "you don't really know something unless you know it multiple ways" - Marvin Minsky
  2. Make the invisible visible and highlight key concepts, such as balance and reduce to drive home that fundamental method. Here I might use visuals such as a balance scale.
  3. Provide opportunities for concrete practice in solving the problem (perhaps a virtual interactive showing a balance scale, with UI elements to add/subtract/... to the scale pans.

Items 2 and 3 are inline with recommendations in the report. I did not see item 1 mentioned and would be curious if there is research on this.

Hopefully we will learn in the class about some good worked programming examples we can use.

There are 5 more recommendations from the report which I will think about and blog about later, but why wait read the report, its well worth your time. 

Monday, December 19, 2011

Fraction Multiplication and Division Derivations

The following are from Alan Kay's derivations of Fraction Multiplication and Division (w/o Algebra)






Below is an excerpt from an email from Alan about the project:

Through the magic of how the Squeak VM and the Squeak image are done, this image from Disney times (before 2000) can be run today on a completely different Mac CPU and OS.

About 80% of the elementary school teachers I asked back then what turned them away from math said "invert and multiply". Schools have almost always introduced this as an article of faith in 5th or 6th grade. So it is quite incomprehensible and completely non-math.

If they waited for a few years, this can easily be derived by algebra. But they don't wait.

So I decided to try to do a completely iconic derivation (that is also a proof) that would be more in the 10 and 11 year olds' mental wheelhouse. 

I wanted to avoid algebra, and I also wanted to avoid having to use the "multiplication of fractions" rule. No one worries about this one because "it looks reasonable", but in fact it is the harder of the two relations. It was one of the triumphs of Greek mathematics.

So the division of fractions project directly derives the "invert and multiply" result without needing the multiplication rule.

The white arrow in the yellow explanation oval will go to the next step. I thought back then about being able to also run this backwards but didn't do it. Being able to freely go in either direction really helps I think, so this should be added.

There is a project link to a similar sequence that shows an iconic derivation for the more difficult and subtle multiplication of fractions.

I still think that fractional arithmetic and its understanding should be delayed -- but if schools don't have the wisdom and courage to do this, they should at least teach it -- and all math -- only via understanding, not via faith in a rule.

Cheers,

Alan

Monday, December 5, 2011

Fraction A Day - Fraction Multiplication

Today I revisited Fraction Multiplication adding controls to the Fraction Multiplication visualization to simplify modifying the fractions.  So that when you mouse over the fraction controls appear to allow you to modify the numerator and denominator.  I also played around with larger buttons to make it easier on touch screens, but that still needs some work.

I would also like to make it easier to facilitate comparisons, so kids can compare 2/4 x 2/4 with 1/2 x 1/2 etc.  The goal being to make the comparisons easy to make so they can focus on the fractions rather than the artifacts of making copies of fraction images.

Thursday, December 1, 2011

Etoys/Google Apps Integration takes 2nd place at Google Hackfest


Steve Thomas and Brett Schlueter 
A lot of fun at Google Apps Hackfest in NYC (although I thought it was a Google App Engine Hackfest and had to do some quick thinking to come up with a new project idea).  There's a lot to be said for having the API authors there with you to get you quickly over technical hurdles (special thanks to Vic Fryzel for his help).

We were able to use exported images from an Etoys book to create a Picasa Web Album and a Google Doc with images from the Etoys project, that could be commented on by the teacher.  We were also able to integrate this into Google App Engine to play a slideshow of the project pages and have a link to the google doc, so a teacher could comment on it, or the student could use it, to further describe the project.