Logo, a programming language with visionary ideas

buendiario-aprender-a-programar

Nowadays, computers are truly ubiquitous and accessible to children, e.g., iPads are used at certain kindergartens in Sweden. Could we leverage these computers to improve education, innovate on teaching methods, and help students at school? I firmly think that the answer is yes! The key relies on teaching children how to program computers, a mental and creative activity.

Recently, there has been considerable efforts to push computer programming to elementary and high schools. As a concrete example, I can cite the Computing at School initiative to promote programming at schools in the UK, which has Simon P. Jones (co-creator of Haskell) among its collaborators. Another relevant example is Pablo E. Martinéz Lopez, who is part of the effort program.ar to push programming at the public schools in Argentina. For that, Martinéz Lopez participated in the creation, design, and implementation of a new programming language called Gobstones.

mindstormsWhile randomly discussing about teaching programming at schools, a colegue of mine (Ezequiel Gutesman) pointed out to me the book MindStorms by Seymour Papert, one of the creator of Logo. Logo is a programming language for education created in the 60s, and while the book was firstly published in 1980 (and a second edition in 1993), I found the book’s principles and ideas still applicable today. Below, I briefly describe the most relevant insights I got from the book.

Computers should not program children

Nowadays, smartphone and tables are often loaded with applications designed to entertain children—in fact, parents use them as a sort of XXI century pacifier. Children quickly learn how to launch applications, overcome obstacles by leaning the tablet slightly to the right, switching between games with a push of a button, etc. It is a reality that children learn “the way of the computer” in no time. However, it is the computer that decides how children should interact with it. In other words, computers are currently indoctrinating, i.e., programming, our children. While knowing how to use computers is important, children should also be empowered to instruct computers to carry out tasks in the way that their imagination determines, i.e., without being limited or restricted by pre-established software and user interfaces.

No fear for programming

Another insight I found relevant in the book is the fact that teaching programming is an inclusive activity. If compared with learning mathematics, where students often feel that they either “got it” or “got it wrong” (a binary cruel classification), learning programming is about try and error. Students (and even professional programmers) do not often get their code free of errors in their first try. The fact that programming works like this makes a difference: students are welcome to try, after all, everyone is surely getting it wrong in the beginning. Students should not be scared of failing, the very nature of learning programming consists more about repairing code than getting it right at once.

Modularity as a necessity to repair code

A modular program is one that subdivides the code into smaller, reusable, independent parts called modules. For example, if you write a program that sells products online, the code could be divided into the modules to handle payments, to display products, and to administrate customers. Now, have you ever wondered how to teach a 10 years old kid such an advanced concept? In this matter, the book is enlightening: children should learn the value of modularity as an aid for debugging. Repairing a big chunk of code is indeed challenging, not only for children, but also for professional programmers. If the code is divided into modules, children can focus on repairing the errors related to a single module without having to understand the rest of the code found in the other modules—after all, a module is ideally conceived as a self-contained unit of code. By showing that modularity alleviates debugging, children have a practical and genuine motivation for writing modular code.

Formal thinking at a very early stagehistoria-logo-01

The book is built on the Piaget‘s principle that children create their own intellectual structure from the material they find around them—often referred to as culture. For instance, a child usually learns the properties of liquid when they pour it on the floor. The book states that children should be immerse in a “computer culture” that they are familiar with. In that way, children can build their own intellectual structures from an environment that they know. In the case of Logo, children are placed in a world where there is a turtle that moves in a two-dimensional plane and is able to draw lines while moving. The creators of Logo believed so strongly in this approach that the MIT lab, where Logo was thought, had a actual mechanical turtle—making the computer culture as concrete as it can be. Is this enough to learn programming? While it definitely helps, children should also develop formal thinking in order to be good programmers.

Piaget says that a child achieves the formal stage of reasoning if he/she achieves (1) self-referential thinking, i.e., thinking about how he/she thinks, and (2) combinatorial thinking, i.e., being able to enumerate all the possible states of a system. Self-referential thinking starts manifesting when children take their first steps in programming: they need to think how to teach (program) the turtle to draw the figure they imagine—this path makes children reflect on how they think. With respect to combinatorial thinking, Logo provides the concept of loops. A loop enables children to systematically repeat the turtle’s commands, e.g., a square on the screen can be drawn as repeating 4 times the following instructions: move forward the turtle 1 cm on the screen, and rotate the turtle to the right 90 degrees. To illustrate the power of loops, consider that you ask the children to deduce all the possible colors that can be obtained by combining Red, Blue, and Green. As a response to your question, they will most likely get stuck. However, asking the same question to children who know programming, their mind will probably conceive nested loops, where each of them iterates over the color palette in order to achieve all the possible colors. Although such program will have some errors (e.g., emitting duplicate colors), they would indeed solve the challenge by taking the notion of loops from their computer culture.

To conclude this post, I strongly encourage the reading of Seymour Papert’s book to any educator who teaches programming at schools. Actually, I would even dare to recommend it to teachers in first programming courses at Universities. The book is not only interesting from a historical perspective, but from the applicability and validity of its ideas today. Sometimes, it is good to revisit old ideas.

Advertisements

Programming as part of elementary schools’ agenda

1982 - Sinclair ZX Spectrum

Sinclair ZX Spectrum from 1982.

Some days ago, I found myself explaining to my sister, born in 1989, what home computers were and how I used to program them when I was 10 years old. In fact, I quickly downloaded an emulator of ZX Spectrum, my first computer, and showed her how to build a very simple program to compute the age of the user according to its year of birth. She quickly picked up some instructions of Spectrum’s BASIC programming language and realized how the program worked. When I asked her — didn’t you learn this stuff at school? She shacked her head and told me that she has never learnt something like we just did. As a computer scientist, her answer intrigued me and also made me curious about how informatics is taught in elementary schools. In particular, if children between 10 and 13 years old learn programming.

Why should be important to teach programming in elementary schools? Generally speaking,  computer programming is a purely intellectual activity that often requires reasoning and systematic thought — skills that can be easily translate to many other domains not directly connected with computers. Therefore, children’s analytic reasoning could be significantly  boost  by teaching them how to program regardless if they become professional programmers in the future. However, elementary schools seem to neglect such opportunity.

“It is not common to teach programming at elementary schools” says María Nelida Declerk, who has been an Argentinean teacher in informatics for 20 years.  Declerk emphasises that “New teachers do not know programming! Nowadays, lessons for children are oriented to play with the computer.” Declerk, different from other teachers, gives lessons on the LOGO programming language for students between fourth and sixth grade. She uses a version of LOGO that displays a turtle on the screen capable to move and draw lines with different colours. “It is impressive to see what students are capable of doing with LOGO. To command the turtle, children need to master four quadrants in Cartesian coordinates, while they have only seen one in the mathematics class! When introducing four quadrants, mathematics teachers note that children already master the concept and that is because they have been programming with LOGO!”

Book Basic for children (basic para niños) from 1984

As another indication that programming is not present in elementary schools, there seems to be a lack of books dedicated to teach programming to children. If fact, there seems to be only one recently published book in AmazonHello world! by Warren and Carter Sande, dedicated to teach programming to teenagers. Clearly, this situation is different from the one lived in the 80s, where there were several books written to teach programming to young students. As a 10 years old kid, I learned to program using a book with a sympathetic cartoon called Arturo (see picture), who was supposed to be of pedagogical importance for the young readers. The book covers several features of BASIC as printing on the screen, variables, inputs, branching, loops and comments. Surprisingly, these topics are also covered, with another intensity of course, by first informatics courses at certain universities. After studying 3 hours a week for two years, my class mates and me were able to finish the book. By then, we were modest BASIC programmers and only 11 years old.

I personally believe that one of the main reasons for not teaching programming at schools comes from the huge progress that informatics has been doing for the last 20 years. During the 80s, people needed to know the programming language BASIC in order to use home computers. Nowadays, computers provide beautiful and intuitive graphic interfaces that make easier to use them. I am not against progress. Nevertheless, I think that sometimes progress replaces some good traditions by not necessarily better ones.

Python LogoI consider that it is time to put programming as part of elementary schools’ agendas. However, to achieve that, there are several initial questions to answer. For example, what is the programming language that should be taught? What is the programming language that could play the same role as BASIC in the 80s? I personally believe that a good candidate for this task is Python. This programming language is very light-weight in syntax compared with other mainstream languages like C or Java. Children should not be distracted by remembering to place a semi-colon at the end of every instruction or to write the right class-hierarchy path in order to use a function. In addition to that, the dynamic features of Python make programs more compact and simpler, e.g. variable declarations or type signatures are not necessary. It would be also beneficial to rely on a good textbook to drive children’s  learning. Perhaps, adapting the contents of Basic for children for modern computers and the programming language Python is not a bad starting point. A simple and easy to learn programming language as well as a good textbook are a necessary combination to start pushing programming in elementary schools and benefit children from such a wonderful intellectual activity.