Slashdot Mirror


Lisp as an Alternative to Java

Joseph Dale writes "Lisp as an Alternative to Java is a detailed and well-reasoned study comparing Lisp to Java and C++ in terms of execution time, memory consumption, and developer effort. The author, Erann Gat, was the principal software architect for the Mars Science Microrover, the prototype for the Mars Pathfinder rover."

20 of 372 comments (clear)

  1. Statistically meaningless by GruffDavies · · Score: 3, Insightful
    There were only 14 participants in the study. The conclusions drawn are statistically meaningless. And without some kind of measure of the level of skill of the participants in each language prior to the experiment it's not possible to do weight the answers sensibly either.

  2. Missing the point. by ried · · Score: 3, Insightful
    The secret isn't getting a language/API to run faster than what's out there today. It's a matter of widespread adoption.

    Just like BeOS was fast as hell, it didn't matter much because 5 people used it (sorry, Be people).

    If you can create a language that will execute faster within the JVM, for example (hypothetical here), then you'd have something. Speed is relatively minor thing, and unless you code for compatibility, it won't matter how fast your stuff runs (or can be developed).

  3. Writeability vs. Readability of LISP/JAVA by Aaaaaargh! · · Score: 3, Insightful

    Programming in LISP is a breeze, Java slightly less so (at least in my mind). But what about maintenance? Other people debugging your code? Have you ever had the misfortune of modifying a poorly documented LISP program? It's a good deal harder to do than for a poorly documented Java program.

    --
    Give them an inch and they'll take a foot. Much more than that, you won't have a leg to stand on.
    1. Re:Writeability vs. Readability of LISP/JAVA by e40 · · Score: 2, Insightful
      One of the main reasons LISP is unreadable to outsiders is because of their choice to stick with such bizarre syntax...

      First, you obviously haven't used lisp. Second, you have missed the entire point of the syntax of lisp. The syntax of lisp is the same as data in lisp, s-expressions. The function read can be used to read a piece of code or a data. If you don't see the utility of this, god help you.

  4. Important point: Functional orientation by JohnQPublic · · Score: 2, Insightful

    The second performance result is the low development time. This can be accounted for by the fact that Lisp has a much faster debug cycle than C, C++ or Java. The compilation model for most languages is based on the idea of a compilation unit, usually a file.

    More importantly, Lisp is not "file oriented". In Lisp, a function is a function is a function - you don't have the complex mess of static/public/private/whatever.

    Of course, Lisp is also write-only, like Forth and APL.

    1. Re:Important point: Functional orientation by Anonymous Coward · · Score: 0, Insightful

      More importantly, Lisp is not "file oriented". In Lisp, a function is a function is a function - you don't have the complex mess of static/public/private/whatever.

      But if you need to partition your software into pieces, you use packages. Then you have imports/exports/shadowing/whatever.:-)

      Seriously, once software gets big, you'll want a mechanism do breaking into modules or something, and a certain amount of complexity is involved in controlling that mechanism. Common Lisp's package mechanism seems OK to me.

      Of course, Lisp is also write-only, like Forth and APL.

      I'm sorry, I've written and maintained both Forth and Lisp, and I have to disagree.

      "Lisp" is an old family of languages, going back to 1962 or so. If you mean old-style Lisp, then there's some truth to this, but that's like criticizing "C/C++" because BCPL was hard to maintain.

      Common Lisp (standardized a decade or so ago) is IMHO about the same as Java or C++ for maintainability. On the minus side, it gives you more rope to hang yourself: you can express some very weird concepts using macros and lexical closures. On the plus side, having information stored in more than one place is one of the biggest problems for maintainability, and Common Lisp makes it easier to avoid that than C++ or (especially) Java does (in large part because of those same macros and lexical closures).

      Forth, Perl, assembly language, FORTRAN 77 with hacks to use one big array for mocked up dynamic memory allocation, and all sorts of other things can be made maintainable by using restraint and doing extra work, sticking to a standard set of idioms and writing appropriate internal documentation for things like the calling convention of each function. Common Lisp and various other modern languages are significantly friendlier than that.

      For a comparison, see GCC (a C/C++ compiler implemented mostly in C), CLISP (a Common Lisp system implemented mostly in C), and SBCL (a Common Lisp system implemented in Common Lisp). All of them have some nasty parts, but it's not clear to me that any one is qualitatively more obfuscated, the way that an optimizing compiler written in Forth would tend to be.

  5. 1999 by eye.likeJava() · · Score: 3, Insightful

    That was written in 1999...

    One would be able to suggest that things have changed a little since then..

    Although java does use lots of memory..

    But it is no longer as slow..

    --
    ... although I also like C#..
  6. Interesting, but flawed? by tkrotchko · · Score: 5, Insightful

    Its interesting to see the results of a short study, even though the author admits to the flaw in his methodolody (primarily the subjects were self-chosen). Still, I don't think that's a fatal flaw, and I think his results do have some validity.

    However, I think the author misses a more important issue: development involving a single programmer for a relatively small task isn't the point for most organizations. Maintainability and a large pool of potential developers (for example) are a significant factor in deciding what language to use. LISP is a fabulous language, but try to find 10 programmers at a reasonable price in the next 2 weeks. Good luck.

    Also, while initial development time is important, typically testing/debug cycles are the costly part of implementation, so that's what should weigh on your mind as the area that the most gains can be made. Further, large projects are collaborative efforts, so the objects and libraries available for a particular language plays a role in how quickly you can produce quality code.

    As an aside, it would've been interesting to see the same development done with experienced Visual Basic programmer. My guess is he/she would have the lowest development cycle, and yet it wouldn't be my first choice for a large scale development project (although at the risk of being flamed, its not a bad language for just banging out a quick set of tools for my own use).

    Some of thing things I believe are more important when thinking about a programming language:

    1) Amenable to use by team of programmers
    2) Viability over a period of time (5-10 years).
    3) Large developer base
    4) Cross platform - not because I think cross-platform is a good thing by itself; rather, I think its important to avoid being locked-in to a single hardware or Operating System vendor.
    5) Mature IDE, debugging tools, and compilers.
    6) Wide applicability

    Computer languages tend to develop in response to specific needs, and most programmers will probably end up learning 5-10 languages over the course of their career. It would be helpful to have a discussion of the appropriate roles for certain computer languages, since I'm not sure any computer languages is better than any other.

    --
    You were mistaken. Which is odd, since memory shouldn't be a problem for you
    1. Re:Interesting, but flawed? by blamanj · · Score: 2, Insightful

      I don't think that's a fatal flaw

      Well, it is, assuming you're trying to make the kind of generalization that the original paper was trying to make. The original author took a randomly selected bunch of programmers who claimed to know either Java, C, or C++ and assigned them the task. In comparison, Mr. Gat's paper was based on a call to a bunch of dedicated LISPers. whose expertise one could reasonably expect to be much higher than someone who might have taken a LISP programming class N years ago.

      You really can't compare the two papers. Either you get "experts" on both sides, or you get randomly chosen programmers on both sides, but not a mix.

  7. Re:I'm a professional who uses Java by Lambdaknight · · Score: 5, Insightful

    Well, people don't know it or have prejudices against it like you. And there's noone hyping it to the end.

    The reason why it's not hyped is because Lisp HAD a hype in its history whose decline happened to the same time (and was mostly induced by) the AI winter.

    Most Lisp programmers from that time have still a bad taste in their mouths because of that hype (mind, that the hype was over was not because Lisp is a bad language but because the AI winter) so they won't start another.

    Younger Lisp programmers (like myself) are both happy and unhappy about the lack of a hype.

    Happy because that means you have a much more undisturbed basis on which you can settle your community. The community efforts and activities are easily overseeable and you always know what's going on.

    Unhappy because the community isn't very large and so activities DO happen, but more slowly than in the Java or Perl community because we have fewer people.

    As an example: that article is from 1999 and is widely known in the Lisp community... but only today it has been published on Slashdot.

    If someone writes an article about Perl, it is released immediately here.

    Keep in mind that 2 years are an eternity in computer terms.

    --
    -- Beware the Jabberwock, my son!
  8. Lisp by DGolden · · Score: 3, Insightful

    Personally, I love LISP and Scheme. Their simple syntax makes far more sense to me than other languages.

    I think it's a classic cognitive dissonance effect that causes programmers of other languages to complain - they've spent so much time learning their pet language's wierd syntax that to admit that lisp is easier is to devalue all that effort - and no-one likes to admit they've been wasting their own time, just like windows programmers who've wasted 2 years of thier life learning the intricacies of win32, or x86 asm coders who can't admit how awful x86 asm is compared to PPC or m68k asm.

    Then again, there's a theory somewhere on the net that programming language preferences are influenced by the programmer's native natural language - I was raised partly in an Irish-speaking environment, so lisp may just naturally make more sense to me, due to the different structure of irish sentences.

    --
    Choice of masters is not freedom.
  9. Re:I'm a professional who uses Java by yoghurt · · Score: 2, Insightful

    lisp *is* strongly typed. every item in lisp has a type and it is easy find its type. lisp is not statically typed. the type is associated with the data item not the variable name. this is different from how static languages like C do it. but it is strong nevertheless. btw you can always explicitly declare types and turn up the compile options to increase speed.

    second, you complain about the simple syntax. this is perhaps lisp's greatest feature. lisp supports macros like no other language. it is easy to make a program which generates code if the target has a simple syntax. why do you think gcc converts C into a lisp like language for processing? programming in the simple syntax of lisp allows you the programmer to program the language to suit your problem. alas, the power of such abstraction is sometimes not appreciated.

    database access exists for lisp. corba exists for lisp. i've seen lisp to html generators. why don't you come to comp.lang.lisp and post this. between the flames you may be enlightened.

    --
    Yoghurt
  10. Re:It's about the API by Anonymous Coward · · Score: 1, Insightful
    I agree that FORTRAN is hard to read, since everything ends up looking like a dog's breakfast, but it's certainly not hard to program.

    Nor is it faster than C.

  11. Lisp is nice but Smalltalk is better by crovira · · Score: 3, Insightful

    Lisp is okay. The syntax is trivial but over the years it has evolved some good libraries and it is reflexive.

    You can use lisp to write/generate lisp code which you can then interpret/compile and execute. The problem comes from the architecture of the VM. It was not fundamentally designed with objects and message passing in mind.

    Prolog has a similar simple syntax but its VM is designed completely differently.

    From that respect, the Smalltalk VM is closer to the paradigm.

    While all three have had time to mature and evolve over the decades of their existence, Smalltalk has the most usable and extensive libraries to date.

    Smalltalkers find Java class libraries "quaint."

    That said, Smalltalk is still flawed because it is container based and the contained don't know they are contained unless explicitely made aware of the fact.

    This is its major flaw, as a brick in a wall can make amply clear, its in a wall and its held there. The wall is the aggregate of the relationships between the bricks.

    --
    MSBPodcast.com The opinions expressed here are my own. If you don't like 'em... Think up your own stuff.
  12. Re:It's about the API by Wavicle · · Score: 5, Insightful
    He was comparing apples to oranges near as I can tell. I can't actually read the original paper so it is kind of hard to tell, but the Lisp group was all self selected experts. Read carefully the stated problem and explain to me how anyone could take 63 hours to complete it in Java? The average experience of their Java sample set was 7.7 years!?!!!!! Didn't Java come out in 1995? Where did they find a panel of OAK seed developers? After re-reading that section it looks like he interchanges "years of programming experience" with "years of experience in that language". So why weren't we given the average number of years with experience in that particular language?

    Secondly he was using a task which Lisp is very good at, and well optimized for - list processing. People working in Lisp tend to be well exposed to this kind of problem.

    --
    Education is a better safeguard of liberty than a standing army.
    Edward Everett (1794 - 1865)
  13. Common Lisp vs. Lisp by bugbear · · Score: 3, Insightful

    You make a good point when you ask "Whose Lisp?" Lisp is a family of languages. Common Lisp, which is arguably the leading dialect now, has major flaws. It was designed by a committee, and not especially liked even by them. Common Lisp is like a big ugly old wrestler: powerful but lumpy and ill-mannered (i.e. impolite to the OS and other applications).

    Disputes about Lisp are often about two different things. Those who attack Lisp are usually attacking Common Lisp. Those who defend Lisp are usually defending Lisp, the family.

    Lisp the family sounds like a vague concept, but there is a solid core there. You could approximate it as either Common Lisp minus the crap, or as Scheme (another family member) plus more data structures and libraries.

    Lisp would certainly look better if it had a better representative to send to the Language Beauty Contest than the lumpy old wrestler. It is about time someone made a nice new dialect. In the meantime I'll still take the wrestler over the alternatives, but the price I have to pay is using a language that is considered unfashionable.

    1. Re:Common Lisp vs. Lisp by Goldhammer · · Score: 2, Insightful

      Those who attack Lisp are usually attacking Common Lisp.

      In my experience, most people who "attack Lisp" direct their tirades against Lisp 1 - 1.5, or the all-caps Lisp which appears in, say, Tanimoto's Elements of Artificial Intelligence (1987). Analogous are those clever critics who blast Fortran. Only after you inquire deeper, it becomes clear they are talking about Fortran-77, Fortan-66, Fortran-IV, or even Fortran-II.

  14. Re:Yeah, but just like zsnes and xmame by Anonymous Coward · · Score: 1, Insightful

    We'd lose most security. Java bytecode is carefully designed so you can verify that it doesn't violate the semantic rules of the platform (no calls to inaccessible methods, coercions to the wrong type, or using arbitrary bits as object references) before you execute it. Without the sandbox, we'd again be limited to the underlying operating systems' laughably crude and ineffective measures of per-user access control, with no way to delegate some of my privileges to code I don't entirely trust.

  15. Functional vs. OO by sohp · · Score: 2, Insightful

    Face it, functional program languages do not represent real-world processes in ways that non-technical (particularly non-mathematical) people think, object-oriented languages do. Now any programmer worth his salt can, given sufficient resources, do the mapping of user requirements to functional constructs just fine, but for business application programming, it's just much more effective to say "the Ledger object sums all the values in the Activity column" to a business user than "the accumulate function is mapped over the list of transaction elements"

  16. Lisp and Java are both good langauges by dlw · · Score: 3, Insightful

    In response to the discussion of the paper "Lisp as an Alternative To
    Java" by Erran Gat, 1999:

    I have a lot of experience with both Common Lisp and Java. I like
    both langauges. Although I spent many years of my life as an
    enthusiastic Lisp booster, if I were to start a new project now, under
    most circumstances that I can imagine, I would select Java. But the
    reasons don't have that much to do with deep programming language
    concepts. (More about my credentials later.)

    In the following, when I say "Lisp" I mean "contemporary Common Lisp
    including CLOS" if I don't say otherwise. I talk about Lisp as it is
    now. Lisp's history is an interesting subject but quite irrelevant to
    the questions brought up by the paper.

    >> The Erran Gat paper of 1999

    The experiment and results in this paper don't persuade me of
    anything. The programmers were self-selected; the Java programmers
    were apparently quite inexperienced; the sample size is just too
    small; judging a whole langauge based on a single programming problem
    is too narrow. A small programming exercise like this tests only a
    small fraction of the interesting aspects of programming.

    The paper is valuable in that it makes you think harder about the
    "which langauge is faster" question. Remember, langauages don't have
    speeds; langauge implementations have speeds. And what you have heard
    may not be true. Be skeptical of "common wisdom" about what's slow
    and what's fast; such "common wisdom" is often outdated, limited to
    particular contexts, or just plain wrong.

    >> Why isn't Lisp more popular?

    A language's popularity is strongly influenced by "network effects":
    that is, as more people use a language, it becomes more desirable to
    use. It is hard for a new language to "break through", and once it
    does there is a strong positive-feedback effect. Breaking through is
    very difficult and depends a lot on timing, luck, and often on
    forceful publicity and marketing.

    Java managed to do it, due to a confluence of many factors. It was in
    the right place at the right time. Java's early success had a lot to
    do with the rise of the World Wide Web, the decision of Netscape to
    incorporate Java into their browser, the politics of Microsoft's entry
    into the Internet area, the use of Sun's marketing resources, Sun's
    decision to give out the implementation for free, and many other
    factors on top of the technical merits (and demerits) of the language
    and its then-available implementation.

    Lisp's attempts to break through didn't succeed because the right
    confluence didn't happen, partly due to luck and partly due to
    ineptness of all of us who were hoping to promote it. It did not help
    that Lisp was marketed primarily on the coat-tails of the "AI
    industry" of the 1980's, which did not succeed as an industry
    (although many parts of the AI technology are alive, well, and making
    money today). It was also hurt by claims that Lisp could only run
    well on special-purpose hardware, by its unusual syntax that puts off
    so many people initially, by the lack of good free implementations (at
    the time); I could go on and on.

    It has helped Java's cause that there is one organization promoting
    and defining the langauge and establishing standard API's in so many
    areas. Many Lisp enthusiasts put their energy into refining and
    improving the language (resulting in excellent technology such as
    Scheme and Dylan) rather than all concentrating on stabilizing and
    developing one standard.

    The extensive set of standard API's created by Sun and the Java
    Community Process is very valuable. There just isn't any Lisp
    equivalent standard API for JMS, JDBC, Enterprise JavaBeans, and so on.

    The positive-feedback "network" effects is extremely valuable to
    Java's cause. It's much easier to find trained Java programmers than
    trained Lisp programmers. All kinds of tools and libraries are
    available (many free), many more than for Lisp. There are lots of
    books available about Java, so many that even the subset that are
    *good* books is pretty large, and not just the core Java language but
    facilities such as RMI, Enterprise JavaBeans, JDBC, JMS, and on and
    on.

    For example, there are many commercial producers of messaging
    subsystems that implement the JMS specification, and competition
    between them is driving higher functionality and lower prices.
    There's nothing like that going on for messaging subsystems and Lisp.
    This has nothing to do with any technical features of Java and Lisp as
    languages.

    >> Lisp as a General-Purpose Language -- Lisp is not "exotic"

    "Lisp" means different things to different people. If you read "The
    Structure and Interpretation of Programming Langauages", you're going
    to see Scheme code that is fundamentally different from the way code
    looks in most langauges. I think this is all extremely interesting
    and valuable, but it's not what I have spent my time on.

    To me, Lisp is general-purpose programming language in which I have
    done all kinds of system programming. In my experience, Lisp is a lot
    less "exotic" than some people might expect. For example, the whole
    "Lisp is functional, not procedural" business is largely irrelevant.
    The control structure and overall organization of a program in Common
    Lisp is extremely similar to that of a Java or C++ program. All these
    languages have subroutine calling, object-oriented programming,
    iteration, recursion, data structures, structured programming,
    exceptions, multithreading, etc.

    Any claims that groups can't program in Lisp, or that Lisp programs
    are inherently unmaintainable, are nonsense. There is nothing about
    writing a program in Lisp that makes it harder to maintain than a
    program in C++ or Java.

    >> Static Typing

    Static typing is one of the biggest differences. I agree that Common
    Lisp basically does not have static typing (yes, I know about
    "declare"). Some languages have static typing that is so restrictive
    that it seriously gets in the way of getting useful work done, and in
    the Old Days we of the Lisp world were very much reacting to
    constricting type systems. I am pretty happy with the Java concept of
    types, which I feel provides useful expression of intent in the code,
    and useful compile-time error checking, and doesn't get in your way
    very much. The parameterized typing coming to Java (in JDK 1.5, last
    I heard) should improve the situation further. Still in all, it's not
    that big of a deal, and if I went back to using Lisp without static
    typing I don't thihk my life would be all that different.

    >> Parentheses and Macros

    Lisp's unusual syntax, with the parentheses and what used to be called
    "Polish notation" (i.e. no infix operators), bothers some people. It
    looks unusual and unwieldy to those who are unaccustomed to it.
    However, once you get used to it, and if you use a decent programming
    environment (particularly a text editor that can "indent for Lisp" and
    otherwise knows Lisp syntax, such as but not necessarily Emacs), you
    quickly get used to it and it seems perfectly normal. (It is also
    possible to make a Lisp-family langauge with a more conventional
    syntax, as the Dylan designers decided to do.)

    Lisp's ayntax allow programmers to see programs in the form of a
    simple data structure, which is the basis upon which is built the Lisp
    "macro" facility, one of the truly different and powerful features of
    Lisp. Lisp macros make Lisp an extensible language, in profound sense
    of the word "extensible". They are a form of programming abstraction
    that, properly used, can help make complex systems more simple and
    understandable. Now that I used Java, I do miss Lisp macros. On the
    other hand, it turns out it's not such a big deal, and if I had the
    power of Lisp macros in Java it would not really change my life all
    that much.

    >> My Experience

    Lisp: I wrote the first Emacs-written-in-Lisp (known variously as
    EINE, ZWEI, and Zmacs). It was in fact the second Emacs ever,
    developed concurrently with the original Emacs (written in TECO). I
    have also written in Lisp an interactive debugger, a local area
    network control program, a compiler, and an object-oriented database
    management system. I worked with small and medium-sized groups. I
    maintained lots of code written by people other than myself. I was
    one of the five co-authors of "Common Lisp: The Language". I used
    Lisp, in an implementation that eventually evolved into Common Lisp,
    between 1976 and 1988.

    Java: I was one of the reviewers of "The Java Language Specification".
    I edited early drafts for Bill Joy and Guy Steele Jr. I co-wrote the
    Java part of the ObjectStore database management system, and a
    transactional data manager called "PSE Pro for Java", both from Object
    Design. Currently I am developing business-to-business integration
    software in Java at the same company, now known as eXcelon. I have
    been using Java since early 1996. (In between I did C++.)

    I'd like to go into the question of development environments but this
    is long enough as it is. In a nutshell, I really wish I had my good
    old Lisp Machine development environment again; what I'm using for
    Java nowadays is stone knives and bearskins.

    -- Daniel Weinreb
    dlw@exceloncorp.com