Friday, November 23, 2012

The Future Face of Code (is Now)

In my eyes, one of the greatest obstacles in learning to code is the problem of the 'delayed response.' That is, a programmer has to envision what their code will do while writing it, and only after writing a good portion of the program can they see the result. Projecting the effects of the code you write becomes an essential skill in programming, but only gained after sufficient experience.

This makes learning to code tough and learning syntax like learning a foreign language (fun fact: Columbia School of Engineering accepts a CS class as the foreign language requirement). Instantly seeing the result of using a function instead of memorizing its purpose would be a much better way to go.

Very recently, a couple websites have started attempting this, most practically, the famous Khan Academy. Their introductory video for learning CS outlines a very different approach to online CS education, one that has finally started to customize a learning environment for the subject. In this case, instead of supplying lectures and expecting the student to work through the examples on software meant for seasoned programmers, the website built the entire programming interface into the website. Not only does the example code come with a voice explanation of everything, but changes in variables and lines are instantly reflected on the canvas to the left.
http://www.khanacademy.org/cs/1-welcome-to-codecanvas/882454257
To me, this looks like the beginning of a great approach to teaching programming.

However, the man (Bret Victor) who is cited as inspiration for this approach disagrees with it strongly with it:
http://worrydream.com/#!/LearnableProgramming
His argument outlines an entire mindset towards programming. He rejects Khan Academy's explicit encouragement of the 'play with this, see what it does, and that's learning' approach to teaching to code. Instead, "programming is a way of thinking, not a rote skill" conveyed through teaching simplified versions of Javascript. He proposes that instead of helping a student learn what a function does, the purpose of the function should be clearly labeled. Not only labeled, but easily stepped-through, the hidden data should be easily visualized, and programming flow should be explicit. For concrete examples, see the link above.

This shifts the focus of learning to code from learning a foreign language's words to understanding underlying ideas. There is no concrete proof that simply teaching syntax like Khan Academy doesn't force students to think in the abstract way Bret Victor wants them to, so this subtle difference remains a split in ideology.

One point Victor makes that I completely agree with is the constant desire to simplify programming languages ('Englishify programming') for the students, with the assumption that programming is hard because it looks so alien. Changing syntax to look more like natural English is not a solution for teaching CS; it's just an attempt to skip the teaching process and also built on the assumption that the 'words' in code are foreign and learning them constitutes learning CS. One thing the human mind is good at is remembering a small number of names--the difficulty here is teaching how and why to use them.

As a final note, I attach Victor's talk that inspired Khan Academy. It's an hour long about the interactive coding interface he made.
http://vimeo.com/36579366
The first segment is similar to Khan's demonstration of interactive code, but the program he shows between 11 and 16 minutes into the lecture blew my mind. He makes Mario. Go, watch it. I can't explain it in words nearly as well as actually seeing it. The latter parts delve into abstract programming (minute 16-23), applications to engineering diagrams (23-28), how computing as we know it is vestiges of its monitor-less ancestors (28-30), intuitive animation (30-34), and more abstract implications (the rest). I recommend listening to the parts related to your interests--it might be its future.