Children and Programming: a Learning
Author: Abhay Bindumadhav Joshi (abjoshi@yahoo.com)
Date: 28 June 2009
References:
In the article Children and Computers we saw how interesting objects with embedded knowledge can facilitate children’s learning process. We reviewed some of the deficiencies in the traditional school system, especially pertaining to learning Math and Physics. Finally, we hinted at how computers can be a great educational tool to overcome these deficiencies.
In this article, we show that children – as computer programmers – can unleash their learning process and creativity in any intellectual domain.
We saw that the characteristics of a good solution to the learning problem are as follows:
1. The aptitudes theory is a cultural problem, and can only be fixed by allowing children to “enjoy” subjects like math, physics, and grammar.
2. In addition to, or perhaps with less stress on, facts and skills, school education needs to be enabled to deliver on “understanding and appropriation of concepts” and “learning how to learn”.
3. The problem of dissociated learning needs to be solved by creating connection with a sensible purpose and their personal experiences. This can be achieved by providing appropriate objects as models for learning.
We will show below that our proposed solution helps with all of the above requirements.
We will demonstrate the ideas using the Logo Programming Environment.
The main thesis of this essay is that there is an approach in which Computers can have a positive impact on the way kids learn. In this approach, the child programs the computer and develops direct access to its tremendous capabilities.
Let’s first get introduced to Logo.
Programming in Logo allows you to express your creativity in many forms: mathematical, visual, verbal, or musical.
The Logo environment attempts to reconstruct the math learning instead of trying to teach existing school stuff.
It adopts 3 principles:
Logo is an interpreted language and its syntax is simple. It allows the learner to build his vocabulary without getting mired in the complexities of syntax and grammar. In Logo, learning to program isn't the goal; the goal is to learn geometry, or logic, or grammar. Programming helps in the learning, and it helps make the learning endure for the student.
The Turtle in Logo is an object that children can easily relate to and utilize to build all sorts of intellectual models. Programming involves manipulating the Turtle. Children can invent new commands. When they explore and experiment they learn.
With the forward, back, right, and left commands, children are able to identify with the Turtle, and are able to bring their knowledge of their own bodies to manipulating the Turtle.
Here are a few simple
examples that you should try in the Logo environment.
The Turtle allows children to appropriate every new bit of knowledge as their own, because they can actually play turtle themselves by imitating its travel.
Logo commands are simple; there is no complex procedure to run them. Also, you get immediate response to each command. This makes it easy to increase the pace of communication, fix problems, etc.
The environment is clearly entertaining for children.
Educational books and TV programs (like Sesame Street) offer better explanations or pieces of knowledge, but the child remains a passive listener and is forced to accept what they offer. As a computer programmer, he is active and self-directed. The computer becomes his source of power. When the child is commanding the Turtle to do this and that, he is in charge of his own learning.
In Euclidean geometry, a point is something with no dimensions – a concept that children find hard to appropriate. The Turtle, on the other hand, is an object with properties: thickness and heading.
Children discover a lot of things:
- moving in space
- basic concepts like: point, line, and angle
- circle is a polygon with a large number of tiny sides
Next, children can apply their learning to draw a bit more interesting drawings: in this we show point star, flower of polygons, concentric squares, and fireworks.
With the knowledge of the REPEAT procedure, children take one step in increasing their power. REPCOUNT and RANDOM create further interesting possibilities.
Next, we show how children can create complex drawings by breaking it down into smaller problems. Children learn that it is better to use a structured approach, i.e. write smaller programs to make the big one.
Run the project of drawing a
garden.
Computer allows projects of growing complexity, the likes of which are unintelligible with physical objects or people. Thus children can get a better feel for complexity and how to deal with it.
Peacock feather is
another example of how through the use of simple commands like FD, RT, REPEAT,
SETPC, SUM, PRODUCT, etc. one can draw amazing graphics.
This approach of breaking down a big problem into smaller ones works for many real-life challenges. For example, the book “Mindstorms” shows an application of this approach to a problem in physical activity: the act of juggling.
One of the biggest obstacles in school education is the lack of connection children see of what they are forced to learn, without any sensible purpose.
The movements of the Turtle are a natural extension of our own physical experience, and hence geometry suddenly becomes more sensible. Children also sense that lines and angles are the basic building blocks of a lot of geometry out there.
Working with the computer offers the following advantages related to the act of thinking itself:
In schools (and even in adult life) we get things either ‘right’ or ‘wrong’. But the truth is people rarely hit upon the right solution in their first attempt. In programming, it is rarely this black and white: programming involves incrementally improving a solution through debugging. For these children, a solution is not wrong; it just needs to be debugged. This positive approach is much more conducive to building confidence and solving problems than the ‘right and wrong’ approach.
Children with programming experience can employ the powerful debugging technique to improve their real-life solutions. ‘Mindstorms’ demonstrates this for the case of learning to juggle.
Every time a child wants the computer to do something, he has to first reflect on his own thinking, and then ask the computer to do it. It is like opening up the hidden powers of our mind. This knowledge of how our mind works, and the continued habit of analyzing one’s thinking (sometimes called critical thinking), together can become great intellectual tools for future problem modeling and solving. This is the greatest benefit of computer programming.
Critics fear that children will adopt the mechanical way of thinking from computers. On the contrary, the “mechanical” way of thinking can become an additional tool in the children’s tool chest. In fact, the understanding of the “mechanical thinking” of computers adds a degree of intellectual sophistication to children’s capability as learners. It’s a magical discovery that there can be different “styles of thinking”.
School arithmetic is essentially about learning a variety of procedures.
A child with programming experience is already familiar with writing, manipulating, and debugging procedures. He will obviously have less difficulty dealing with the procedural aspects of arithmetic. Instead of growing to hate arithmetic, he is likely to be comfortable with it.
Computer programming offers an additional method of learning, not a replacement to existing techniques. Arranging colored beads in a combinatorial manner is, for example, a difficult problem for kids all the way to 7th grade. But with programming knowledge, he can simply write two nested loops to solve the problem.
There is really no end to the possibilities the power of computing offers. The following is just a sample of concepts the child might stumble upon as he explores (with the guidance of a teacher) the Turtle micro-world further. The actual exploration is described within the paragraphs where applicable.
Recursion is another powerful idea that shows how one can harness “infinity” for useful purposes.
Try out the recursion
examples.
You can even introduce children to the basic concepts of animation.
As we saw earlier, children discover that the circle is nothing but a polygon with a large number of sides. This realization has powerful impact on their intuitive responses to problems involving “circularity”. This example is covered below.
See how using the Logo Turtle children can grasp the idea of ‘curvature’.
Some people fear that programming is too complex for children. These are the same people, by the way, who are afraid of Math! Programming means communicating with the computer. Children are good at learning languages. They would naturally be comfortable learning to program, given that the following conditions hold true.
Just like learning a new language is better done by living among people who speak that language, learning to program can be made easy by allowing free access to computers.
The choice of the programming environment is critical. Children must love to program. The programming language brings with it certain metaphors, images, and ways of thinking. So the choice of the first programming language must be done extremely carefully. Some schools teach programming languages like BASIC or Java. BASIC is just plain outdated (see the QWERTY phenomenon), and Java is geared more for software engineers. Neither is a suitable medium for children to communicate with the computer in a personable, comfortable, and powerful way to enable learning as discussed in this essay.
Environments like Logo have achieved great success in capturing children’s attention and imagination. From the programming examples thus far, it should be clear that Logo is not only a language that children would happily lap up, but it also provides the right set of capabilities that can create a learning environment which can succeed in “achieving a positive impact on children’s education”.
Many times, learning involves grasping new concepts for
which children have no pre-requisite knowledge that they can rely on to
transition from and be able to appropriate the new one.
We can construct computer micro-worlds for children, which fill this void. The static Turtle in Logo, for example, can be made dynamic by giving it the velocity parameter, and the command setvelocity can set its initial state. The concept of force can be introduced by a command changevelocity. And so on. A child that has played in such a “physics micro-world” won’t fill the void of unfamiliarity when he faces the Newtonian concepts.
Micro-worlds – which are essentially programming environments with a set of related objects, can, thus, be used to develop these pre-requisites which are non-existent in the child’s physical world experience.
Intuition plays a big role in problem solving. Computing experience can help improve your intuitive responses, or at least help to grasp quickly where your intuition went wrong.
For example, let’s say a rope has been tied around the planet earth’s surface such that its ends meet. If it is to be raised by say 10 feet, how much extra rope would be needed to ensure the ends still meet? Our intuition usually tells us that the extra length will be “a lot”. But a simple calculation tells us that it is actually only 2*pi*h (here h being 10 feet). Thus the answer is completely independent of the size of the object around which the rope is being tied. This revelation is surprising and contrary to intuition for most. But this reality can be intuited (or reconciled with our intuition) if we first consider a square earth. In this case the raised rope runs parallel to the edges and goes in round fashion around the corners. Thus the extra length clearly is only that required for the corners – which is 4 quarter-circles, which in turn is 2*pi*h. If you extend this to a bigger polygon, say an octagon, it turns out to be the same, i.e. the length of a circle whose radius is h. Now, someone who has had experience with the Logo Turtle knows the equivalence of a circle with a polygon (with a very large number of sides). So he can relate to the ultimate answer that the extra length around the earth would also be 2*pi*h.
The same strategy, in fact, works for the puzzle in which we are told that it takes 2 rotations if we roll a penny around another one. This, again, is contrary to our intuition which tells us that the answer would be 1 rotation. Here again, if you start with a problem of rolling a penny around a “square penny” you realize that the rotation around the 4 corners adds an extra 360 degrees. Moving on to larger polygons, and ultimately to a circular penny, the fact remains unchanged.
Based on the above essay, we can reach the following conclusions:
This section shows the basic Turtle commands, drawing simple shapes, and extending a polygon to a circle.
Erase
"shift
To shift :x :y
Pu fd :y rt
90 fd :x lt 90 pd
End
Setpensize 2 CS shift 0 100
FD
100 RT 120 FD 100 RT 120 FD 100 RT 120
Shift
200 0
Setpc 2 FD 100 RT 90 FD 100 RT 90 FD 100 RT 90 FD
100 RT 90
Erase
"englishH
To englishH :size
FD :size BK quotient :size 2 RT 90
FD quotient :size 2
LT 90 FD quotient :size 2
BK :size
End
Shift
-350 0 setpc 3 englishH 100
erase "shapeT
TO shapeT :size
FD :size RT 90 FD :size/2.5 LT 90 FD
:size/5
LT 90 FD :size LT 90
FD :size/5 LT 90 FD :size/2.5 RT 90
FD :size
LT 90 FD :size/5 LT 90
END
setpc 3 shift -200 0 shapeT 100 setpc 7
Shift
0 -180 setpc 4 REPEAT 6 [FD 75 RT 60]
Shift
300 0 setpc 5 REPEAT 360 [FD 1 RT 1]
setpc 6 REPEAT 720 [FD 1 RT 0.5] setpc 5
This section shows the power of REPEAT, REPCOUNT, and RANDOM. Then it shows how to use the "divide and conquer" technique.
Erase
"PointStar
To PointStar :raysize :nrays
Repeat :nrays [
FD :raysize BK :raysize
RT quotient 360 :nrays
]
End
Cs
shift 0 50 setpc 9 PointStar
75 50 setpc 7
Erase
"square
To square :size
repeat 4 [fd
:size rt 90]
End
Shift 200 0 REPEAT 8 [RT 45 square 50]
Shift 50 150 setpc 8 REPEAT 10 [RT 36 square 50]
Shift 0 -300 setpc 9 REPEAT 40 [RT 9 square 50]
Shift -500 0 setpc 10 REPEAT 10
[REPEAT 360 [FD 1 RT 1] RT 360/10]
ERASE
"ConcentricSquares
To ConcentricSquares :startSize :stepSize
:N
REPEAT :N [
square SUM :startSize
PRODUCT REPCOUNT :stepSize
PU BK :stepSize/2 LT 90 FD
:stepSize/2 RT 90 PD
]
End
Shift 0 225 setpc 11 ConcentricSquares 5 10 20
;fireworks
Cs
REPEAT 30 [
PointSTAR SUM 5 RANDOM 50 SUM 20
RANDOM 50
; SHIFT SUM 200 RANDOM 300 SUM 200 RANDOM 300
PU SETXY RANDOM 1000 RANDOM 1000 PD
SETPC RANDOM 15
]
First we need the quarter circle procedure. It will essentially be a modified circle procedure in which the angle would be one-fourth of a circle.
Erase "qcircle
to qcircle :size
repeat round
:size [fd 1 rt 90/(ROUND :size)]
end
cs shift
0 100 qcircle 200
A petal can be
drawn by:
Erase "petal
To petal :size ; size is the length
Qcircle :size
Right 90
Qcircle :size
Right 90
End
Pu home
Shift 200 100 petal 200
A flower can be
drawn by:
Erase "flower
To flower :size :color ;length,
and color
Setpc :color
Repeat 10 [Petal :size Right 36]
End
Shift -100 -200 flower 100 7
A plant can be
drawn by:
To plant :size :height :color ;
size: length of each petal,
; height: of tree, color of flower
Setpc 8
Forward quotient :height 2
Setpc 2 Petal :size
Setheading 0 ; the petal doesn’t fully cover 360 degrees
Setpc 8
Forward quotient :height 2
Flower
:size :color
Setheading 0 ; the flower doesn’t fully cover 360 degrees
Pu back :height pd ; come back to the
ground
End
Shift -300 0 plant 80 200 6
A garden can be
drawn by:
First we will use a procedure
called slide to change the starting position.
Erase "slide
To slide :distance
Penup
Right 90
Forward
:distance
Left 90
Pendown
End
Now the garden procedure:
Erase "garden
To garden
Pu Setxy -250 -200 pd ; start from
the left corner
Plant 100 300 1
Slide 100
Plant 50 150 2
Slide 100
Plant 80 240 3
Slide 120
Plant 125 375 4
Slide 100
Plant 50 150 5
Slide 100
Plant 50 150 6
End
cs garden
First a procedure to draw quarter circles:
Erase "qcircle
to qcircle :size
repeat round
:size [fd 1 rt 90/(ROUND :size)]
end
;Next, a procedure to draw petals:
Erase "petal
To petal :size ; size is the
length
Qcircle :size
Right 90
Qcircle :size
Right 90
End
Finally, instructions to draw a flower of peacock feathers:
CS HT ;hiding the turtle makes the
drawing faster
repeat 5 [
Setpc 2 Repeat 10 [petal
sum 50 product 5 repcount]
Setpc 13 Repeat 30 [petal
sum 125 product 5 repcount]
RT 360/5
]
This essentially involves
drawing longer line segments after every right turn.
Erase "spi1
To spi1 :n
Repeat
:n [FD repcount*5 RT 90]
END
Spi1 40
Looking closely, we see that the turtle is doing the same work but just with a slight change in values. So a recursive procedure might do the job:
To spi :distance
Fd :distance
Right 90 Wait 5
Spi sum
:distance 5
End
cs spi
5
This will start an infinite drawing of a square spiral.
If you change the angle a bit, you get different patterns.
Erase
"spi2
To spi2 :distance
Fd :distance
Right 89 wait 5
Spi2 sum :distance 5
End
cs spi2 5
This uses recursion to draw a Christmas tree.
Note: The angle of the branch goes on reducing for every successive level.
level is the depth of the tree, size is the initial length of a branch,
ang is the initial angle with the main branch.
Note: Before showing this demo, move the starting position to the bottom of the screen.
Erase
"ctree
To ctree :size
:level :ang
if :level<1[stop]
setpensize se :level :level fd :size
lt :ang
ctree .5*:size :level-1 :ang-12
rt :ang
ctree .7*:size :level-1 :ang-12
rt :ang
ctree .5*:size :level-1 :ang-12
lt :ang
setpensize se :level :level bk :size
End
cs setpc
2 pu setxy -300 -100 pd ctree 100 2 70
wait 60 pu setxy -100 -100 pd ctree 100 4 70
wait 60 pu setxy 180 -100 pd
ctree 100 7 70
setpensize 2 setpc
7
ERASE "ftree
; VERSION 3
; In this, we remove the last pair of sub-branches because
its size
; is 0. We also add a thickness factor that reduces at
every level.
To ftree :size :level
IF :level<1
[STOP]
IF :size<=0
[STOP]
REPEAT 10 [
SETPENSIZE SE :level :level
FD :size/10
RT 70 ftree 0.33*:size*(1-REPCOUNT/10)
:level-1 LT 70
LT 70 ftree 0.33*:size*(1-REPCOUNT/10)
:level-1 RT 70
RT 5
]
PU REPEAT 10 [LT 5 BK :size/10]
PD
END
cs HT setpc 10 pu bk
200 pd
pu lt 90 fd 300 rt
90 pd ftree 500 2
wait 60 pu rt 90 fd 250 lt 90 pd
ftree 450 3
wait 60 pu rt 90 fd 250 lt 90 pd
ftree 500 4
ERASE "5.star
TO 5.star
:SIZE
REPEAT
5 [FD :SIZE RT 144]
END
;Draw a star at the given location, C is from 1 to 15
ERASE "draw.star
TO draw.star :R :C
; using
R we computer a location
PU
HOME SETXY PRODUCT :R 900 PRODUCT :R 1000 PD
SETPC :C
5.star 25
END
;draw 30 stars
Cs SETPENSIZE 2
REPEAT 30 [draw.star REPCOUNT SUM 1 RANDOM 14]
FOREVER [
draw.star RANDOM 30 SUM 1 RANDOM 14
WAIT
2
]
Draw a circle using:
Repeat
360 [forward 1 right 1]
and explain that it has a constant curvature.
How do we reduce the curvature? As the turtle turns less for the same forward motion, it is moving in a reduced curvature. In the following program we draw a curve with gradually diminishing angle, and see what we get.
Choose color blue, and thickness 2.
To r_c :steps
:change
Local "angle
Make "angle 5
Repeat :steps [wait 1 fd
1 rt :angle make "angle product :angle :change]
End
cs setpensize
1 r_c 600 0.996