Wednesday, December 22, 2004

Subclassing my own classes

I thought I understood reasonably well objects and classes ... and yet, I had never based one of my classes on one that I had previously created. In fact, most of my classes were not only "terminal" but they were instantiated only once in my program (with the exception of a custom dialog class). Today, it finally dawned on me how I could subclass my own classes. In RUR, I had a robot class and a world class, both of which represented only the logical part; the display was handled separately as I understood it should be. Yet, it lead to enormously interlinked code which didn't feel right.

What I will do, is subclass both the robot and world classes into something like visual_robot and visual_world, which will include all the visual information required to draw themselves. I will also include the robot object in the complete world (eventually creating a list of such objects), since the robot(s) should be part of the world just as the beepers and walls are. This should simplify tremendously the links between the window display and the objects in it.

This approach should also allow for much greater flexibility in giving different appearance, as one can concentrate all the relevant visual parameters in once place, and change them at will.

Monday, December 13, 2004

Settled on a name for my program

I've finally settled for a name for my program. It is RUR: a Python Learning Environment, or RUR-PLE for short.

Pattis's Karel the Robot was named after the author Karel Capek, who popularized the word robot in his play Rossum's Universal Robots (RUR). While RUR-PLE shares the basic RUR acronym, in this case it stands for Roberge's Used Robot. However, through the magic of Rossum's Python, you can learn how to fix it and design a better one, worthy of the name Rossum's Universal Robot.

Saturday, December 11, 2004

CTV.ca | Klein urges same-sex marriage referendum

CTV.ca | Klein urges same-sex marriage referendum

Well, the right wing extremists never get it. You can't let the majority vote on minority rights, pretending that this is what democracy is about. Thankfully, the Canadian Supreme Court judges are well ahead of some dinosaurs that still roam the political landscape.

Saturday, December 04, 2004

Teaching computer programming

In 1981, Richard Pattis wrote a delightful little book titled Karel the Robot, a Gentle Introduction to the Art of Programming. In this book, Pattis introduces the main concepts of sequential programming (including loops and decisions, but not variable assignments) using the paradigm of instructing a robot capable of only four basic actions (turning left, moving one step forward, picking up and putting down beepers). Through the "magic" of programming, the robot "learns" to combine those four basic actions in order to accomplish tasks of increasing complexity. Pattis used Pascal, the preferred language of the day, as a means of "teaching" the robot new tricks. Since then, many new versions of Karel the Robot have surfaced, used to introduce students to various computer languages, with a preference for Java and C++, which are both based on the modern Object-oriented programming (OOP) approach.

However, the complexity of Java and C++ contrasts with the simplicity of the robot world; both these languages seem at odds with the idea of providing a Gentle Introduction to the Art of Programming.

Enter Python... Python, like Java and C++, is an OOP language. However Python also allows a non-OOP programming style which is more suitable for interacting with Pattis's robot. A first implementation of Karel the Robot in Python was called PyKarel. The current implementation is called Guido van Robot (GvR for short), and is available at sourceforge.net.

I am currently working on a "new and improved" version of GvR which extends Pattis's ideas and allow a smooth transition to the use of variables as well as functions/methods and objects. This version, like all Python-based versions of Karel the Robot, will be made available for free to all those interested.

I have been pondering, for over a month, what to call my new version. Pattis's Karel the Robot was named after the author Karel Capek, who popularized the word robot in his play Rossum's Universal Robots. The computer language Python, was named after the famous Monty Python's Flying Circus by its creator, Guido van Rossum. I find it difficult to think of a better name than Guido van Robot to name a programming environment in which one uses Python to teach a robot new tricks!

Any suggestion would be welcome.


Sunday, November 21, 2004

A new beginning

The advent of the web has allowed many to share views which run contrary to what we hear, read or see in the various more traditional media. Such views are sometimes informative, occasionally thought provoking, and only rarely innovative. Yet, they contribute to creating a borderless world, where physical distance is less an impediment to communication than ever before.

It is my hope that the thoughts expressed in this blog will occasionally be seen as informative, that they will spur different ways of thinking and from which, perhaps, one day, will be generated one constructive innovative idea.

Topics will range from usage of technology and Python programming, to critiques of society with a definite Canadian outlook. This is not intended to be an online diary.

André