Re: Teaching Python instead of Java? (Jeffrey Elkner)
Hi David! Thanks for your interest in exploring Python as an introductory programming language! I am a high school teacher who has been using Python to teach our intro course for two years now. I have never seen a better language for that purpose. The main aim when teaching students to program is to give them an understanding of the processes of thought and the underlying concepts used in getting a machine to follow their will. This is a daunting task, and no programming language could make teaching students to think logically easy. Sorry, it's not about machines at all. It is about formulating computational solutions that people read, modify, extend, debug. The machine comes last, and the point of high-level language is to hide the machine. Totally. Period. The best programming language in the world for teaching programming would be one that does not add any additional overhead to the problem of teaching students to understand variables, conditional branches, and loops. As a Python programmer yourself I'm sure you will understand when I say that Python does that better than any other language I know of. I question the "loop" part. You want to match the program organization to the data organization. Loops hardly ever match, unless all your data are linear (natural numbers, lists). XML is all about trees. No sound mind should process them with loops. And students should be able to mainpulate XML-like stuff after a few weeks or so with total ease. To be concrete about this, let's compare Python with Java. I agree with you that Java is a fine language (and it is definite improvement over C++ for beginners), but it can't compare with Python as a first language. Why don't you compare Python with a true competitor such as Scheme? It has the same advantages as Python, has been around much longer, is regular, and is already taught at hundreds of colleges and high schools. -- Matthias Matthias Felleisen Professor of Computer Science Rice University For a new way to look at the world of high school computing, see http://www.teach-scheme.org/ http://www.htdp.org/ "Computer Science is no more about computers than astronomy is about telescopes." -- E. W. Dijkstra
Why don't you compare Python with a true competitor such as Scheme?
It has the same advantages as Python, has been around much longer, is regular, and is already taught at hundreds of colleges and high schools.
-- Matthias
In theory, we have a lot of latitude regarding how to craft a course, even at the high school level. Given that Python incorporates a lot of features common to other languages, it's useful for developing some ideas and skills with an eye towards introducing other languages as well. I always appreciated my intro classes in college for precisely this approach: part of the aim was to open our eyes to the huge number of languages out there and something about their history as well. I got some hands-on experience with a sampling, and really enjoyed that. In sum, I think a dynamite intro to programming course might use Python as a base of operations within which to develop concepts Mr. Elkner was listing etc. (branching, looping, resursion, procedure, class/subclass/object, data types, arrays), and then get into something of the rich heritage a contemporary student inherits, if willing. Speaking of the tree structure, how languages tend to grow on trees is useful information. Show the LISP family tree, give some sense of its nomenclature and current state. Download DrScheme and introduce some of the basics. Do the same with a LISP (which has a loop construct and relies far less on recursive strategies -- unless in the hands of a Schemer). Talk about SmallTalk and Squeak -- dive into it for a few days. Maybe use Jython as an intro to Java. Then talk pure Java. Use this as a bridge back to C/C++ and, coming full circle, touch on CPython as C code, and how to extend same. Did I forget to mention Perl? Tsk. And what about Haskell and ISETL and FORTRAN and APL and... obviously it's up to the teacher what to cover in finite time. But what's so cool about getting your intro today, vs. X years ago, is you've got a lot of free resources and GUI versions of just about all of the above. It's a rich and well-supplied environment, all there, ready to be explored. What I'd like to see in a next generation of programmers is less propensity to indulge in language wars of any kind -- especially of the pointless kind, as if the aim were to make the "competition" simply go away and to envision an "ideal world" wherein everyone eventually sees the light and programs in language X (whatever language X might be). So many religions have made this mistake, and I think the less of them for it. So when we teach Python as a first language, I _hope_ the attitute isn't going to be to encourage snobbery and "my language is better than yours" attitudes. On the contrary, _all_ the languages are part of your common heritage, and you can use any of several to leverage your understanding of all the others. To me, this is what any "introduction to programming" is really about, at least initially. It's about learning some of the basic concepts (and that includes knowing something about how computers work) and it's about getting some overview and feel for the evolutionary picture, the zoology, the taxonomy. It's not about studying just one animal in the zoo the whole day, and ignoring all the other creatures. And finally, in an even "grander" scheme of things, I'm looking at ordinary non-computer languages in the same overview, starting with the math notations, with all their varied syntax and symbols. Math languages have had a big influence in computer language from the start -- except I think it's increasingly a two way street, with the bidirectional aspect becoming clearer by the day. So I'm all for a hybrid of computer science and concrete mathematics which draws examples of what to program from the math texts, and which shows students how language X is managing to implement some of the same ideas as embodied in math notation Y (boolean algebra is a good place to start, then maybe loops of the kind signified by Sigma and Pi, then gcd and lcm... etc. etc. See: http://www.inetarena.com/~pdx4d/ocn/overcome.html -- which is mostly addressed to math teachers, as I don't believe in necessarily putting computers on one side of a bureaucratic turf divide and math courses on the other -- leaving serious math teachig to the graphing calculator crowd seems a serious misallocation of resources in my book). I'll try to summarize with a course outline, drawn off the top of my head and on the spot: Introduction to Computer Programming Cardinality (numbers as names) Looking at serial numbers, social security numbers, license plate alpha-numeric strings, and talking about the pervasiveness of databases in our culture (record keeping) Videoclip possibilities: airline reservations, talking heads re their jobs, clips from the movie 'Brazil' (welcome to information retrieval -- metropolis/bureaucracy/art deco) -- I recommend short vidclips from your school's DVD juke box wherever appropriate (won't continue listing them here, as your school probably doesn't have a repository in any case). http://www.inetarena.com/~pdx4d/ocn/cardinality.html Ordinality (numbers in order) quick review of integers and real numbers, with an eye towards data types and the computer concepts of floating point, double precision, big numbers, integers, negatives numbers (ties forward to later mention of binary representations, 2s complement etc). Emphasize the importance of operators > < = in an ordered system, plus the appearance of operations such as + / * - (quick mention of groups, fields and rings, just as an aside and the fact that these are topics in algebra) Positional Notation and Bases talk about base 10, other bases, with strong links to the abacus as the artifact that makes all this rather easy to think about. Start introducing Python, including a module with lots of precoded methodes having to do with bases and base conversion. Show the binary strings corresponding to integers. Binary representation ASCII more use of Python to show bytes as 8-bits, some discussion of the history of ASCII, leading up to a discussion of: Unicode visit the Unicode website and take a look at some of the PDFs showing the symbols/glyphs covered by this system. Talk about powers of 2, and the space of permutations depending on how many bits in a string (2^N). Review: http://www.inetarena.com/~pdx4d/ocn/intro0.html Computer Languages History of Computers and Computing Devices Start with the abacus, move through navigation as a principle challenge for humans and the development of knowledge and instrumentation in that domain, and ballistics. The importance of ciphers, codes, cryptology should be emphasized, with this thread picked up in WWII. Discuss Alan Turing at Bletchy Park, the German Enigma codes. Use Python to play with the rotor module. Clubhouse codes. Mention Ada Byron and some of the controversy around her 'first computer programmer' title. http://www.teleport.com/~pdx4d/adaessay.html Talk about Grace Hopper and COBOL, and the idea of a compiler. Overview of Compiler, Interpreter, Bytecodes, Virtual Machine, libraries, linking, Assembly Language, chips as having instruction sets, registers, access to short and longer term memeory via bus, RISC, MIX, MMIX (talk about Knuth's multi- volume classic without trying to make this a college course about it). Getting into it with Python Overview Discuss its lineage/heritage, how it's a VHLL coming out after a long history of language evolution, and how we'll therefore be using it to study earlier life forms and other branches of the evolutionary tree, down to live/evolving languages in contemporary use. http://www.inetarena.com/~pdx4d/ocn/cp4e.html Data Types and Data Structures, Conversion Strings, floats, integers, long numbers Types, attributes, lists, tuples, dictionaries Managing Program Flow Branching, looping, recursion, calling and returning, mapping (includes list comprehension) Functions and Methods parameters, functions as objects with attributes, passing functions as parameters (optional, by name) Classes/Subclasses and Objects [this is where I usually swap in Polyhedra as objects and/or Groups as objects, after some simpler examples] Managing with Modules Scope issues, namespaces, importing, documenting << SNIP >> Kirby
participants (2)
-
Kirby Urner
-
Matthias Felleisen