On Readability

I don't think syntax has much to do with readability. Joel Berger posted his thought on a Perl versus Python matchup, but I think that falls into the same trap that most of these arguments do. If we're stuck at the level of syntax, we're really not very good programmers. I don't think any of us choose a language based on the syntax, but that's all we seem to fight about in the comparisons.

I've had the good fortune to have many excellent programmers, and none of the people I know in that category really care too much about the language. Sure, they really like Perl, but if they had to drop in C or Smalltalk or Python or whatever, they just got the job done. They weren't thinking about syntax because they were focused on story. The code at the low-level may have been kludgy, fugly, or just odd, but their skill at the high level interfaces, compartmentalization, and communication meant that the problem was just one of incremental improvement or refactoring instead of a completely new design or code base.

Larry Wall, Perl's emeritus linguist, talks about his creation in terms of nouns and verbs, and when I teach people the Perl language (not how to program, but the language), I talk about that too. But, nouns and verbs are the first couple years of elementary school. After a couple of years of tortured sentence diagramming, students move on to thinking about phrases as a whole, then paragraphs, then essays, and so on. These language debates aren't even to the level of sentences. We pick at phrases and fragments so we can declare a winner.

When I think about readability, I don't think much about the particular syntax. If we're really hard-core programmers, we know we're pushing all that stuff into subroutines or methods. I'm much more interested in the interfaces we create and how that makes the intent of the program (not just a statement) readable and understandable. Appropriate data structures (or relational schema) do the same things for us. If you want to save programmer time, it's not about Perl missing a list comprehension. It's about people thinking at the sentence level writing books.

As part of what I do when I'm not writing books, I get to see plenty of Perl code bases that companies want to improve. Almost none of them are in trouble from syntax or features. As chromatic has said (citation needed), most are at the level of Perl 3 so they don't even get to the complex features (compare that to the low uptake of Python 3). Indeed, in the comments to Joel's post people note the common fear of map and grep, even though it's something that my intermediate Perl students get used to in an hour. The people working at this level often have "Senior" in their title, given for longevity more than skill. (There are other factors here, such as constant fire fighting, that prevent people from spending the time on self-improvement, but that's a different post).

Even with a slightly deficient language, for all the low level syntax people like to debate, a better design makes everything far more readable than switching languages (which Ovid recently meditated on) or meddling with syntax.

And, if we really cared about clean syntax, Randal would have us all moving to Smalltalk where he has repeatedly told me he can teach anyone the five language constructs in 20 minutes. Of course, it's not the language that's the actual hard thing there, just like it's not the language. Again, that's not how we are choosing what we like to work in.


Saying syntax has no effect on the usability of a language is like saying arithmetic is just as easy with Roman numerals as it is with Arabic numerals.

brian, I agree that the choice should be, and is, about more than syntax. Indeed I could rant for as long time on that subject. My article that you referenced however is specifically about syntax; I wrote it because I don't want to concede even that point anymore.

Certainly there is more to the choice of language, but I'm tired of starting such an argument with Perl already a leg down by default when I don't think that it should be assumed.

brian -

I happen to agree with you, which is why I think that the two languages are equivalent. I usually hear this argument coming from the Python folks, not the Perl folks.

Leave a comment

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).