1. Feb 25th, 2009

    The defining characteristics

    Eric Ries comes up with four reasons for the enormous success of PHP (I’m assuming “won”, as used in FTW):

    Speed of iterationWriting code with PHP, even though the language is crufty, feels fast, because of the tight write-test-debug loop.

    Direct mapping of outputs to inputs … At IMVU, when we’d hire a new engineer, we could get them to ship code to production on their first day, even if they had never programmed in PHP before. That’s simply impossible on most platforms.

    Incoherent (but huge) standard library …  it was a huge boon for developers. It meant that the PHP brand stood for the same set of tools always and everywhere.

    Bad OOP support … The platforms that win on the web are those that mirror its fundamental structure, not those that try to morph it into a more traditional “elegant” shape.

    So let’s start with these four and try them out on a language that goes by the name Java. Why Java?

    I started working with Java very early, back then one of the most attractive features was speed of iteration. That was years before the J2EE OSGi SCA Grid IoC XML-driven deployments of today, quite a different landscape. Speed of iteration was a major win back then, so were Servlets with their direct mapping of outputs to inputs and relatively easy to grasp API. Coming from C++ and VB, the Java standard library was a thing to behold. And I know some people who simply couldn’t use a language that had no multiple inheritance or templates, but I really appreciated Java having less OO than C++. I even argued not having these features was a good thing.

    So back then I would have considered these four characteristics good arguments in favor of Java, and I would add portability. Not in the sense of “write once, run everywhere”, but “write on my PC, run on my server”. That kind of portability is also something that works very well for PHP. Of course much have changed since then in the land of Java, but what did the characteristics that make or break a language change?

    What defining characteristics make your favorite language a winner?

    1. Feb 25th, 2009

      Chris Adams

      Conciseness pulled me over to Python: I found that I spend less time revisiting “finished” code or dealing with unexpected failures. I’m lumping a few different things in here:

      * clean syntax (I’ve dabbled with Scala and Erlang but I just can’t overlook the awkward syntax)
      * consistent conventions – i.e. avoiding PHP-style haystack/needle confusion
      * avoidance of non-obvious behaviour (The Ruby community’s love of monkeypatching is scary)
      * pervasive use of exceptions which avoids cluttering your code with tons of “if ($rc)” checks or Java’s insane “throws KitchenSink” clutter on every method
      * cultural pressure for unit testing, inline documentation, etc.

      The net effect is that the code seems easier to understand than anything else I’ve tried so far – this is the main reason why Ruby hasn’t quite clicked: there are a lot of cool things happening there, and I’m using it where it makes sense but I keep expecting to wake up one day and find myself back in Perl-style @{$foo->{AAIEEEE!}}[0] purgatory.

      Another big feature: a reasonably complete, comfortable standard library. This is one of the reasons why I have trouble taking Java seriously because every non-trivial program sprouts an enormous dependency list (“Install x, y, and make sure z is >1.2.3″). By now you should be able to parse and generate XML, speak HTTP, handle Unicode, log program status, serialize data structures or deal with threads and other processes without having to install anything beyond the base language – and thee standard library should do the right thing by default so every program doesn’t get larded up with redundant code just to avoid overflows or injection attacks, handle errors, etc.

    2. Feb 25th, 2009

      Matthieu

      Mostly, what I’m expecting from a programming language is to get out of my way. I don’t want to be prevented from doing something, I just need the right level of abstraction for what I want to do. I have some piece of code that I want to reuse, just with different values here and there: functions FTW. I have a behavior I want to reuse: higher order functions FTW (which, by the way, sucks as a name, it makes something trivial sound complicated). I have a piece of code that I want to use as a template for some other pieces of code: macros (the lisp kind) FTW. Objects? Meh, doesn’t help me writing (less) code.

      Orthogonality(*) is another important quality. My biggest Ruby pet peeve is the [] syntax for lambdas (or procs, or methods, or whatever). Then you get the libraries, the documentation, … but I now tend to think that those are a byproduct of the community around the PL, not of the PL itself.

      What makes PHP a winner is that it’s very well targeted at its audience. It’s very inadequate for other tasks but very well optimized to whip out a few web pages. In that sense, Perl (the “father” of PHP) is also very well optimized for its intended use. I still haven’t found my winner though, all the good candidates (Ruby, Python, Scheme, Haskell, Javascript, …) have both really nice qualities and annoying defaults.

      (*) In a programming languages, the quality that a feature doesn’t depend on context and won’t affect the behavior of other features.

    Your comment, here ⇓