5 ms·
>Lispers like to pick on Java. It makes sense, because Common Lisp has everything that Java lacks. But Java has a lot of things Common Lisp lacks, too. A GUI
by tsotha 15y ago
>Lispers like to pick on Java. It makes sense, because Common Lisp has everything that Java lacks.
But Java has a lot of things Common Lisp lacks, too. A GUI package. Network programming. Cryptography. Yes, you get modules for all those things. But having them in the core language means you know they're always available no matter where your code is running.
I like Lisp, even with its painful syntax and poorly named internals (Seriously. "cdr"? "endp"? Was there a Great Keystroke Shortage in the '60s?). But it doesn't have the ecosystem for actually producing a product to anywhere near the extent Java does. There's a reason Java is used so much more widely than Lisp.
In terms of syntax, I like what Rich Hickey did with Clojure. You still have all the Lisp functionality but it's a lot easier to read.
- hythloday 15y ago> Seriously. "cdr"? "endp"? Was there a Great Keystroke Shortage in the '60s? Well...yes? When jaw-dropping storage is a 1 MB hard disk, things like function names really do make a difference, especially when they're called so frequently. For the same reason, C89 identifiers are only 6 characters long (and hence the C naming convention of things like "strdup" rather than "duplicateString").
- tsotha 15y agoSure, because you can fit six characters in 32 bits. But still... those constraints are no longer with us, and there's a limited amount of historical cruft people learning a language today should have to deal with.
- tikhonj 15y agoThere are reasons Java is used widely, just like there were reasons Cobol was used widely. Now, car and cdr are just vestigially named, that is true. On the other hand, things like endp actually make sense--the p is a convention telling you that endp returns a boolean. It's short for predicate. I personally like Scheme's convention to name procedures like that end?, but endp also makes sense. Also, the gui package in Java, for example, isn't really part of the language; it's part of the standard library. I don't see why that is a particularly big advantage, especially because you are not guaranteed to have it everywhere your code will run--for example, I don't think you have access to all of those libraries on Java ME. Ease of reading is also a matter of habit. I actually find lisp code easier to read than most Java code, largely because the Java code tends to have a lot of random cruft (anonymous inner classes implementing a single method, for example).
- michaelochurch 15y agoJava has good libraries and some interesting concurrency primitives, and it's a major improvement over C++ (damning with faint praise) but the language is so verbose and adverse to intelligent programming techniques that I find it nearly unusable. I have a theory about Java. In the '90s, it was not unheard-of for programmer productivity (individually and for the group) to be measured in LoC. Java's great advantage is that it's easy to be "productive" (100+ LoC/day) without accomplishing or thinking very much. An actually productive day can leave behind an eye-popping 750 LoC. Reading that code later is another story. One language that presently surprised was Scala. I expected to hate it based on the way it was presented to me, and found most online tutorials pretty weak, but the language is really cool. I definitely think it's "an acceptable ML", and the fact that it can leverage everything good about Java (including the libraries) is nice.
- tsotha 15y ago>I have a theory about Java. In the '90s, it was not unheard-of for programmer productivity (individually and for the group) to be measured in LoC. Nah, even by the mid '80s KLoC was discredited as a metric for programmers. Java had a couple of big advantages over what had come before. For one thing, it promised, and mostly delivered, a true cross-platform ecosystem. It had a GC and the VM was written with hooks for IDE-based development. And it had a standard GUI package. C++ had none of that. Java is verbose, but it's verbose because you have to be explicit with everything, which makes the code a lot easier to follow if you didn't write it. Poorly written Java isn't that much harder to follow than well written Java. You can't say the same about C++ or Lisp. Java is a tool for an organization where half the people are below average. Unless you're working for a very small startup or a flavor-of-the-month place like Google, that's probably going to be the story where you work. EDIT: Oh, and it's been so long I forgot one of the major, major selling points. You could get free binaries. Almost everything else either cost money or had to be compiled (which was a royal pain in the ass in most cases).
- michaelochurch 15y agoI agree about Java's mediocritizing effect, and that it's beneficial if you have a team of low-skill (0.6 to 0.8, on the scale described here: http://michaelochurch.wordpress.com/2012/01/26/the-trajectory-of-a-software-engineer-and-where-it-all-goes-wrong/ http://michaelochurch.wordpress.com/2012/01/26/the-trajector...) programmers. The question is: why are people hiring hundreds of weak programmers in the first place? When a team of 100 mediocrities achieves as much as a (far less costly) team of 20 good programmers in Java or (better yet) 6 good programmers in a decent language, why hire the former at all? The Java+IDE environment seems to be designed for 0.6 to 0.8 programmers under the assumption that it's OK for them to stay at that level indefinitely. That's one thing I really dislike about the Java+IDE environment: it encourages people not to learn how things really work or to get better. It's founded on the assumption that 90% of programmers are unskilled (true) but instead of trying to improve them, it coddles them and keeps them mired in mediocrity. That whole Java+IDE setup is based on a self-fulfilling prophecy that (a) 90% of programmers are mediocre and will stay that way, (b) no one reads code, so it's okay for small programs to be inappropriately split into 10+ files, (c) programmers don't learn outside of work or want to learn new languages, (d) all code turns into shit, so there's no point in making beautiful code possible, and (e) the lifespan of a developer is 5-10 years. I don't agree with any of these. One thing I continue to find amusing is that Clojure and Scala developers learn about Java faster, per unit time, than most Java developers. This is because, when you have a real language to work with (and a REPL) you can tackle harder and more interesting problems. I can't prove this, but I think that anyone who is smart enough to be effective, in spite of the resistance Java throws in the way, can easily become a 1.2-1.5 programmer in a better language. The argument about "stupid" programmers who just can't grok functional programming is silly. If they can handle Java bullshit, they can learn the simpler abstractions on which decent programming is built. I definitely feel stupider when I have to use crappy languages and can't express my thoughts properly, but I hope it's pretty obvious that this "stupidity" is transient. I agree on Java being an improvement over C++, though. C++ is a disaster.
- spacemanaki 15y ago"(Seriously. "cdr"? "endp"? Was there a Great Keystroke Shortage in the '60s?)" To be fair, CL has "first" and "rest" as well as "car" and "cdr". And as already pointed out, "endp" makes perfect sense if you want to establish a convention for predicates but don't want to allow symbols to contain special characters like ? marks. (I know that CL allows symbols to contain ?s if you surround with with || but I don't think anyone seriously uses something like (defun |end?| (x) ... )
- jwhite 15y agoCL allows question marks in symbols without the || quoting. Try it out at a repl.