Monday, April 16, 2007

Edu-Python: Python's Killer App?

DRAFT of an ARTICLE

IS EDUCATION PYTHON'S KILLER APP?


SALIENT QUOTATIONS

"Should the computer program the kid, or should the kid program the computer?"
- Seymour Papert

"We want to explore the notion that virtually everybody can obtain some level of computer programming skills in school, just as they can learn how to read and write."
- Guido van Rossum

"Python makes too much sense as a learning language to not ultimately have an effect in the education arena."
- Arthur Siegel

"If schools won't accept classes that have Python in them, then it doesn't matter how much better Python is than BASIC, the classes cannot be taught."
- Dean Nevins

PYTHON IN EDUCATION

If learning is about information, then surely learning will change somewhat under the influence of pervasive information technology.

This is an exciting time for those of us who believe that software development in general, and Python in particular, has a role in general education. Three of the four keynotes at PyCon '07 revolved around the idea of computing as a medium for education and/or communication. Adele Goldberg talked about the frustrations of getting carefully designed computational curriculum into the public school systems. Robert "rOml" Lefkowitz talked about code as a communication medium. Finally, on a more practical note, Ivan Krstic discussed the very exciting prospects of the One Laptop Per Child project, whose modest goal is to make computing available to all children everywhere.

These discussions gave a boost to the quiet world of educational Python. It seems like a good time to take stock of the entire educational programming landscape and Python's role in it.

COMPUTER LITERACY

In the early days of computing, it became apparent that computers would become ubiquitous and part of daily life. At that time, we had little idea what shape they would take in a generation.

I recall an episode of the futuristic TV news program "The Twentyfirst Century", hosted by the renowned Walter Cronkite, that discussed the implications of home computers. A professor's family had a massive mechanical teletype (a terminal that used a typewriter mechanism rather than a CRT or LCD display) in their home. The demonstartion application was, as I recall, changing the proportions in a recipe so that it served seven rather than four. I am sure it was a great tangle of Lisp under the hood and no great pleasure to use, but it appeared that if you perservered a recasting of your recipe with all the quantities multiplied by 7/4 and converted to standard cooking units loudly clanked out onto the fanfold paper. At the time, the 21st century was promoted in the media to be an almost flawless utopia, but even so one had the sense that both Cronkite and the professor's wife were struggling to express any enthusiasm for the concept of home computing.

If you think about what "computer literacy" means today in high schools, trade schools, and nontechnical programs in university, though, you'll see that it amounts to recipe scaling writ large. Mass market software presents complex and often counterintuitive user interfaces, and the skill of navigating through each of them is valued and promoted.

PROGRAMMING FOR CHILDREN

Of course, we do need to be able to cope with applications. Still, there have always been two visions of computing, one as a world in which there is a very sharp distinction between producers and consumers of software, and another where the continuum is blurred.

The alternative vision of computer literacy was formed by the early users of computers. In those days, there were no "applications". Being a computer user amounted to being a programmer. Many of us felt that the skills we learned by wrestling with the structure and logic of a program would be applicable to many aspects of life. We felt that the advantages we were getting could be democratized. In this view, "computer literacy" was about coding, not about being able to push a mouse around and click on things effectively.

This view is succinctly summarized by Georgia Tech Professor Mark Guzdial's comment on a blog page: "computing FOR learning (as opposed to learning ABOUT computing".[1]

Seymour Papert (with Willy Feurzig) developed Logo[2], the original "learning language in the late 1960's. The ideas of Logo were explicitly based on developmental psychology[3]. Papert not only claimed that remarkably young children (fourth graders, about 9 years old) could be exposed to the ideas of programming, he was successful in demonstrating this. Many subsequent teaching environments have been based on Logo, and especially on the observation that "turtle graphics" were a uniquely compelling development target for novices) the basic idea has not been as successful as Papert envisioned. (It's interesting to contemplate the fact that it was less expensive to construct a mechanical turtle than a graphic display in those days!)

Alan Kay is another key figure in the computing for learning movement. His 1971 "Dynabook" paper[4] is a remarkable exposition of the possibilities of computing from a time long before anyone actually had so muchas a portable display. Kay and Papert are still with us as I write (although, unfortunately, Papert was seriously injured recently), and among their recent efforts, along with Nicholas Negroponte, is the One Laptop Per Child initiative[5], where Python plays a key role, and which largely revives the Dynabook idea.

COMPUTING FOR NOVICES

Despite the strong advocacy of the likes of Papert and Kay, there is no consensus on whether most people can and should learn a modest amount of programming, nor what age is best to start. Still, we can agree that *some* people will become programmers, and they have to start with *some* language.

Among the most famous quotations attribute to the great computer scientist Edsger Dijkstra are critiques of teaching computer science with inappropriate languages, notably that "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense" and "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." Many people have taken DIjkstra's advice to heart, and designed languages intended to expose young adult students to good practice and good theory from the beginning. Pascal and Smalltalk are probably the most successful examples.

Another effort in this direction was the ABC programming language project of Geerts, Meertens and Pemberton at Centrum voor Wiskunde en Informatica in Holland. They list advantages of ABC in comparison to Pascal as 1) small, intuitive syntax 2) maps well onto design principles 3) terseness 4) support for refinement 5) no declarative statements and 6) interactive [5]. Along with these good ideas the CWI group had the inspiration to put the young Guido van Rossum on staff, and it is here that the Python story begins.

While much of the history of the Python community remains an oral history, we do have the following quote from Guido: "Over six years ago, in December 1989, I was looking for a 'hobby' programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers." [6] Python, then, is a combination of a well designed learning language and a practical scripting language.

COMPUTER PROGRAMMING FOR EVERBODY

Once Python had attained a certain momentum, Guido van Rossum under the auspices of the Corporation for National Research Initiatives applied for and received a small grant to support a project called Computer Programming for Everybody of CP4E, to investigate democratizing programming. The project was funded for a single year, half the anticipated duration, through DARPA. Guido and much of the core development team moved into the for-profit sector at aboutr that time as well. The proposal [7] lists broad objectives of developing high school and college curriculum, developing tools, and developing a user community, as well as many subcomponents of these objectives.

The motivation section is in the intellectual lienage of Papert and Kay:

===>
If we are successful, non-experts will be able use their computers and other intelligent devices much more effectively, reducing their level of frustration and increasing their productivity and work satisfaction. (New leisure possibilities will undoubtedly ensue as well!) Computer users will be able to solve their own computer problems more often, reducing the need for technical support.

Even if most users do not program regularly, a familiarity with programming and the structure of software will make them more effective users of computers. For example, when something goes wrong, they will be able to make a better mental model of the likely failure, which will allow them to fix or work around the problem. They will also be able to assess better when they can make the changes themselves and when they will need the services of an expert. They will be more able to converse with experts, since they will now share more of a common language. An analogy is obtaining basic literacy in automotive maintenance: you know enough to check your oil and add a few quarts if necessary, but you also know that you shouldn't try to change your own brakes. When the mechanic says "your rotors are warped and you need new pads," you understand what he is talking about.

If this effort is successful, there could be many millions, eventually billions of computer programmers, at various levels of proficiency. The effects this will have on the state of the art of software development is hard to imagine. The nature of software will change to accommodate the needs of these programmers, allowing customization through source code modifications--and personalizations will be plentiful.
<===

The funded CP4E project's principal achievement, was developing the IDLE system. This is not to be minimized, as IDLE remains the development platform of choice for beginners in many contexts.

Still, it must be admitted that many of the goals of CP4E remain unfulfilled to this day. The SIG that was centered on the project, while hosting many fascinating discussions, lost focus. Until recently, a fairly large number of fairly small projects were developed in and around the cluster of ideas that motivated CP4E and the edu-sig. Efforts to create a directory and a repository for this work have so far failed to reach critical mass. There appears to be a cat-herding problem, with each enthusiast having his or her own individual goals. That said, a great deal of fascinating work has been and continues to be happening, and quite a few young people have been exposed to Python as their first programming language and environment. Perhaps even more importantly, the mission of CP4E, and Python's role in it, has been an active goal for quite a few people in the intevening seven years.

The sidebar attemps, and surely fails, to be an exhaustive list of Python related education projects. It includes projects where Python is or has been used to develop a domain specific learning language or learning tools, or where Python is used as the language of discourse in teaching programming, or in using programming to teach other topics. It is limited to resources aimed at novice programmers who are not necessarily going to become technical or computing professionals.

WHY PYTHON?

Pulling together these Python as a First Language/CP4E experiences, formalizing them, and making a case for them in educational settings, remains somewhat
elusive. If we accept Dijkstra's admonitions that a first computing language is important to the inetllectual development of the student, it seems to those of us who appreciate Python for what it is. It's arguably our responsibility to get beyond "we like it because it is good" for the non-Python audience.

The Python community knows what it likes and is amazingly verbose and articulate in discussing this or that programming construct, but we have never been particularly adept at explaining our vision to those who have not experienced it. In researching this article, I made some effort to get Python First enthusiasts to explain the basis of their enthusiasm in the context of the novice programmer.

===
MORE
===


AUDIENCES AND OBSTACLES

In discussing the future of Python as a first language, we need to distinguish between several populations of novices:
1) a child working with a parent or other adult
2) a child working alone
3) a child studying a formal course in school
4) a college student studying a formal course
5) an adult seeking to achieve some personal software goal

These audiences have distinct constraints and distinct objectives. It seems clear that, except for very young children, foe whom a limited environment such as eToys or Alice may be of great value for more than a few weeks, Python is clearly a viable choice.

Python's competitive position is weakest in the second and third categories, for quite distinct reasons.

In the case of a purely self-motivated child, the child's immediate objective is to do something cool on a web page and email the URL to friends and family. Python is, of course, a very powerful weapon in the hands of the experienced programmer, especially in combination with the vast alphabet soup of frameworks and libraries available. Unlike the core language, though, this power does not scale down to simple applications. Most mass market ISPs do not support Python CGIs, and certainly don't support the likes of Twisted or mod-Python. Also, the libraries and frameworks, though powerful, are conceptually inaccessible to the novice. To the extent that frameworks like Django are easy to use, they probably move far away from Dijkstra' concepts of a pedagogically useful language, and at the extreme Zope/Plone is more of a bureaucracy than a development platform. Compare this with the ease of use and remarkably complete and accessible documentation of PHP, or the zero barrier to entry of Javascript, and we lose the budding web program to pedagogically less valuable languages. Perhaps we needn't worry about the self-motivated young programmer, though. Through their enthusiasm they will learn the limitations of their platform, and eventually move to Python or a similar language. As a youth I programmed in uglier things than PHP and yet lived to tell the tale.

More of an issue is the school. Adele Goldberg's PyCon keynote was largely a lament about trying to work within the US public school systems. She is giving up on it as a primary goal of her efforts, for a sad litany of reasons. Although her root causes were familiar to me (too much politics, too much fear, no room for experimentation), despite her sad tale she missed a couple of points that are relevant to adding a computing language to the curriculum that would not agitate the good Dr. Dijkstra. First of all, computing (except for advanced placement) is considered a vocational pursuit, not an intellectual one! This madness is endemic; Jeff Elkner's diligent pursual of all that is Pythonic within a public school system in Virginia all occurs in the context of a vocational track. Python is considered in competition with VBasic in this context. For college-bound students, Java has become the language of choice as a conseqeunce of the structure of the Advanced Placement examinations. (Everyone seems to agree that this is a pedagogical imporvement over C++, which presumably was as baffling to the teachers as the students.) The consequence is that despite the enormous scale of the school system, which would allow for rigorous experimentation and improvement, most schools are stuck teaching Java and VBasic.

In the home or the college, these constraints are not operative. Python First continues to gain momentum in these settings.

ENTER OLPC

Amid all of this mixture of success and frustration, a new five hundred pound gorilla has entered the room. The One Laptop Per Child[] initiative has promise of reviving the original vision of CP4E.

+++>

The project's origins go back more than four decades to the early days of computing, when most machines were still the size of small dinosaurs, and almost no one dreamed they would ever be suitable for children. But pioneering thinkers like Seymour Papert disagreed sharply, and over time led the long march from radical theory to reality proving the immense power of the personal computer as a learning tool for children.
<===

Even better, much of the system, and specifically the operating system GUI (called Sugar)[] will be based in Python. Some clever architecture will even allow the child to play with the code! (Of course Python is available.) The very large scale and funding of this initiative promise to provide new focus to the CP4E community.

OLPC does an end run around the school bureaucracies of developed countries. In less developed countries, bureaucratic and political obstacles may also be less developed. It provides a Python-friendly platform with massive distribution among children who have not seen code. It promises to enhance the prominence of Python and allow much larger scales of experimentation wioth pedagogic ideas, all the while being perceived as great fun.

It might not be in time to save the world, but we can hope for that too.

1 comment:

Kirby said...

I think there's plenty that's right in your draft.

In addition to Seymour Papert and Alan Kay, Kenneth Iverson is another important figure vis-a-vis CP4E as his thrust, like mine, was to make Math Notation(MN) come alive in an interactive environment (per APL & J in his case, more Pythonic in ours).

Although Iverson somewhat disavowed Wolfram's status as his protege and/or acolyte (per correspondence I saw on a J list), Mathematica does dramatically illustrate the role of computer software in the domain of math learning and modeling today.

Python isn't Mathematica, but nor is it a "just a calculator" either. You can use it, in combination with add-ons, to study cellular automata, fractals, plus traditional basic math topics such as polynomials, polyhedra, group theory, trigonomety, matrix algebra etc. etc.

Plus OOP gives a way to supply missing concreteness to math objects, without sacrificing their status as abstractions.

Once you get passed the considerable barriers to putting Python in front of a student, ready for action, you come up against the question: what is it we're wanting to learn with assistance from our charming snake? Why do we care about turtles, robots and such? What's the bigger picture?

The Shuttleworth Foundation (kusasa.org) writes in terms of developing "analytical thinking". Or call it problem solving abilities.

And what are the problems? They're very "real world" for one thing, involve energy and opportunity costs (doing more of this means doing less of that). I'll throw out "model view controller" (MVC) as still an important design pattern. I think you get into that when you start talking about developing for the web. HTML provides a view. There's often a database in the picture, maybe several, helping store the model. Python helps define the controller.

You can show the guts of such a system transparently without going for a fancy framework. Just print HTML directly. So what if ISPs don't support Python cgi? A contemporary classroom should allow students to manage their own free and open source server, as we did at West Precinct in Hillsboro that time ("Adventures in Open Source" with Jerritt Collord and myself as instructors).

Rather than repeat myself endlessly, I'll just trail off by saying Python needs a context, doesn't necessarily supply one all on its own. Nor is Sugar (the GUI) nor a laptop computer in and of itself sufficiently "contextual" to guide our choices of emphasis and focus when it comes to curriculum writing for the emerging shared future.

The questions go deeper than that e.g. "what is school really about?"

The positive spin here is this question really is pretty open ended. I'm not trying to close down discussion by leaving it here.

However, per my own CP4E curriculum writing it's quite certain that students are learning Python because they're wishing to develop their analytical and problem solving skills around specific content and/or real world challenges.

Mathematical techniques and algorithms, pivotal concepts, remain a proper focus for these investigations, always have, always will. And the positive spin here is: lots of backward compatibility with pre-computer wood pulp texts, even if they're out of print and/or just get shared around in electronic format.


Kirby