Interview with Martin Odersky on Clojure and Scala

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 10400 Views - Last Post: 11 August 2010 - 02:06 PM

#1 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Interview with Martin Odersky on Clojure and Scala

Post icon  Posted 06 August 2010 - 11:06 AM

http://blog.fogus.me...y-take5-tolist/

This is a brief interview done by a member of the Clojure community on the creator of Scala. Michael Fogus (the interviewer) is a big Clojurer, and is even the co-author of the upcoming The Joy of Clojure book.

Martin Odersky is the creator of Scala, Generic Java, and Pizza (which actually became Java's generics, if I understand correctly).

Martin and Fogus did this interview because many people tend to think of Clojure and Scala as being competing languages. This is far from the truth. The Clojure and Scala community frequently collaborate. Rich and Martin have gone a long way to get rid of these myths. Scala and Clojure are complimenting rather than competing languages, and they both have a very bright future.

Is This A Good Question/Topic? 2
  • +

Replies To: Interview with Martin Odersky on Clojure and Scala

#2 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 782
  • View blog
  • Posts: 7,610
  • Joined: 05-May 05

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 02:22 PM

What's all this even mean? I'm not flaming, you're the only person I've heard talk about Clojure and stuff so I want to know. What are the implications? Do you have this sort of Language Myopia? What are the futures of these languages for what purposes do you think they are best for? This is your opportunity to also tell people all about the languages you keep heralding and spread information.
Was This Post Helpful? 1
  • +
  • -

#3 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 03:37 PM

I'm not sure exactly what you're asking me to do. Haven't I hyped the languages enough? If anybody wants to know what The Big Deal™ is, I think Rich himself is more qualified to answer. There are tons of screencasts (a lot of them by Rich himself, and linked to from the Clojure website), a whole shitload of information on clojure.org (most importantly the rationale), and plenty of blog posts singing the praises. People tend to get annoyed when I constantly repeat myself.

As for their futures, I obviously can't objectively answer that. A huge point behind the blog post linked is that both languages coexist, and aren't trying to eliminate each other. They're futures will be together, at the very least. Both languages are growing pretty fast, and there is a measurable amount of growth in both communities. Especially over the past two years. I don't see either of them just dying out. If they don't continue to grow, I'll certainly be surprised.

As for what purposes I think they're best for, I'd be willing to say that they're good for anything Java is good for and more. They're both JVM languages, so they can go as far as to interop with Java code. Scala and Clojure especially (STM) are great for concurrent tasks. Scala has an actor model that is modeled after Erlang's, and Clojure has an STM (software transactional memory) model built into the language. Clojure was designed from the ground up for concurrency. Clojure gets quite a bit of usage in web development, and there are several frameworks and other tools for that. Scala has the Lift web framework as well. I can't think of anything that either language would be better than the other at right off hand though. Clojure is a Lisp, so it has a macro system. You can accomplish a lot more neat metaprogramming tricks in Clojure than you can in Scala. Clojure is more dynamic than Scala (you can modify running code), and I'm pretty sure there are dynamic tricks you can do with Clojure that can't be done with Scala. Those are just language things though. I'm sure Scala has a few things to one-up Clojure in areas as well.

There are plenty of people on both sides that prefer x over y. I'm a Clojurer because I like dynamic typing, I love Lisp and it's macros, and I love STM. Other people like static typing and Scala. I know some people (including the author of the linked blog post) that use Clojure and Scala both at work and at home.

I'm confused by what you mean by "what does all this mean?". It means that Scala and Clojure aren't actively competing with each other for JVM stardom. This blog post and this thread wasn't made for the purpose of hyping Clojure, moreso to help them make that point.

If you have any specific questions, you're welcome to ask them.

EDIT: It's also relevant to note that one could, theoretically, use Clojure, Java, Scala, JRuby, AND Groovy all in the same project. That would be amusing.

This post has been edited by Raynes: 07 August 2010 - 03:41 PM

Was This Post Helpful? 0
  • +
  • -

#4 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 782
  • View blog
  • Posts: 7,610
  • Joined: 05-May 05

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 03:54 PM

Quote

I'm confused by what you mean by "what does all this mean?".


Why should I care about Clojure and Scala? You've said lots about them, but I need to know why one would decide to write in these languages and for what purposes. I want to hear your summary and not sift through some blogs.
Was This Post Helpful? 0
  • +
  • -

#5 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 04:14 PM

I don't know why you should care about Clojure and Scala. I'm not you. You seem pretty content and satisfied with the languages you already use, so I doubt there is a lot I can say that will impress you or make you want to use either of these languages. I just gave a partial summary of the reasons I use Clojure, but I can try harder.

Clojure and Scala both offer things that Java does not offer. Clojure is a predominately functional programming language. It features STM, immutable data structures, interop with other bytecode-generating languages, macros, closures, lambdas, list comprehensions, and all sorts of other stuff that Java doesn't have. Scala offers many of those, while being less focused on being functional. Depending on who you talk to, this is either good or bad. Scala offers actors instead of STM, and a variety of things that would take too long to describe that leads some people to believe that is the next logical step up from Java. Things like traits and type inference.

Some people push Clojure and Scala as the future of the JVM and the successors to Java. Neither of the languages exist to take over anything. They exist to fix problems in other languages and provide options.

I will reiterate that this wasn't what this thread was intended for. I'm not sure what else I can say. The proof of the pudding is in the eating. No language is for everybody, so whether or not you, the reader, will like/want to use this language is your own decision to make after proper research. I can talk about how awesome they are all day, but what you want and get out of these languages wont depend on what I say. Everybody likes different languages. I advocate my favorite languages in order to expose these other paradigms and options to people who may not know they exist, or don't understand them.

EDIT: When did this get featured? :o

This post has been edited by Raynes: 07 August 2010 - 04:15 PM

Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10397
  • View blog
  • Posts: 38,466
  • Joined: 27-December 08

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 06:10 PM

Quote

Clojure and Scala both offer things that Java does not offer. Clojure is a predominately functional programming language. It features STM, immutable data structures

For the record, it is possible to design immutable Objects in Java. Strings, BigDecimal, and BigInteger are all such examples.

Quote

I will reiterate that this wasn't what this thread was intended for.

I agree. Let's keep it on topic of the blog article. :)

Quote

EDIT: When did this get featured?

I thought it would make good discussion. I featured it shortly after you created the thread. :)
Was This Post Helpful? 0
  • +
  • -

#7 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 07 August 2010 - 06:27 PM

Indeed. But, it's a lot different in languages that encourage or force immutability. For example, immutability is the only option in Haskell. In Clojure, immutability is the default. Scala encourages that you lean towards functional code, but makes it feel easy and natural to not do so. It's one of the reasons I prefer Clojure over Scala. Predominately functional languages encourage you to write functional code. It's part of the reason that I think Haskell is an awesome thing to learn for anybody interested in functional languages, just because it's purity is a serious crash course in how to be functional.

While writing functional code is possible in plenty of languages, you have to know what you're doing and pay a lot of more attention, and it still probably wont be as clean and feel as natural as in a language that encourages it. It's less about features and more about philosophies when it comes to that. I think you kind of misinterpreted what I said there though. I wasn't naming stuff that Java lacks, but just pointing out that there are some things that they have that Java doesn't. The first sentence was entirely unrelated to the rest.

Also, check this out: http://www.unlimited...ts-at-last.html
Reia looks like a neat little language.
Was This Post Helpful? 0
  • +
  • -

#8 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 782
  • View blog
  • Posts: 7,610
  • Joined: 05-May 05

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 04:23 PM

View PostRaynes, on 07 August 2010 - 04:14 PM, said:

I don't know why you should care about Clojure and Scala. I'm not you. You seem pretty content and satisfied with the languages you already use, so I doubt there is a lot I can say that will impress you or make you want to use either of these languages. I just gave a partial summary of the reasons I use Clojure, but I can try harder.
...


I'm not being mean, I'm honestly curious. What I was really asking is for you to "sell" me the languages. You don't have to focus on what you think I would like, I'm really trying to think of what exactly these languages are. I've only ever used Scheme and Haskell before.

Sorry for derailing the topic a little bit, you can just PM me links that can help me play with these languages a bit to get me started.

This post has been edited by WolfCoder: 08 August 2010 - 04:25 PM

Was This Post Helpful? 2
  • +
  • -

#9 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 04:48 PM

I wrote a resource thread for Clojure in Other Languages -> Functional Programming. There are a ton of links that will likely be helpful. It's been so long since I've used Scala that I wouldn't really know where to point you other then the scala-lang.org main site.
Was This Post Helpful? 1
  • +
  • -

#10 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,412
  • Joined: 29-May 08

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 04:59 PM

It interesting to note that you're not actively using scala, why?
Was This Post Helpful? 0
  • +
  • -

#11 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 05:59 PM

View Postmacosxnerd101, on 07 August 2010 - 08:10 PM, said:

Quote

I will reiterate that this wasn't what this thread was intended for.

I agree. Let's keep it on topic of the blog article. :)


I disagree, I think this a great chance to share the great things Clojure has to offer. It's featured + interview with the Language-Top-Dog + DIC's largest Clojure advocate = good opportunity.

I agree with WolfCoder and don't know why she was downvoted. It's a legitimate question I'm sure a of subscribed people are wondering themselves (myself included). :)
Was This Post Helpful? 0
  • +
  • -

#12 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 06:14 PM

View PostAdamSpeight2008, on 08 August 2010 - 03:59 PM, said:

It interesting to note that you're not actively using scala, why?


Clojure is my true love. I'm deeply embedded in the Clojure community, and I have a shitload of Clojure projects that I need or desire to maintain. I don't really have any time for Scala projects right now. Besides that, I'm experimenting with other languages (Perl 6 soon), so Clojure is what I try to focus on the most.

View Poststapia.gutierrez, on 08 August 2010 - 04:59 PM, said:

View Postmacosxnerd101, on 07 August 2010 - 08:10 PM, said:

Quote

I will reiterate that this wasn't what this thread was intended for.

I agree. Let's keep it on topic of the blog article. :)


I disagree, I think this a great chance to share the great things Clojure has to offer. It's featured + interview with the Language-Top-Dog + DIC's largest Clojure advocate = good opportunity.

I agree with WolfCoder and don't know why she was downvoted. It's a legitimate question I'm sure a of subscribed people are wondering themselves (myself included). :)


The questions are fine. I just didn't really plan for this thread to turn into a big "Clojure rocks, you should use it!" fest. Usually people don't want me to advocate Clojure here. It kind of took my by surprise. These kind of questions are usually PMed to me.

Nonetheless, I tried to answer them, and if anybody has any other questions or comments, they're welcome to post them here or PM them to me.

At least, I think I answered them. I gave a run down on things that Clojure offers, but it nowhere near does it justice.

This post has been edited by Raynes: 08 August 2010 - 06:18 PM

Was This Post Helpful? 0
  • +
  • -

#13 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 782
  • View blog
  • Posts: 7,610
  • Joined: 05-May 05

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 06:31 PM

The stage was set, I asked for a "Clojure Rocks!" speech with a link to get some new language users. The conditions were perfect for you to spread the word. I figured you might be the one to be able to tell people what is so good about Clojure. Don't be afraid to advocate something if you really feel it's important even if you get hecklers every time you do it.

Quote

I agree with WolfCoder and don't know why she was downvoted. It's a legitimate question I'm sure a of subscribed people are wondering themselves (myself included).


It was probably aggro from someone. Not a problem, it's easily fixed^^
Was This Post Helpful? 1
  • +
  • -

#14 Raynes  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 611
  • View blog
  • Posts: 2,815
  • Joined: 05-January 09

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 06:59 PM

Clojure is a new language. It's a modern Lisp on the JVM (and the CLR).

The language is built for concurrency and features a software transactional memory model built into the language. Clojure is known for making concurrency-related tasks a total breeze.

Clojure is a functional programming language. Clojure offers pretty much everything you'd expect out of a functional language. Lambdas, closures, a wide variety of collection types and a huge sequence library for working with them. It also gives you plenty of the good of OOP while keeping out the bad. Clojure offers polymorphism through extremely powerful multimethods. The polymorphism that Clojure offers through multimethods, protocols, and records is more flexible than what you'd expect in most object oriented languages. Clojure doesn't shun object orientation as a whole, and takes what Clojure can benefit from. Immutability is the default in Clojure, but Clojure isn't a purely functional language. Rich Hickey recognizes that, while functional programming is good, purely functional programming isn't always best for every task. Some things just scream I/O and mutability, and Clojure provides ways to do these things and remain concurrent easily.

Clojure is a Lisp, which means that it has a macro system. While macros are a little difficult to understand/comprehend at first, they're extremely powerful tools to have at your disposal. Things that would have to be added by compiler writers in languages like Java can usually be added to Clojure by writing a macro. If Clojure is missing a feature that you want, you can quite literally write it yourself. Being a Lisp also means the syntax is very minimal. There isn't much to remember. The parentheses can be a little offputting for a while, but you eventually get used to them, and decent editor support can make them disappear entirely.

Clojure actually has less parens than other Lisps, and it uses stuff like curly brackets and square brackets for some things, where some other Lisps typically just have parens upon parens. For example, in Common Lisp, you would do this:
(let ((a 1) (b 2)) (+ a B)/>)
but in Clojure, you would do this:
(let [a 1 b 2] (+ a B)/>)
In Clojure, commas are whitespace, so you could even do
(let [a 1, b 2] (+ a B)/>)
to make it more readable if necessary.

Lisps look the way they do because they are homoiconic. There is no distinction between code and data in Clojure (or <insert Lisp here>), and Clojure applications are made up of Clojure data structures. This is an extremely powerful and equally hard to comprehend concept, but once you understand it, you'll understand why Lisp languages look the way they do. This may help.

Clojure can interop with other JVM languages. This means that you have the entire JVM at your disposal. You can interop with Scala, Java, JRuby, and Groovy all in the same application if you want (that would be interesting). Because of this, Clojure's age is rather irrelevant to it's practicality. While Clojure does have quite a few libraries written in it for it, Clojure also encourages direct interop with Java code when necessary, so even if there isn't a Clojure library for what you want to do, you can almost bet money that there will be one in Java that you can use.

Clojure's interop usually leads to code being smaller than the Java alternative, and I've heard some people half-jokingly say "Clojure does Java better than Java does Java" due to the way one uses Java code from Clojure. With Clojure's interop sugar, there are usually less dots and parentheses required to call Java code than if you were calling the same code from Java.

Clojure is dynamic. You can modify running code. If you have an application running, you can change pieces of that application and reload it without ever restarting the application. It's unbelievably useful.

Clojure is interactive. Clojure encourages interactive programming rather than a compile/run/crash/debug/repeat cycle. You can run code in the REPL and see it's results, load code into the REPL, and even run your applications in the REPL (in which case you have access to your entire application while it's still running, hence the "modify running code" stuff). It's an insanely productive way of doing things.

Clojure is fast. It can get close to, or reach the speed of Java with proper optimizations (type hints and such). Primitives support and such that is going into Clojure (1.3, I think) will make it even faster. Clojure encourages a "make it work, and then make it fast" philosophy, so the "making it fast" part usually only consists of tiny things like adding type hints that don't require you to really change your code much, or at all.

Clojure is concise. Not much to say here. With Clojure being dynamically typed (of course if your statically typed language has type inference, this is usually irrelevant), functional, and being a Lisp, code tends to be terse. Not so terse that it's unreadable (see the J programming language), but generally more concise than anything you'll see in Java. Code in Clojure is almost always much smaller than the equivalent idiomatic Java code.

Clojure has a very active and friendly community. The primary mailing list (a google group) is insanely active, and there are nearly 300 users in the #clojure IRC channel on the Freenode network at all times. More users join all the time. New libraries are released every day, and tools are getting better all the time.

Being 3 years old, IDE support isn't perfect yet. However, there are plugins for all the major Java IDEs, and they are functional. I don't use them so I can't vouch on the effectiveness of any of them. In Emacs, you can use Slime with the swank-clojure adapter, which will be familiar to Common Lisp users. If you've ever wanted to learn Emacs, Clojure is a good reason to do it. Emacs (SLIME, specifically) is really the most advanced development environment for Common Lisp or Clojure. Not telling you to ditch your IDEs for Emacs, but just encouraging you to try it out sometime. Especially if you aren't satisfied with IDE support in your favorite IDEs. There is also a popular VimClojure thingy for Vim that I'm unfamiliar with, but I know some people who use it. You Vimmers aren't left out. The plugins are all in active development, so expect improvement in the future if they don't meet your expectations now.

My resource thread has tons of links that should be useful for getting you started, so I wont reiterate them here. You can find more information about Clojure, including screencasts that have been known to sell Clojure better than I by Rich Hickey himself, at http://clojure.org.

If you have any other questions about Clojure (practice or theory), you can post them in the Functional Programming forum here on DiC (but I'll probably be the only one to answer them), or in the #clojure IRC channel on freenode. There is also the google group. While a little bit slower, you'll get a ton exposure there, and you should get an answer pretty fast anyway.

This was a public service announcement brought to you by Clj@DiC. If it wasn't what you expected, we'll write a macro to make it better. ;)

I hope this was enough to get some people interested, and I hope I've done Clojure justice.

EDIT: Added a paragraph or two and improved some existing paragraphs.
EDIT2: @WolfCoder I Hope I haven't missed the opportunity yet. I went ahead and wrote this post since it seems more than a few people wanted me to. Thanks for encouraging me to not be a pussy and advocate what I love. <3
EDIT3: Added another paragraph addressing parentheses.
EDIT4: Changed code examples to use code tags rather than inline tags, because smiley faces are allowed in inline tags. -.-

EDIT10,000,000: Tomorrow, I'll make this post my first blog post. I think it would be nice for me and other DiCers to be able to link to this post in the future when similar questions are asked. I finally have a reason to use DiC's blog capabilities! Woot!

This post has been edited by Raynes: 08 August 2010 - 08:03 PM

Was This Post Helpful? 2
  • +
  • -

#15 WolfCoder  Icon User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 782
  • View blog
  • Posts: 7,610
  • Joined: 05-May 05

Re: Interview with Martin Odersky on Clojure and Scala

Posted 08 August 2010 - 09:23 PM

Thanks, there we go. Now I actually know what Clojure is, exactly. I'm not sure if I'll ever really use something like this, but it does help to learn.

Clojure runs on the JVM, but does it have support for the standard libraries JAVA comes with so someone can write a GUI application at least as easily as they could in JAVA?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2