Programming, aesthetics, and religion

September 1st, 2004 § 4 comments

A couple weeks ago, Jonas Galvez waxed lyrical (Portuguese) about how Python made him feel like a hacker, about how the language was powerful and expressive. And he is right about Python. Among the languages in wide use today, Python is one of the most interesting and productive to work with. And when I think that the most used languages in Web development today are PHP, Perl and VBScript (ASP) — languages that are mainly procedural — Python appears as a beacon of light shining upon a dark world.

The choice of a programming language, by programmers, is something religious. Discussions about the topic almost always end in “my language is better than yours” arguments. I made use of this argument many times myself. By the way, have you ever heard about someone who left his daily job because he couldn’t stand the programming language used by the company anymore? Well, that’s what I did. Quality of life and all that. Language choice is religious. In my daily job as a programmer, I’ve used a dozen of languages, from brainless Basic to mind-bending Lisp, although the latter was only as an auxiliary tool — it’s near to impossible to find an employer willing to build products in a functional language or find hosting providers that support it on their servers. Even so, in many of the places I worked I was able to choose the language I would use. And, in a certain way, my choice of programming languages became an aesthetic one. I hate underscore characters, for example. Every language that makes an excessive use of those characters repels me — especially if it looks much like C. It’s now easy to see what I think about PHP, isn’t it? Okay, that an exaggeration. I wouldn’t balk from using a language because of underscores — well, maybe I would.

Actually, I think that language aesthetics has much to do with what makes a language powerful. The aesthetics of a language is derived from the intention behind the language, from the way it was conceived. And languages with a powerful focus behind their capabilities appeal a lot more to me aesthetically.

I fell in love with Smalltalk the first I time I saw code written in that language. A language with only five keywords and where all things are objects could only have that effect of me. Those two facts create a language that is extremely powerful, whose syntax is also extremely pleasant. Interestingly enough, Smalltalk’s syntax has remained essentially unchanged for more than 20 years now. That’s a tribute to its power.

I believe that two factors are crucial to the success of a programming — success here meaning the language achieves its intended semantic purpose, not that it achieves any significant market share. Those two factors, simplicity and reflexivity, also tend to create languages that are aesthetically interesting. Aesthetics, then, it’s not a visual function when programming languages are concerned. Rather, it has more to do with the way the language allows for the clear, simple, efficient and readable representation of algorithms.

Simplicity is the language’s ability to express programming constructs with the smallest possible vocabulary. It’s generally accepted that Smalltalk programs tend to take less time to be written than equivalent programs in Java or C. The language is simpler, more compact and more expressive. Lisp goes further. Smalltalk has five keywords and a few dozen syntactic rules. It could be argued that Lisp has no keywords and just a couple syntactic rules, which makes it even more expressive.

Reflexivity is the language’s ability to expose its complete internal structure in its own implementation. Any language worth its name is reflexive — even if in a limited way. Smalltalk and Lisp, to use the previous examples, are completely reflexive. In Smalltalk you can discover and manipulate the structure of all objects and classes, whether they belong to the base system itself or not. Lisp again goes further. Because it exposes its own read-eval-print loop in the language, it makes possible to create entirely new languages and syntactical structures on top of itself.

It was those characteristics that made it possible to add continuation to Smalltalk, a language that does not have them naturally, and modify Lisp to support object-oriented programming — without changing anything in the compilers or virtual machines for those languages. When the invocation stack is an object itself, the sky is the limit.

Simplicity and reflexivity are power. Raw power.

Simplicity means the language can be learned quickly. When the language is compact, there’s less room for programmers to shoot themselves in their feet. Reflexivity, on the other hand, means that when programmers ask for the most, the language will respond properly, without the need of ugly hacks.

Python is a language that comes close to Smalltalk and Lisp in terms of simplicity and reflexivity. I can’t explain why Python is so successful as much as I can’t explain why Smalltalk and Lisp are not successful. It seems more like a matter of the moment in which they came to the market, since they all are available in a lot of platforms as open source packages. Maybe Lisp is not very successful because it’s functional, which requires a different and more evolved programming mindset. It’s interesting to note that Python deviates from the conventional wisdom when it comes to its syntax, much as Smalltalk and Lisp do. Maybe the market is slowly learning how to recognize good languages. And maybe that explains part of its appeal.

My point here is not to defend some languages and criticize others. I just wanted to show a bit of what interests me in a programming language. Languages are fascinating things. They have an appeal that goes beyond the mere possibility of solving a problem. And that’s why I keep programming. There’s art in building a good algorithm in a stirring programming language. And that is what gratifies me the most as a programmer.

§ 4 Responses to Programming, aesthetics, and religion"

  • Ruby on Rails swings by Brazil

    Despite being an aesthetic who “…hate underscore characters”, Ronaldo M. Ferraz has managed to fall in love Ruby on Rails:…

  • Ruby on Rails swings by Brazil

    Despite being an aesthetic who “…hate underscore characters”, Ronaldo M. Ferraz has managed to fall in love Ruby on Rails:…

  • Gabriel says:

    Interesting that i really like python, but not because i think it’s similar to other languages that i like, but the oposite.

    I programed in VB, C and now code in Bash, perl and mainly php.

    But that’s the “professional” list, at personal projects, I use Bash and python only.

    On the other hand, as much as i like the language, python lacks a nice IDE and nice reference documentation (or it’s aimed for the uninitiated or aimed to the language developer)

  • Gabriel says:

    Interesting that i really like python, but not because i think it’s similar to other languages that i like, but the oposite.

    I programed in VB, C and now code in Bash, perl and mainly php.

    But that’s the “professional” list, at personal projects, I use Bash and python only.

    On the other hand, as much as i like the language, python lacks a nice IDE and nice reference documentation (or it’s aimed for the uninitiated or aimed to the language developer). Php’s docs really beat python

What's this?

You are currently reading Programming, aesthetics, and religion at Reflective Surface.

meta