October 22nd, 2007

Tim Bray wrote on style progressions in programming languages. He hints that it would be nice that JavaScript and Erlang would get it together, and lists ASP, Cold Fusion, and PHP as the 'flawed' founders to that beautiful, polished successor, Rails, and Perl the flawed founder to Python and Ruby.

I find it fascinating when a person marks as 'flawed' the languages that have, literally, defined not only the web but application development of all forms. Perhaps the metric shouldn't be on syntax, form, or function, but on usability. From a usability perspective, given degree of use today, we could switch his tables to:

Programming-language Waves
'Perfect', but barely used** 'Flawed', but simple, approachable, powerful, popular
Higher-Level *Ruby (every time I see 'Ruby' I mentally add, Mama's precious little…) Perl
Client side code (The to-be-created scripting language that will take a nice, clean, easy to use language and morph it until it satisfies the purists, while breaking faith with the millions of users just trying to do a job) JavaScript
Object Oriented Java (bloated beyond recognition with senseless additions and overly complex infrastructures) C++ (which can kick Java's ass performance and resource wise)
Web-Centric Rails (you know that thing they used for the one application?) Cold Fusion, ASP and ASP.NET, PHP

I agree that C is a polished successor–once FORTRAN is no longer used for this nation's defense systems, and COBOL applications finally vanish after their many decades of use. Even Perl, which gets slammed much today has a legacy deserving of respect–not to mention a legacy of continued use. As for Erlang, eh. Wanna be. Toy. Doozer. (Remember Eiffel? Yeah, you get the picture.)

What Tim is missing is that it's not the language that's responsible for crappy code–it's the people who use the language. There is beautiful PHP and there's crappy Ruby. The only difference between the two is that, thankfully, there's a lot more beautiful PHP than there is crappy Ruby.

*I'm giving Python a slide because Python has fairly widespread use today.

**updated Yes, I'm aware of Java's strong corporate presence, as well as support for desktop applications. "Barely used" was poetic license on my part. Here, here's a thrown exception. Knock yourself out.

Comments
1
Scott Reynen - 8:56 am 10/22/2007

What Tim is missing is that it's not the language that's responsible for crappy code–it's the people who use the language.

It's an interesting question how much programming language influences coding style, similar to the question of the Sapir-Whorf hypothesis, over how much natural language influences how we think. I think the answer is clearly somewhere in between "not at all" and "completely."

2

"…it's not the language that's responsible for crappy code–it's the people who use the language."

Amen.

3
Karl - 9:57 am 10/22/2007

It's possible to be light on your feet with Java and build web applications that don't require a huge infrastructure - in fact - it's quite handy at it - but it does comes down to the team and the organization that's using it.

I like Java - but then again - I like Perl, PHP and Python. So I guess that makes me a little sick :)

4

I dunno about Tim's first table. While Rails is beginning to grow some rust in the CoolKids scabbard, Ruby itself is far from being an established tool in most commercial shops. He shoulda left it at Python.

As for lamentable ColdFusion, I still heart it. It's only "flaw" was carrying a price tag (not counting CF Express) at a time when you were forced to choose sides; you were either a hardcore kiss-my-asp microsoftie or a freedom-as-in-beer fighter. Too bad, cuz talk about powerful yet easy to grok. It rocked.

5
Bud Gibson - 10:45 am 10/22/2007

I have to say I rather like Python. It's really been helped by Google's sponsorship (Summer of Code, hiring Mark Pilgrim and Guido) and has bang-up web slurping properties.

Ruby gets a lot of play in Sam Ruby's RESTful web services book, and that has motivated me to learn it. It's not great though at slurping xml.

I've been programming perl since there were only 2 O'Reilly books for it. However, I've never gotten past scripting and find it ill-suited toward object orientation.

I advise people to learn Python (really works) or Rails (wide spread use and market demand).

6
Kevin Smith - 11:08 am 10/22/2007

"…it's not the language that's responsible for crappy code–it's the people who use the language."

"Hell is other people's code" — random T-shirt

7

Echoing Bud, Python is the poop for speedy development, especially for personal tools / scripts / etc. If you haven't yet worked with Leonard Richardson's BeautifulSoup Python lib for scraping HTML, I highly recommend it.

I've found that for group projects with a number of developers, I'm also quite happy at the other end of the scale with ActionScript 3's Java-like strong typing and enforcement. This is an area where the "DRY" ethos keels over: not repeating yourself means it's hard for your collaborators & future self to tell whether you actually meant what you wrote. Ultimately, all effective teams figures out their own local level of comfortable frameworkiness / convention in whatever wacky language they choose, and this doesn't always seem to coincide with all the features provided by a language or environment. I've lost count of how many of my professionally-Ruby-using friends bitch about ActiveRecord and actively back away from all the little ways Rails "helps" you. =)

8

it's not the language that's responsible for crappy code–it's the people who use the language

Sure, this is true. The same people who write crap PHP today wrote crap ASP. Or perhaps not the exact same people, because I'd think they've learned something, but at least the same group of people.

An interesting question in this regard, though, is: Would these people write just as bad code in other langauges? Would for example the PhpNuke source code be in the same awful mess that it is in, if it was written in, for example, Ruby? I think I have to agree with Scott Reynen when he says "I think the answer is clearly somewhere in between 'not at all' and 'completely'".

The language will, whether you want to or not, impose some rules and design decisions upon you and your code and some will make it easy to do the right thing, wile others will make it just as easy to do the wrong thing. While there are lots of shades of gray here, I think PHP might possibly be the one language that makes most things right hard to do and most things wrong extremely easy to do. Accompany that with endless amounts of sub-par tutorials that iterate over the exact same bad design decisions and you have yourself an endless spiral of bad code fostering even more bad code.

It's entirely possible to write beautiful code in PHP just as it is possible to write bad code in Ruby, and while as you say "thankfully, there's a lot more beautiful PHP than there is crappy Ruby", there is also so many orders of magnitude more crappy than beautiful PHP out there, that I think your comparison really isn't of much relevance.

9
Shelley - 7:55 am 10/23/2007

Karl, I bet you're not using EJBs ;-)

One other thing I noticed is Tim didn't mention Visual Basic, Delphi, Powerbuilder, and such. I bet there's more corporate use of Visual Basic in a just St. Louis than there is Ruby in the entire world.

Scott, Asbjørn: I can grant that the language may help or hinder when it comes to writing good code, but I've found over the years that it isn't the code that's the problem, so much, as confusion about what is 'good' code, as compared to 'bad'.

Some would say 'good' code is object oriented, but OO based development doesn't fit all circumstances. However, sanitizing input from form fields is 'good' code regardless of circumstances.

Then there's the point of support. PHP is a given in all sites. Python more or less is also, as is Perl, but that's pretty much it for most web hosts. PHP has little set up requirement to hit the ground running.

Therefore there isn't a minimum of training needed to start with PHP that exists for something like Perl/CGI or Ruby/Rails. This increases the amount of bad code, true. But the point is that PHP is approachable in this regard, where, frankly, Rails is not.

Is it then PHP's fault that the language doesn't throw up barriers to entry, like Rails does?

As for the question of good versus crappy code: What is good code?

It's secure. It's efficient. It should be clearly documented, to make is simple to maintain. It should be both consistent and reliable. Does good code really need to be anything more than this?

PHP can provide this, as can Ruby or Python. So can Cold Fusion, ASP, or Java. Ruby may do so with fewer lines of code, but that doesn't make it 'better', just more succinct (some would say cryptic). The fact that there are PHP applications that aren't secure is unfortunate, but also somewhat based on that 'low barrier to entry'. Frankly, I find the 'low barrier to entry' to be a selling point for PHP.

Can a language be designed in such a way that one can't write crappy code? I've not seen one yet.

PS I don't think there's anyone more loyal than a Python fan ;-)

10

[…] Powers disagreed with Tim's assessments in her posts Flaws are in the Eye of the Beholder: I find it fascinating when a person marks as 'flawed' the languages that have, […]

11

[…] Powers disagreed with Tim's assessments in her posts Flaws are in the Eye of the Beholder: I find it fascinating when a person marks as 'flawed' the languages that have, […]

12
Bud Gibson - 9:37 am 10/23/2007

Shelley, I think you're right about low barriers to entry. Those low barriers create network effects, lots of people to interact with as you're trying to figure things out.

On the flip side, I find languages (and perhaps more the people who use them) tend to start to fall into niches. For instance, I'm not convinced there's a lot of people using VB for the web. Python, mainly because of the universal feed parser, is great for parsing web content.

I see Ruby on Rails as really something for reasonably sized database-backed sites (twitter being an example of the scale limits to out-of-the-box RoR).

So, I expect for me that the answer to the question depends on whether I can find a community who will help me do what I want. I then learn the language.

Regarding OO, I found it hard to convert from the traditional procedural approach at first. I do however find real benefits in reuse from other's OO code.

13

"Can a language be designed in such a way that one can't write crappy code? I've not seen one yet."

Me too. Even LISP code *can* be crappy.

On the other I can name at least one language whose development environment was designed in such way that *no* one can write good code.

It's this language where worse if so much better off. The one that has an army of proud moron lead by cupid cynics. You know which one I'm talking about, the one with a "superior design" …

14
Isaac Gouy - 12:20 pm 10/23/2007

Some of those statements are too wierd to be funny.

Your table is 'a usability perspective', you list Java as 'Perfect' but then say 'bloated beyond recognition with senseless additions and overly complex infrastructures' - that seems like a basic contradiction.

Claiming Java is 'barely used' is hilarious.

Back to the wierd 'once FORTRAN is no longer used for this nation's defense systems' - iirc DoDs hundred different programming languages were mushed down to half a dozen, prominently Ada.

15
Shelley - 1:10 pm 10/23/2007

Quotes used in titles are used to denote tongue-in-cheek references, based on Tim's original writing. I'll grant you the use of Java, from a corporate perspective, and its use in desktop tools.

Search term, "fortran defense systems".

Glad you got a giggle, sorry you didn't get enough giggles. Perhaps some education to make up for lack of fun time.

New word for the day: learn the definition of 'facetious'. Use in a sentence.

16
Isaac Gouy - 2:32 pm 10/23/2007

Search term, "cobol defense systems".

New word for the day: learn the definition of 'drivel'. Use in a sentence.

Oh you already did.

17
Karl - 2:56 pm 10/23/2007

Nope - not using EJBs. And whenever a developer brings them up I hit them with a cluestick (a foam baseball bat).

No, really… I mean it :)

Catch ya later.

18
Shelley - 3:56 pm 10/23/2007

Good for you Karl. You'll have to write about your infrastructure some day in your blog. I like to promote any Java application that isn't using EJBs.

19
Shelley - 4:24 pm 10/23/2007

So, Isaac, Parrot your favorite programming language, eh?

Thanks for stopping by and adding so much to the discussion here.

20
James - 6:00 pm 10/23/2007

New FORTRAN is being written today in geoscience, to find oil amongst other things. Intel still produces a FORTRAN compiler because people like getting the best performance out of their room of compute machines.

21

You're still only partly right, Shelley. At least in my book. ;-) Sure, Rails throws up a lot of barriers that only let the ones competent enough in, which results in more competent people producing Rails code which again leads in higher quality code.

However, what I find disgusting about PHP isn't the low entry barrier, but the whole non-existing design and complete lack of consistency of the language itself. It was almost as feature-less as C up until version 5 and you don't really want 50 million "I program in HTML because that's what Microsoft Word tought me" kind of people programming in C. However, that's what you have with PHP (although the "50 million" figure is made up. I have absolutely no clue as to how many who actually programs in PHP). There aren't many people on the face of this planet that has the experience and required competency to program elegantly, structured and well in C. Still, that's what you have with PHP.

If PHP had just been structured from the beginning, with a clear language design, proper variable scoping, namespaces and proper object support, you'd have something completely different. Why couldn't PHP had looked like Python, Ruby or even ECMAScript from the start? Why does it have to look like it was hacked together by a bunch of chimpansees with the "How not to program in Perl" cookbook as the only reference?

I could go on forever about what's wrong with PHP, but I both think and hope you know what has been wrong with that language for a long time. With version 5, things are finally pointing in the right direction, but god damn, that's been a long and painful ride.

22
Shelley - 9:41 am 10/24/2007

Asbjørn, I don't think there's a right or wrong to this, as much of this is opinion about what is or isn't a good programming language.

You're equating the higher barriers to Rails to filtering out those who are incompetent, where I see them as filtering out people who don't want to take the time, especially on something that doesn't necessarily have a strong corporate presence, or requires specialize hosting.

That's the whole point on all of this discussion: there's an elitism to programming language use that, frankly, pisses me off. My point is that crappy code can be written in any language and, conversely, so can beautiful code.

PHP just 'growed' up, true, but it managed to fuel some pretty significant applications along the way that have enabled regular folk to have their own picture galleries and weblogs, without having to hire a professional to do so. This is not something to be lightly discounted–PHP has enabled increased reach for people on the web, a whole lot more than some other 'more perfect' languages or environments. I don't look at this as a failure, or with disdain, but as a triumph of the language.

Now, the creators of PHP are making moves to improve its capability and overall structure, while still having to maintain considerable faith with the past. I respect that. If PHP had been designed that way from the start, I frankly don't think it would have the reach it has today. I also think we'd have a lot more people dependent on we techs to do things they should be able to do themselves.

I look at programming languages less because they meet some idea of perfection and more because they enable people to do things they couldn't do before. That, to me, is the true success of a programming language — not whether it's OO or strictly typed.

Thanks to all those who have contributed to the discussion. Comments are now closed, but you can contact the author of the post directly.