Docsity

Python in Education: A Comprehensive Guide for Learners, Notas de estudo de Engenharia Elétrica

Pré-visualização parcial do texto

Baixe Python in Education: A Comprehensive Guide for Learners e outras Notas de estudo em PDF para Engenharia Elétrica, somente na Docsity!

Python in

Education

Nicholas H. Tollervey

Teach, Learn, Program

Nicholas H.Tollervey

Python in Education

Teach, Learn, Program

In memory of John Pinner (1944–2015), who tragically lost his fight with cancer while this work was being written. He taught Python to me and many other people in the UK. This kind and gentle man understood the value of computing education and, through his work as founder and chairperson of the PyconUK confer‐ ence, promoted it with great zeal. He is a sorely missed mentor, leader and friend.

1 Neo, in the film The Matrix. 2 Mark Zuckerberg’s character in the film The Social Network. 3 Moss, from the UK TV series The I.T. Crowd.

Preface

Programming is cool.

Why?

Because programmers are obviously black-clad kung-fu ninjas with “hacker aliases” who always take the red pill, type really fast to “crack databases,” and save the world from renegade artificial intelli‐ gences.^1 Or perhaps programmers are geeky wunderkind who make billions of dollars by founding social networks that have more users than most countries have citizens.^2 Then again, programmers are those socially awkward yet rather useful savants who are always so keen to fix your computer (but never let them explain what they’re doing or they’ll bore you with overly enthusiastic technobabble).^3 Also, why is programming such a “boy” thing?

Stereotypes stop people from doing stuff.

This applies as much to programming as any other aspect of life. If your view of a programmer is as ridiculous as the stereotypes listed above, then programming is likely to appear as an intimidating form of technical magic or a dull obsession for misfit boys who avoid the great outdoors.

But there is hope: the damaging prejudices and misconceptions lis‐ ted above can be overturned through education. Organizations such as the RaspberryPi Foundation and One Laptop Per Child (OLPC)

vii

It’s easy to read: if you squint a little, most Python code is com‐ prehensible even to people who wouldn’t call themselves pro‐ grammers (for example, Python is very popular among scientists).

Community Python has a large, diverse and proactive community associated with it. The Python Software Foundation (PSF) is a community- led charitable organization whose mission is to promote, pro‐ tect and advance the Python programming language.

Momentum Being popular is itself a strength and a virtuous circle that rein‐ forces Python’s popularity. New projects and initiatives are announced all the time. For example, the author is aware of sev‐ eral yet-to-be publicly announced Python-in-education projects. The online version of this document will be updated to reflect these announcements, so be sure to check http:// www.oreilly.com/programming/free/python-in-education.csp.

What’s in It for You?

If you’re reading this report, I imagine you’re a programmer, teacher, student, parent or other interested party. You’re probably wondering how this report will help you understand Python’s place in the recent resurgence of interest in computing education. Assuming the categories of reader listed above, here’s what’s in it for you.

You’re a Programmer

If you already know how to write code, then you might believe that education is of little interest to you.

But wait!

If you’re a good programmer, you also know that part of the vocation of software development involves learning new technology and, when in a position of responsibility, teaching junior colleagues how your software works. Put simply, to be a programmer is to be both a teacher and a student.

To describe programming so children understand you indicates that you know your craft at a deep level. For instance, you appreciate what to leave in or how much to leave out of an explanation. You

Preface | ix

have clear enough mental models of the concepts of programming that you can accurately analogize and summarize. Furthermore, you explain yourself in simple and easy-to-understand language that demonstrates your own clarity of thought. Finally, finding the opportunities to practice these skills on young coders is a sign of moral and professional value: you’re putting something back into the wider community and have shown initiative.

This report describes how you and your colleagues may continue your professional development by supporting the next generation of programmers.

You’re a Teacher

Well done! Before becoming a programmer, I was a senior secon‐ dary school teacher in the United Kingdom. It was the most difficult yet also most rewarding job I have ever had to do. Teaching is the one profession that creates all the other professions. It is a calling (you’re certainly not doing it for the money or perks) and, as a prac‐ titioner of this remarkable profession, if you’re looking for help and support in teaching programming, then you’ve made a great choice by investigating Python.

This report describes where to learn about Python (so you’re no longer one page ahead of the class), get involved with and find sup‐ port from the wider Python community and become acquainted with the story of Python—an interesting subject in itself when teaching computing.

You’re a Student

It often seems daunting to learn new skills and knowledge. But rest assured, Python is both relatively easy to learn and a real program‐ ming language used widely in industry. Python comes with “batter‐ ies included”: there are plenty of libraries of code written in Python that allow you to build all sorts of amazing and incredible applica‐ tions.

Python’s community is a welcoming and friendly place. Remember, what you get out of the community is directly related to what you put in. Don’t just sit there, do something! Jump in and get involved.

x | Preface

1 From the foreword to Mark Lutz’s book Programming Python (1st ed.), published by O’Reilly. http://www.python.org/doc/essays/foreword/

CHAPTER 1

The Story of Python

In December 1989, a Dutch programmer called Guido van Rossum was looking for a “hobby” project to keep him occupied over his Christmas holiday. He decided to write an interpreter for a new pro‐ gramming language he’d been thinking about. He states that he was in a slightly irreverent mood so he decided to call his project “Python” after the famous British comedy troupe, “Monty Python’s Flying Circus.”^1

Van Rossum goes on to explain:

It all started with ABC, a wonderful teaching language that I had helped create in the early eighties. It was an incredibly elegant and powerful language, aimed at non-professional programmers. Despite all its elegance and power and the availability of a free implementation, ABC never became popular in the Unix/C world. I can only speculate about the reasons, but here’s a likely one: the dif‐ ficulty of adding new “primitive” operations to ABC. It was a mon‐ olithic, “closed system,” with only the most basic I/O operations: read a string from the console, write a string to the console. I deci‐ ded not to repeat this mistake in Python.

Perhaps this explains why Python is so popular in education: from the beginning, it was derived from a language designed for teaching and aimed at nonprofessional programmers. Yet by making it an open and extensible platform (Python is an open source project),

1

While much of this cultural artifact won’t make sense to nonprog‐ rammers, the general sense—which should be obvious to all—is a striving for simplicity, clarity, pragmatism and a sense of playful fun. Contrast this outlook with the usual stereotypes of programming languages as complex, obscure, dense and serious endeavours. It’s hard not to wonder about Python, “What’s not to like?”

As Alex Martelli puts it in his Python Cookbook (O’Reilly), “To describe something as clever is not considered a compliment in the Python culture.”

Python culture? Yes, there is a Python culture that labels positive aspects of Python programming as “Pythonic.” A simple, elegant and easy-to-comprehend solution to a programming problem (i.e., it conforms to the Zen of Python) will often be called Pythonic.

Python’s focus on simplicity, clarity, pragmatism and fun is appeal‐ ing in an engineering context. I believe it is also essential and attrac‐ tive in the world of education. After all, engaging young coders with a text-based programming language puts up plenty of barriers to entry (learning to type accurately, underdeveloped literacy and com‐ prehension skills and a lack of syntactic discipline when writing spring immediately to mind). This is before even having to deal with the complexity of the language itself, its idioms and abstractions.

Python’s potential role in the world of education was not missed by Van Rossum. In 1999, he made his position on the subject public through a proposal for a project called “Computer Programming for Everybody: A Scouting Expedition for the Programmers of Tomor‐ row”. The opening paragraphs of the proposal succinctly describe his outlook:

In the seventies, Xerox PARC asked: “Can we have a computer on every desk?” We now know this is possible, but those computers haven’t necessarily empowered their users. Today’s computers are often inflexible: the average computer user can typically only change a limited set of options configurable via a “wizard” (a lofty word for a canned dialog), and is dependent on expert program‐ mers for everything else. We ask a follow-up question: “What will happen if users can pro‐ gram their own computer?” We’re looking forward to a future where every computer user will be able to “open the hood” of their computer and make improvements to the applications inside. We believe that this will eventually change the nature of software and software development tools fundamentally.

The Story of Python | 3

The project planned to have three components. They intended to:

  1. Develop a new computing curriculum suitable for high school and college students.
  2. Create better, easier-to-use tools for program development and analysis.
  3. Build a user community around all of the above, encouraging feedback and self-help.

The results of the project’s endeavors were to come together in a sci‐ entific exploration of the role of programming in the next genera‐ tion of computing environments. The proposal continues:

We intend to start with Python, a language designed for rapid development. We believe that Python makes a great first language to learn: Unlike languages designed specifically for beginners, Python is also the choice of many programming professionals. It has an active, growing user community which has already expressed much interest in this proposal, and we expect that this will be a fertile first deployment ground for the teaching materials and tools we propose to create. During the course of the research we will evaluate Python and propose improvements or alternatives.

Exploring how learners used Python was going to inform the devel‐ opment of new programming languages and tools. These opening paragraphs also beautifully encapsulate Python’s strengths in the context of education.

Unfortunately the project was never finished due to a lack of fund‐ ing. I find it an interesting (and rather frustrating) “what if?”. How might Python and computing education have developed if the project had delivered on all three of the planned components?

In any case, this is yet more evidence of how Python has always had education as a core focus. The proposal also appears prescient given the recent changes in attitude to the computing curriculum and the promotion of programming. Van Rossum was a decade and a half too early. Could such a project be revived today?

Nevertheless, such educational endeavors did not go unnoticed. Projects concerned with computing and education have successfully made use of Python to great effect. For example, the One Laptop Per Child (OLPC) project has the following aim:

4 | Chapter 1: The Story of Python

CHAPTER 2

A Pythonic Case Study:

Raspberry Pi

The Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard key‐ board and mouse. It is a capable little device that enables people of all ages to explore computing, and to learn how to program in lan‐ guages like Scratch and Python. It’s capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word- processing, and playing games. What’s more, the Raspberry Pi has the ability to interact with the outside world, and has been used in a wide array of digital maker projects, from music machines and parent detectors to weather sta‐ tions and tweeting birdhouses with infra-red cameras. We want to see the Raspberry Pi being used by kids all over the world to learn to program and understand how computers work. —Raspberry Pi Foundation

In a BBC interview, Eben Upton, one of the founders of the Rasp‐ berry Pi project, explained that the device was so named because it was capable of running the Python programming language. He later conceded at Pycon 2013 that their spelling might have been a bit off (“Pi” instead of “Py”).

When talking with Eben and two members of the Raspberry Pi edu‐ cation team, Carrie Anne Philbin and Ben Nuttall, it’s clear that

7