Someone recently posted a question on the accu-general mailing list. It went something like this:
“A new project is starting at work using C++, and I was suggesting use the Boost C++ libraries, only a colleague said there were problems with Boost 64 bit build on some platforms, and wanted to know what people here thought about Boost?”
My reply unanswered the question:
“Why choose C++ for a new project?”
When pressed further, I wrote:
Thinking things over, I realised this wasn’t a particularly helpful suggestion. Maybe the company in question had a team of experienced C++ programmers; maybe they’d delivered previous projects using C++; maybe the development manager had been promoted following the successful completion of one of these projects.
So I asked myself a question: If I were a junior developer at this company, how could I convince management that Python was a better language for a greenfield project than C++. Management time being at a premium and attention-spans being short, I made the question more specific: how could I best describe Python in a single sentence?
No prize for originality
There’s no need for an original answer. Python has an official home page and the very first sentence on this page supplies Python’s own answer. Also, although I’ve used Python as a specific C++ alternative, I might equally well have favoured other languages in a similar niche: Ruby, Groovy, Perl, for example. It depends which you’re happiest to promote.
All these languages offer one sentence introductions on their homepages. Thus, in no particular order (can you guess which is which?), Python/Ruby/Groovy/Perl is:
- A stable, cross platform programming language.
- A dynamic object-oriented programming language that can be used for many kinds of software development.
- A dynamic, open source programming language with a focus on simplicity and productivity.
- An agile dynamic language for the Java Virtual Machine.
Plenty of other languages occupy a similar domain. All describe themselves using similar words. I wasn’t entirely happy though, since none of these sentences do a great job of pitching Python etc.
So I applied a common programming tactic. I reduced the scope of the problem: how could I pitch Python in just 3 syllables?
Three of the four sentences above use the term dynamic and there’s little doubt that Perl (which, with an uncharacteristically serious face on, describes itself as stable) is every bit as dynamic as its peers.
Dynamic appeals, especially to a programmer (as do adjectives like Agile and eXtreme). The word implies change, energy, force. My dictionary has nothing to say about its specific connotations when applied to a computer language, so I googled and found myself at Wikipedia.
Dynamic programming language is a term used broadly in computer science to describe a class of high level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all. These behaviors could include extension of the program, by adding new code, by extending objects and definitions, or by modifying the type system, all during program execution.
I’m not sure that’s especially helpful as a sales pitch, and certainly it’s not a commonly understood definition. If I wanted to promote (for example) Python as a suitable language for a project, I wouldn’t emphasise these features. And there’s also the problem of overloaded meaning, as Wikipedia goes on to point out.
Dynamic languages and dynamic typing are not identical concepts, and a dynamic language need not be dynamically typed, though many dynamic languages are dynamically typed.
So, if we describe a language as dynamic, there’s a risk our C++-biased manager assumes dynamically typed; and there’s a common misconception that dynamic typing equals weak typing. There’s also a danger our audience fears the volatility associated with dynamism (how can a dynamic language be used to build a solid application?)
None of the languages mentioned describes itself as a scripting language. Nonetheless, the term is commonly used, especially for Perl. Perhaps many of us first pick up these languages when we have a scripting task to do: copy a bunch of files around, change their contents in some way, pull a page from a web server and parse it, convert a spreadsheet into HTML and post it on the intranet — the kind of quotidian task which is tiresome to implement in a low-level language.
By scripting we tend to mean one-shot tasks such as these, where perhaps we can squander a few CPU cycles or expend more memory than strictly necessary. The focus is on getting the job done. Scripts are just little programs.
Little is good in this context. When we say we want readable code, we don’t mean we want to sit in a comfortable chair and page through a Java-saga. We prefer something succinct: something easy to understand, something which fits in our heads. I can imagine the term scripting being reclaimed as a badge of pride rather like hacker has been — but for now scripting means writing little programs, and belittles the language used.
Well what then?
Having snubbed the popular terms, scripting and dynamic, what shall we use in their place? Reviewing the original four one-sentence descriptions we find open source, simple, cross platform, agile, object-oriented, productive, used in many kinds of software development — all of which are fine attributes and true enough, but none of which, on its own, goes far enough.
Python is a high-level language. Ruby, Groovy and Perl are high-level languages. High-level has become my preferred term.
High-level doesn’t tell the whole story, of course — nor can any one word. It’s also relative: C is high-level compared to assembler which itself is high-level compared to machine code — but these days C is a low-level language and Birmingham New Street is old.
Management may think of C++ as high-level. It isn’t. You must manage memory by hand, understand pointers, budget for each of the bits in each of the various integral types on each of your platforms. Java is better, but not much.
High-level no longer applies to C++ etc. and that’s one reason why I want to appropriate it for today’s real high-level languages. The benefits of using high-level languages are understood: the language does more for you.
One day, Python may not be high-level. Today, it is.
- I delivered this as a lightning speech at PyCon UK yesterday. Lightning speeches are limited to 5 minutes, and I had to skip some bits and race through others. This is what I meant to say!
- I don’t mean to criticise Boost, which sets standards very high indeed. If you’re going to use C++, Boost is the next best thing to the C++ standard library. I would treat any hearsay about Boost not working on particular platforms with skepticism: you don’t have to look hard to find Boost library test reports for common platforms.
- Birmingham New Street opened in 1854.
Here's my three-syllables Python pitch: Productive.
It is productive because it is:
- Garbage collected, no explicit memory management.
- Concise, less time writing and reading boilerplate.
- Readable, easier to understand code and find bugs.
- Batteries included, rich, reliable and maintained standard library.
- Not compiled. Anybody who has done serious programming in C++ can understand the value of this.
And it has PEP8 too, so people can spend less time arguing about coding style and reformatting code.
The biggest problem with Python in a corporate setting at the moment is find skilled practitioners that have not been hired by Google yet.
David, yes, productive is a good word -- perhaps the main benefit of using a high-level language, and I agree with your analysis of why Python is productive. I do think that interpreted is an important and under-sung asset.
I do have a few issues with the term productive though. It's become over-used. Think of all those frameworks which tout themselves as productive and actually lock you in and slow you down. You also need to consider what exactly is being produced: in this Alan Griffiths article Noah Shortcut is (seen as) a productive programmer.
The biggest problem with Python in a corporate setting at the moment is find skilled practitioners who have not been hired by Google yet.
I'll reply to this separately.