[15]                             home                              [17]

 

 

 

Message from Michael McLay: 12/14/2003 2:10 PM

 

Tim O'Reilly wrote the following in a response to a comment on his article, "Why Scripting Languages Matter" [1].

 

  The idea I take away from this is that you need to understand and  appreciate both "scripting languages" and more "software engineering  languages", and understand when to use each one. And more than the  languages, you need to understand when you are "thinking out loud" when  you're programming, and when you have figured out what you want to do, and  build a rigorous, engineered implementation.

 

Applications are created using layers of language technology for interacting with computers and these layers should be part of the educational process. The AP exam currently fail to do this. When it was decided to replace Pascal with a more relevant language, and again when they decided to replace C++ with Java the role of higher level languages, such as Python, Ruby, Scheme, Tcl and Visual Basic were ignored.

 

Let's start with a broader question. Why do we need computer languages? We could program computers by writing in ones and zeros, but assembly language allowed us to be more productive. FORTRAN and COBOL were a step up beyond assembly and allowed domain experts to be more productive. C allowed the OS writers to move from assembly to a sort of portable assembly language with a few higher level programming constructs added on top. C was very good for writing space efficient and performance efficient programs, so C was picked up by application developers on the resource constrained PC. As the PC grew more powerful the efficiency requirements were relaxed and the labor intensive management of resources started to become an avoidable expense. C++ gave some temporary relief, but it was still a complex language and one that require manual management of memory. Java provided more relief to the programmers by providing a memory safe language that was also more portable than C++. Java also introduced a top level object in the inheritance tree which allowed generic container classes to be used. Better introspection tools were also provided through the reflection API.

 

As this brief history shows, computer programming languages have evolved as the cost of hardware has dropped and the performance of the available hardware has improved. Another good example of this is the replacement of hierarchical databases with SQL during the 70s. This didn't happen until the hardware was economical enough to justify the move to a more abstract database model. This natural trend toward doing more programming in higher level languages will continue because of Moore's Law.

 

Industry has a long history of also using "scripting" languages to simplify the process of linking together complex software systems. These small languages started out as special purpose tools, but over time the languages used have evolved into general purpose languages that are descendent's of sed, awk, and sh. The early general purpose scripting languages like Perl and Tcl showed their roots in syntax and operational model of sh and awk. They borrowed syntax from those languages and then continued to tack on more convoluted syntax to add new programming paradigms, such as object oriented programming.

 

Following another path toward the development of high level glue languages was Visual Basic on the PC. VB is known to have many limitations. In spite of these limitations, it is probably used for programming by more people than any other language. It is used by novices for simple tasks, as well as by experienced professionals in production application development. There are more VB programmers than Java or C# programmers because there are more end users than computer scientists. An end user using VB is a more productive than they would be if they were using Java. The typical end user only programs occasionally and they generally do not work on performance bound problems.

 

Python sits at the confluence of all of these languages. It is a portable version of VB in the sense that it is a very good language to give to an end users and it runs on virtually any computer architecture or operating system. Python's syntax is relatively close to the modern dialect of VB. An end user won't need formal training in computer science to get started. With the Python tutorial in hand, a novice can start writing small programs immediately.

 

Python is also often considered to be a sibling of Tcl and Perl. The most significant difference is that Python looks like a language that was design, not evolved. Perl is a very powerful tool, but the language is not one that should be used for building systems that will require end users participate in writing source code.

 

Python is also closely linked to C, C++, and Java in that you can write Python programs in all of those languages. The C implementation of Python provides a C language API for manipulating the Python object model. This C API is often used to write modules when the operations will be compute intensive. It has also been used to wrap legacy software, e.g. OpenGL, Qt, Gtk, MySQL, and Oracle. The tedious part of wrapping existing libraries has been automated by SWIG [2]. This tool reads header files, or custom wrapper definition files and generates the code for wrapping C and C++ software. A similar tool exists for wrapping FORTRAN code in Python. The Jython implementation of Python is written in Java. In Jython, all Java objects are directly available through the Python syntax. Python has also been implemented for Microsoft's .Net.

 

Python is a general purpose interactive language for manipulating objects. It includes features found in object oriented programming languages, but it is not limited to just object oriented programming like Java. There are features borrowed from functional programming and Python provides a meta programming interface that allows new methods for manipulating objects to be created as well.

 

The AP exam requirements seem to ignore the way modern software is most often written. Applications are being written entirely in high level languages, with only small bits of the software being written in system languages. Developers only need to drop down to C, C++, and Java when performance requirements require optimization. Given this inversion of the application development process, it is logical to start teach the high level language first and only switch to the system languages when teaching about optimization and working closer to the hardware. Zelle [3] makes a case for Python as a good choice for this first programming language.

 

Switching the first language used in the AP training will help science and math majors. When the students who are not going on to become computer science majors write software they are more likely to do their software development in a high level language.

 

Brad Cox wrote: > but I've since attempted to convert the whole system to zope and python.

 

> It could be made to work, but I since shifted to ruby instead > (http://virtualschool.edu/ile) until the servlet engine failed during > a move to the new server. I've pretty much settled on Java + XML for > future development, which I'm working on now as I speak.

 

Please do not judge Python based on your experience with Zope. Zope is only one of many ways you can do web based development with Python. It is the most well known, and probably the most widely used, but it has some well known limitations which you probably encountered.

 

Extending Zope2 into a domain other than online publishing is difficult. Zope was originally a proprietary product. When it went open source the user community found it difficult to customize for a couple reasons. The heavy use of acquisition makes it difficult to know what members were available and where those members were defined. There were also requirements to inherit from special interfaces in order to make objects accessible through Zope. This makes it difficult to integrate independently developed objects into Zope. The Zope3 rewrite is fixing these problems and making other improvements.

 

 > For the non-technically inclined, Perl, Ruby and Python are all > dynamically typed OO programming languages. Java (and XML with DTD > checking) provides compile-time typing, which I've steadily grown to > appreciate for web-based development at least.

 

Twisted is an interesting alternative server technology that might be a better match for your requirements than Zope. Twisted is a framework for building multi-user games. The peer-to-peer protocol and role based access control mechanism required in a multi-user game matches the operation of an interactive environment for education more closely than the client-server architecture. The HTTP based protocol used in web services such as SOAP is a one sided conversation. Interesting things become possible once the client-server limitations of an HTTP are bypassed.

 

 Richard Ballard writes:

 

> I am not recognizing what Python is and how, for example, it relates to the > early Plato system. I know Plato and those involved there very well.

 

The Python language can be used to quickly glue together collections of software in ways that would have been impractical or impossible without a flexible high level glue language. Python is a toolkit or framework, for building applications, such as a Plato-like system.

 

> Plato and PCDP were interactive graphical languages built around > student-teacher natural language tutorial conversations.

 

In addition to using Python to develop the system, Python can be used as an end user language for interacting with the system. Using Python isn't an unstructured "natural language" interaction with the computer, but the minimal syntax and coherence of the language structure make learning the basics of interacting with the Python interpreter a very simple task.

 

> So far I am not seeing any of the interactive techniques employed by these > projects in today's page turning "electronic book/web site" presentations.

 

The Python interactive prompt is a great way to learn what is inside the computer. It encourages doing "what if" testing of ideas that would not be considered practical in a compiled language environment. Education will be more interactive if you have a collection of domain specific objects defined and then use Python as a general purpose query language for exploring and experimenting with those objects.

 

> Where does Python play in all this and why should NSF care?

 

Python is the middleware that can glue together many different worlds. It is a high level language which should be used to introduce students to computers. It can also be used as a low level language when system optimization is required, but this currently requires programming the Python objects in C, C++, or some other system language. The PyPy [4] project is working on rewriting Python in Python. The potential benefits of this reimplementation would be a useful addition to the proposal, but I'll defer writing about the potential optimizations of PyPy for now. The addition of interfaces to Python is also one of the Python 3.0 proposed activities that will extend Python's reach down toward being a system programming language.

 

[1] http://www.oreillynet.com/pub/wlg/3190 

[2] http://www.swig.org/

[3] http://mcsp.wartburg.edu/zelle/python/python-first.html

[4] http://codespeak.net/pypy/