Slashdot Mirror


Scala, a Statically Typed, Functional, O-O Language

inkslinger77 notes a Computerworld interview with Martin Odersky on the Scala language, which is getting a lot of attention from its use on high-profile sites such as Twitter and LinkedIn. The strongly typed language is intended to be a usable melding of functional and object-oriented programming techniques. "My co-workers and I spend a lot of time writing code so we wanted to have something that was a joy to program in. That was a very definite goal. We wanted to remove as many of the incantations of traditional high-protocol languages as possible and give Scala great expressiveness so that developers can model things in the ways they want to. ... You can express Scala programs in several ways. You can make them look very much like Java programs which is nice for programmers who start out coming from Java. ... But you can also express Scala programs in a purely functional way and those programs can end up looking quite different from typical Java programs. Often they are much more concise. ... Twitter has been able to sustain phenomenal growth, and it seems with more stability than what they had before the switch, so I think that's a good testament to Scala. ... [W]e are looking at new ways to program multicore processors and other parallel systems. We already have a head start here because Scala has a popular actor system which gives you a high-level way to express concurrency. ... The interesting thing is that actors in Scala are not a language feature, they have been done purely as a Scala library. So they are a good witness to Scala's flexibility..."

5 of 299 comments (clear)

  1. Not sold on Scala by glwtta · · Score: 4, Interesting

    Am I the only one not terribly enamored with Scala? It's a massive language (have you seen the book?), but a lot of the syntax is somewhat redundant and doesn't seem to add that much. The type system is downright byzantine, and the Java interface is, let's say, somewhat inelegant. And the whole object-functional thing seems like a paradigm in search of an audience (maybe I'm just not getting it).

    And you get to pay for all this with a huge performance hit.

    I guess their "more is more" approach is mostly making Clojure look more attractive.

    --
    sic transit gloria mundi
  2. Bit more on the twitter culture. by juuri · · Score: 4, Interesting

    Recently I decided to move from contracting to full time work as the job market is balls here in the Bay currently for Contracts. Twitter was one of the companies which I applied and I had the pleasure of having a "phone screen" with them for a senior unix position. Here's what this screen was, a basic unix question, that any lunix user could get. A more intermediate type question that could trick some people. And finally their *BIG SCREEN* a tricky question that was based on esoteric knowledge that had absolutely nothing to do with one's ability to perform the job.

    The person calling me was just reading these off a list, she didn't know why they were picked and was only able to write down the answers. Here's the hilarious part, I informed her that the question was silly and there's no reason anyone should really care about this sort of information except in extreme situations. That this was the question that lead me to believe they had a culture of primadonnas. She diligently wrote all this down, in case they still wanted to talk to me.

    But here's the REAL kicker, their stupid asinine esoteric question? Was wrong. They had the phrasing wrong... what they were asking and looking for in an answer were not the same things. Being a pedantic asshole, in my followup to tell them what I thought of their process I pointed this out. Never heard anything back ;) Wonder if they have fixed their question yet?

    --
    --- I do not moderate.
  3. Re:Choosing a language by slartibart · · Score: 4, Interesting

    Groovy is different because it's easy for Java programmers to learn. In fact, most Java devs can understand Groovy code with little or no explanation. That's certainly not the case for JRuby or Jython. In any event, I agree Clojure is pretty sweet. However, being a Lisp, it's future is questionable. A lot of devs won't be willing to deal with the brain melting process necessary to grock it.

    Yeah I agree with you there. I do use groovy as my "java and then some" language. It looks an awful lot like ruby to me, but yes it's more java-like.

    Its unfortunate about lisp(s) and their popularily, because honestly I don't see what's so difficult about them. Macros are hard, but lisps don't force you to use them. Other languages don't even give you an option, you can't. Paren matching is done by any modern editor. Prefix notation is a bit unintuitive I guess, but that slowed me down for maybe a couple of weeks, about the same as new syntax for almost any language. I am starting to think that "a lot of devs" just don't want to understand it. Or maybe a lot of devs just don't get programming in general, they just learn their one language, and can maybe pick up a few similar ones.

  4. Sold on Scala by mcpotato · · Score: 4, Interesting

    I have not only seen the book but also read it (assuming you mean Programming in Scala). It is very well written and gets you started with Scala easily.

    I do not agree that the syntax is redundant. To the contrary: an important part of the language design is that Scala enables the programmer to extend the language using libraries. A good example is the way collections and iteration work in Scala vs. the way the foreach loop has been added in Java 5.

    Whether static type systems help or hinder depends on whether you work with or agaist it, and on the kind of programs you write. The Scala type system is rather advanced (in the sense of complete) such that it allows you to express more in the type system than other languages do.

    For Java style programming Scala is just much simpler and shorter to write. When you have written some code in both you can appreciate the way Scala works.

    There has already been a comment on multi-paradigm programming, I do not have to extend that.

  5. Re:Runs on Java JVM. Why bother? by Ichoran · · Score: 4, Interesting

    Those supposedly cute features are there for a reason--they make abnormally clean and maintainable code possible.

    The best Scala code I've seen is clearer (to an outside observer) than the best Java code could possibly be, since the language features allow you to focus more on what is going on rather than necessary theatrics.

    The worst Scala code is, admittedly, worse than the worst Java code could possibly be.

    So, if I had programmers who wrote nice clean code, I'd encourage them to use Scala. If I had programmers who wrote ugly tangled code, I'd force them to use Java.