Java

Minor Contenders

Now, it's time to put on an asbestos suit and my +4 plate mail. I debated whether to include any sections on Perl, Lisp, PHP, or Smalltalk. They're fantastic languages in their own right. I just don't think they're next.

If you're deeply religious about any of these languages, you can just read these one-sentence summaries, and skip to the next section: Perl's too loose and too messy, PHP is too close to the HTML, Lisp is not accessible, and Smalltalk wasn't Java.

If you already feel slighted and you must read onif you're a language cultist and I've mentioned your pet language in also-rans, or worse, didn't mention your pet language at allgo ahead and fire up your Gmail client and your thesaurus, and drop me a nasty note. Just keep this in mind: I'm not saying that your language isn't good, or popular. I'm just saying 10 years from now, we probably won't look back at any of these languages as the Java killer.

Steve Yegge: Perl, Lisp, PHP, and Smalltalk

Why won't Perl replace Java?

SY: Well, I'd say Perl was pretty darn successful, and it's still one of the most popular languages around. Perl had world-class marketing: Larry Wall understands programmers, and he's funny and articulate. Perl filled a desperate niche in the Unix-scripting world, and another with CGI. Perl was successful because it was executed superbly, just as Java was.

I do think it's on the wane, though. Perl used to be more productive than the alternatives, so you could argue it was ugly all you wanted, but people got their jobs done faster. But newer languages, Ruby in particular, are changing the game.

Perl is the all-time king of pointless abstractions, like references and typeglobs, one-off shortcuts, and plain old gross hacks, with extra syntax sprayed on to cover the smell. It was productive, but programmers will take the path of least resistance, and Ruby offers orders of magnitude less friction.

What about Lisp ?

SY: That's a tough one. Lisp has world-class survival skills. People keep reinventing or rediscovering it, but Lisp is also a family of families of mutually incompatible designs and implementations, and none of the existing ones looks like a sure winner. For example, Common Lisp needs an overhaul, but redesign by committee is exactly the wrong thing for CL at this point. Lisp needs a benevolent dictator with good instincts, great execution, and great marketing.

And PHP?

SY: PHP's very popular, and getting more so, because it makes web programming easier than most of the alternatives, but Ruby on Rails is going to change all that. There will be a simplification pass to web programming at some point. PHP's not driving a simplification pass of the Web. It just tries to help you cope with the existing complexity. The language is heavily weighed down by its Perl legacy, with lots of confusing and regrettable design decisions. And it's not in the same league as more powerful languages like Ruby, Python, and Lisp.

Is Smalltalk next?

SY: I doubt it. In the end, languages have to have buzz and momentum, and I just don't see any marketing for Smalltalk. The community got the wind knocked out of it by Java, and it doesn't seem to have ever recovered.



PHP

PHP is an open source scripting language that's been gathering momentum since the early 2000s. It's a markup language that's designed to be embedded into HTML. It's very easy to quickly develop simple web applications in PHP, but those applications typically have little back-end structure. For these reasons, it's not really targeting the same niche as Java applications, though it's sometimes been pressed into service in much the same way. Here is "Hello, World" in PHP:

    <html>
      <head>
        <title>Hello, World</title>
      </head>
      <body>
        <?php echo '<p>Hello World</p>'; ?>
      </body>
    </html>

Web programmers recognize this as an HTML scripting language. The code is processed on the server side, so pure HTML can be sent down to the client. It actually handles this kind of scripting pretty well, but it's purely a tag language. PHP's problem is the structure behind the view. It's possible to use PHP for layers behind the view, but it's awkward and cumbersome in that role.

PHP is going to make some serious noise as a pure web-based scripting language, though. In one of the strangest moves in 2005, IBM announced support for PHP. This move undoubtedly targeted the small and medium-size businesses that tend to embrace PHP. IBM can now theoretically sell them software and services to round out their implementations. PHP seems to be a natural language for those Visual Basic users who don't want to make the move to .NET. Like Visual Basic, it will be pressed into service in places where it doesn't fit as developers search for simplicity in the wrong places.

With the most basic Google skills, you can find dozens of papers that attempt to compare Java and PHP. You'll tend to find two types of comments. The PHP camp says that Java isn't productive enough, and the Java camp says that PHP isn't structured enough. I tend to agree with both of them. The primary danger with PHP for small applications is that they can grow into big PHP applications, and you're left without the structure that will let you easily maintain and extend your web applications.

Perl

Perl is a very popular language for programmers who look for raw first-cut efficiency. Perl was quite popular for shell scripts, before simpler alternatives were available. In terms of productivity, Perl has many of the characteristics of other highly productive languages. It's very expressive, terse, and dynamically typed. It gives you freedom to do what you want to do, and has a rapid feedback loop. Paul Graham calls it a great language for "hacking," or rapid experimental programming. Much of the Internet is powered by CGI Perl scripts.

Perl does have a downside. When you look at overall productivity of a language, you've also got to take things like maintenance and readability into account. Perl tends to rate very poorly among experts on a readability scale. As with Java, much of Perl's problem is cultural. Some Perl programmers would rather chop off their little finger than type four extra characters, whether the characters improve readability or not. After all, programs that were hard to write should be hard to read. Other Perl problems relate to the language itself. Perl's object orientation is obviously bolted on, and Perl has a secret handshake of sorts, in the form of many cryptic syntactic shortcuts that only the mother of Perl could love. A whole lot of us at one time or another have had some sort of love/hate relationship with Perl. It's interesting to talk about, but it's pretty much the antithesis of Java, and it's likely not going to make a dent.

Smalltalk

Smalltalk is a beautiful language invented way before its time. Smalltalk and Lisp are probably the two languages that share the most with Ruby. Smart developers used Smalltalk to build successful object-oriented applications long before Java was even a twinkle in Gossling's eye. And not-so-smart developers used Smalltalk to build some of the ugliest object-oriented code ever written. In truth, for the most part, in the mid- and late 1970s, we just didn't have the wisdom or the processing power for OOP yet, and we didn't have features like just-in-time compilers.

In Chapter 8, you saw the elegance of the Smalltalk language. It's object-oriented through and through, and the syntax is remarkably consistent. Smalltalk's syntax probably seemed strange to the masses of programmers who grew up coding COBOL, BASIC, Pascal, C, or C++. Most of the businesses I know of that actually tried Smalltalk were able to get their applications out in time, they just never were able to integrate those applications with the rest of the world.

Smalltalk never was able to lure C and C++ developers away, because it was too alien and had the perception of being too slow. As the small Smalltalk community waited for objects to emerge, Java's founders aggressively grabbed the C++ community by the throat, forced it to come along with C++ syntax and usage models, and offered solutions to solve the most pressing problems the C developers encountered. As we showed, Java was effectively a compromise between perfect OO and the C++ community. Later, IBM made a move to buy OTI, a maker of Smalltalk virtual machines. In one last push for Smalltalk, IBM built a common virtual machine into an IDE called Visual Age with the hopes that the common JVM could lend credibility to Smalltalk. It was too little, too late. We were too content in our newfound freedom, safely and freshly away from all things C++, in the arms of Java.

It's hard to imagine Smalltalk rising up from 30 years of obscurity to dominate. It's probably not going to happen. Still, you can find a small but active community of Smalltalk developers. Disney built Squeak, a Smalltalk dialect and implementation focusing on multimedia. A handful of other dialects are also still around.

In the end, Smalltalk may yet make an impact on development, but as the proving ground for ideas like continuation servers. You'll find evidence of Smalltalk's object model and syntax everywhere. Most notably, Ruby liberally borrows code blocks and idioms like returning self. I think continuation servers will ultimately play a role in web development. They just make too much sense, are too natural, and are too compelling. Smalltalk is where all the continuation research is happening.

Lisp

Lisp is an extremely powerful language that excels in its strange but pure syntax, abstract modeling, and raw efficiency. In Lisp, everything is a list, including Lisp programs. Metaprogramming in Lisp feels natural, and is quite popular. Important ideas like aspect-oriented programming and continuation servers started in Lisp. Several dialects like Dylan and Scheme appear periodically, but none has achieved much success in the commercial mainstream, beyond a macro language for the Emacs. Still, start-ups often use Lisp because once you learn it, you can be incredibly productive. Some very successful programmers like Paul Graham (author of Hackers & Painters) believe Lisp is the most expressive programming language, and they could be right.

Lisp's community has always been made up of intelligent developers, and it's still popular among academics. In fact, some of the best programming universities, like MIT, emphasize Lisp early, to get students to quickly think in the abstract, and to expose them to functional techniques.

Maybe all languages will once again return to Lisp, but I don't think that Lisp itself is the ultimate answer. It's just too alien, and it takes too much time and effort to learn.

Functional Languages

It's probably a bit too early to be talking about functional languages , because we seem to be moving toward object-oriented languages instead. Still, functional programming provides a higher abstraction and very good productivity. It's possible that some functional language could explode, with the right killer app.

Haskell and Erlang are two of a family of programming languages called functional languages. Functions are the focus of functional languages. I use the word function in the pure mathematical sense:

  • Functions have no side effects. This oddity takes some getting used to for most procedural programmers, but also has significant benefits.

  • Functions return values.

  • You can use the return value of a function anywhere you can use the returned type.

You can do functional programming in languages like Ruby and Lisp, but for research or purity, often it's better to use a purer language. Here's a Haskell example, which computes the factorial of a number:

    fact 0 = 1
    fact n = n * fact (n - 1)

Then, as expected, you can compute the value like this:

    fact 10

Here's a Fibonacci sequence (where each number is the sum of the previous two):

    fib 0 = 0
    fib 1 = 1
    fib n = fib (n-1) + fib (n-2)

Functional languages let you work at a higher level of abstraction. Haskell has good traction in research and academic communities, and seems to be gaining a small, vibrant commercial community. It's easy to teach, and as such, it could provide a doorway into functional programming, much like Pascal provided a doorway to procedural languages.

You can see the power of functional programming in the Erlang language. Developed at Ericsson, Erlang's main focus is concurrency. Erlang lets you easily create and use threads, and communicate between them. Erlang also improves distributed computing, because the location of threads is transparenta thread might be in the same process as another, or on a different machine. It's productive, dynamically typed, garbage collected, and very small. There's been a recent spike of interest in Erlang for applications that need excellent support for concurrency and distribution. It's used in production at some high-profile sites. At this point, Erlang is still in its infancy as a general-purpose language. Users tend to use it in conjunction with C (for better performance), and it doesn't have any real user interface library. Still, Erlang is powerful in its niche, and it could make an impact in the intermediate future, directly or as a derivative.

by BrainBellupdated
Advertisement: