MIT Massachusetts Institute of Technology

From Psychology to Logic: Learning Computer Programming in the Kitchen

Tanzeela Ali
Student in Computer Science
Superior University
Lahore, Pakistan

This lesson focuses on the biggest problem faced by any young programmer - i.e. the LOGIC BUILDING required while solving a particular problem. With programming, the solution to a particular problem lies in the head, but one is unable to convert it into a computer program. This is because the thought processes of a human are much faster than the sense of observation. If this thought process could be slowed down, logic to solve a programming problem could be found very easily. This lesson focuses on converting this psychological thought process in a step-by -step logic fashion that a computer program can understand. This lesson is recorded in a kitchen where the basic programming concepts are taught by giving examples from the process of making a mango milk shake. This lesson teaches the 4 following techniques: 1) Swapping two variables by swapping a glass of milk with a glass of crushed ice; 2) Finding max from an array by finding the biggest mango; 3) Sorting an array by arranging the jars; and 4) Understanding the concept of a function, parameters and return type by comparing it with the blender/juicer. The lesson targets those students who know the syntax of programming in any language (C or GWBASIC preferred), but are unable to build the logic for a program. It can be taught in a class of 45 to 50 minutes.


这节课聚焦在任何一个新手程序员可能面临的的最大问题-例如,当解决一个具体问题时所需要的逻辑构建。编程时,一个具体问题的解决方案基于头脑的思考,但是,人们却不能把它转化为计算机程序。这是因为人脑的思考过程要比感官观察快得多。如果思考过程能够慢下来,用来解决编程问题的逻辑就会很容易得出。这节课的重点在于把思考过程转化为电脑易于理解的一步一步的逻辑形式。这节课在一间厨房里录制,在那里,以制作一杯芒果奶昔的过程为例,来讲解基本的编程概念。这节课教授了以下四个技能:1)通过交换一杯牛奶和一杯碎冰的例子来学会交换两个变量;2)通过找出最大的芒果来学会在一组数中找出最大值;3)通过排列罐子来学习排列一个数列;4)通过和搅拌器/果汁类比,理解函数,参数,和回车命令的概念。这节课所针对的是那些了解任何语言(最好是C or GWBASIC)的编程,但是对于程序的逻辑构建有一定困难的学生。这节课可以在45-50分钟内完成。


Tanzeela is a student majoring in Computer Science at Superior University in Pakistan. Learning and teaching are her two most favorite jobs. She loves programming and mathematics and currently works as an associate software engineer at "i2c inc".

Tanzeela是巴基斯坦苏比略大学计算机系的一名学生。她最喜欢的两件事就是学习和教书。她喜欢编程和数学以及目前她在"i2c inc"作为一名副软件工程师所做的工作。

Scratch is a project of the Lifelong Kindergarten Group at the MIT Media Lab. It is designed especially for ages 8 to 16, but is used by people of all ages. Scratch helps young people learn to think creatively, reason systematically, and work collaboratively — essential skills for life in the 21st century.

At Khan Academy, students can use the Academy’s programming environment to build graphics, animations, and interactive visualizations. The site contains many tutorials on how to program.

This site is provided by Lifehacker and presents the lesson, Learn to Code Part 3: Arrays and Logic Statements


Scratch 是MIT 多媒体实验室终生幼儿园组的一个项目,它专为8到16岁的人群设计,但是可以被各个年龄的人使用。Scratch帮助青少年学习创造性思维,系统性推理和团队协作精神——这些21世纪生活的基本技能。


这个网站由Lifehacker提供并呈现了一节课,学习编程Part3: 数列和逻辑语句。

Add A Comment
By submitting this form, you accept the Mollom privacy policy.

This Lesson is in the following clusters: Computer Programming