`
13146489
  • 浏览: 253096 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

The Most Powerful JVM Language Available

 
阅读更多
原文地址:http://www.intermediatejava.com/2011/07/the-most-powerful-jvm-language-available/

One of the questions now trending in the Java world shows a hesitation to buy into a technology that might turn out to be a passing fad: should I learn Scala or should I learn Clojure? Especially when it comes to a learning curve that entails a paradigm shift and a reassessment of one's dedication to object orientation, nobody wants to put in the time and then find that his new language of choice lacks street value or practical relevance.



That's the conventional sentiment behind the question, but perhaps the premise of that question is itself faulty. The premise is that the time invested in picking up an "impractical" or trendy language is actually time wasted. But why suppose so? Taking an academic interest in non-commercial, enlightening languages may yield indirect benefits. The recent volume from Bruce Tate, Seven Languages in Seven Weeks, explores precisely this issue by demonstrating what can be learned from a diverse handful of languages and by speculating about how those lessons might improve a programmer's practice.

Similar in intent but narrower in scope is the forthcoming volume by Ben Evans and Martijn Verburg, The Well Grounded Java Developer: Java 7 and Polyglot Programming on the JVM.

On the basis of this approach to the issue, it would make sense to learn both Scala and Clojure (as well as Prolog, Io, and a few others). But that leaves open the issue of priorities. Which has the better bang/buck ratio? I think the answer to that question can be derived in many ways, but maybe the simplest is to look at goals. Clojure and Scala both provide support for functional idioms on the JVM.  Clojure aims to be a relatively pure Lisp, while Scala seems to be a pragmatic hybrid that includes all the desiderata for which people frustrated with Java's limitations have yearned. Clojure is simple and Zen; Scala is complex and heady. Clojure seems to want to do one thing well; Scala seems to want to do all things well enough. (But see this Yegge/Clojure slapfight including the follow-on page of posts.)

Perhaps this is a mischaracterization of one, of both, or even of the issue. Perhaps there's a better set of metaphors to capture the essential difference between these two.  Odersky sees room for both, and regards them as complementary. If you know a better way to boil down the distinction, share it in the comments!

My surplus attention right now is going to Clojure rather than to Scala, and the reason goes all the way back to a now famous article that Paul Graham wrote in 2002: Beating the Averages. There, Graham points back to something that Eric Raymond had previously written:

Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.

Graham's question is why you wouldn't "actually use Lisp itself" if indeed its acquisition is so profoundly enlightening.  "So if Lisp makes you a better programmer, like he says, why wouldn't you want to use it?" Graham proceeds to explain how he and a partner did go all in on Lisp and thereby achieve a competitive advantage in the early years of web development.  Along the way, Graham presents what he calls the Blub Paradox.  This is the most well known part of the article:

Programmers get very attached to their favorite languages, and I don't want to hurt anyone's feelings, so to explain this point I'm going to use a hypothetical language called Blub. Blub falls right in the middle of the abstractness continuum. It is not the most powerful language, but it is more powerful than Cobol or machine language.

And in fact, our hypothetical Blub programmer wouldn't use either of them. Of course he wouldn't program in machine language. That's what compilers are for. And as for Cobol, he doesn't know how anyone can get anything done with it. It doesn't even have x (Blub feature of your choice).

As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.

This is Plato's Cave, of course, and if you've spent a long time thinking in Blub and modeling the world in nouns, Graham maintains, then it's hard to tell when you're looking up at greater power rather than down at something weird and troubling.

If you haven't read Graham's article, you should go read the whole thing. It's a classic. In the meantime, I'll spoil his punch line for you: "Lisp is so great not because of some magic quality visible only to devotees, but because it is simply the most powerful language available." That's why I find Clojure more exciting than some of the other newly fashionable JVM languages. It's as expressive as a language can be, or a near approximation of that ideal, and I want some of that in the worlds I create in Java.

You might also like:

It's never too early
Functional thinking in a world of objects
Currying favor to favor currying



分享到:
评论

相关推荐

    Introduction to JVM Languages

    By writing example projects in those languages and focusing on each language's strong points, we will help you find the programming language that is most appropriate for your particular needs. ...

    Introduction to JVM Languages epub

    Introduction to JVM Languages 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    java资料(JVM+Java Programming Language)

    经典Java学习资料 1、The Java Programming Language 4th Edition.chm 2、The JavaTM Virtual Machine Specification.chm 3、Inside Java Virtual Machine.chm

    Introduction to JVM Languages mobi

    Introduction to JVM Languages 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Creating a language on the JVM-Ola Bini.pdf

    "创建 JVM 上的语言 - Ola Bini" Overview 创建 JVM 上的语言是指如何在 Java虚拟机(JVM)上实现一个新的编程语言。在本文档中,我们将通过 JRuby 和 Ioke 两个案例研究,来了解创建 JVM 上的语言的过程。 为...

    Learning.Scala.Practical.Functional.Programming.for.the.JVM

    This practical book provides a comprehensive yet approachable introduction to the language, complete with syntax diagrams, examples, and exercises. You’ll start with Scala's core types and syntax ...

    推荐一些JVM原理,JVM调优,JVM内存模型,JAVA并发 电子书1

    标题中提到了JVM原理、JVM调优、JVM内存模型和JAVA并发,这些都是Java虚拟机(JVM)相关的核心概念。JVM是运行Java字节码的虚拟计算机,为Java提供了一个跨平台的环境,确保Java程序可以在不同的操作系统上运行而...

    jdk,jvm源码

    Java虚拟机(JVM)是Java程序运行的核心,它负责解释和执行字节码,为Java应用程序提供了一个跨平台的运行环境。JDK(Java Development Kit)包含了开发和运行Java程序所需的所有工具,包括JVM。当我们谈论"jdk,jvm...

    inside_jvm.rar_Inside the JVM_gettingloaded.html_inside jvm_insi

    《深入理解JVM》(Inside the JVM) 是一本关于Java虚拟机的重要参考资料,它涵盖了JVM的内部工作原理,包括类加载机制、内存管理、字节码执行等核心概念。"gettingloaded.html" 可能是其中的一个章节,专门探讨了类的...

    Android代码-golo-lang

    Golo, a lightweight dynamic language for the JVM. > The world didn't need another JVM language. > So we built yet another one. A simple one. Golo is a simple dynamic, weakly-typed language for the JVM...

    jvm 启动过程 JVM 原理

    Java虚拟机(JVM)是Java程序运行的基础,它是一个抽象的计算机系统,负责执行Java字节码。本文将深入探讨JVM的启动过程及其基本原理。 首先,我们需要理解JVM的基本概念。JVM是Java Virtual Machine的缩写,它是...

    Scala in Depth

    Scala is a powerful JVM language that blends the functional and OO programming models. You'll have no trouble getting introductions to Scala in books or online, but it's hard to find great examples ...

    Programming Concurrency on the JVM

    《Programming Concurrency on the JVM》这本书针对Java虚拟机(JVM)平台上的并发编程进行了深入探讨,为开发者提供了一系列实用的指导和示例。本文将根据该书的部分内容和读者反馈,总结出几个关键的知识点,帮助...

    SAP JVM 8.1 64 bits

    SAP JVM 8.1 64位是一个专为SAP系统设计的Java虚拟机,它基于Oracle的Java Development Kit (JDK) 进行优化,以满足SAP应用程序的特定需求。SAP JVM旨在提高性能、可靠性和安全性,同时确保与SAP产品的无缝集成。...

    Dissecting the Hotspot JVM-Martin Toshev.pdf

    "Dissecting the Hotspot JVM" 本文档是关于 Java 虚拟机(JVM)的深入分析,作者 Martin Toshev 通过分享 JVM 的架构、实现机理和调试技术,帮助读者更好地理解 JVM,并为其提供了实践经验。 虚拟机基础 虚拟机...

    JVM图解-JVM指令-JVM原型图.rar

    在这个压缩包中,"JVM图解.png"可能是对JVM内部结构的可视化表示,"JVM图解"可能是一个详细的文档,解释了JVM的工作原理,而"JVM指令手册 中文版"则提供了JVM可执行的所有指令的详细信息。下面,我们将深入探讨JVM的...

    jvm 详细介绍,了解jvm各个组成部分和功能

    ### JVM 详细介绍:掌握 JVM 的各个组成部分与功能 #### 一、Java 源文件编译及执行 Java 应用程序的核心在于源文件的编译与执行。不同于 C/C++ 这类需要针对不同平台进行编译的语言,Java 采用了一种更为灵活的...

Global site tag (gtag.js) - Google Analytics