This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I'm a Java developer and I want to start to learn another languages to the JVM. Why should I choose Scale instead of Groovy, Clojure or Jython? What can Scala provide me that other languages to the JVM cannot do? Is the Scala syntax difficult to learn? Is it very different from the Java one?
I know that they are a lot of questions but I want to use my little free time in something which can be useful for me.
Thank you so much in advance!
Any correction of my English will be gratefully accepted.
Scala's syntax looks similar to Java initially and is statically typed like Java, so it's easier to start with than, say, Clojure. And it's very easy to use Java libraries inside Scala, for example. Several organisations have taken advantage of this similarity to help their Java developers make the transition to Scala - initially developers write in a "Java-as-Scala" style, but gradually adapt to writing more idiomatic Scala as they become comfortable with functional programming etc. Syntax is easy to learn, whatever language you're using, but you need to understand the programming paradigm underneath the syntax. So for Scala and Clojure, you would need to learn about functional programming in order to make best use of them. But this is also what makes these languages interesting and fun to learn about.
The free online Coursera course Functional Programming Principles In Scala is running again from 25 March if you want to learn about FP and Scala from the guy who invented the language, Martin Odersky. I took this course in the autumn and it was excellent - I learned a great deal in a short time, and it's really made me keen to find out more about FP and Scala in particular. I can highly recommend this course, and I think learning about FP can help to make you a better programmer, whichever language you work with in future.
As for your other JVM options - Clojure is interesting as a dynamically typed FP alternative, but so far I have found it harder to get used to a Lisp language. Groovy is great and very easy to learn if you're coming from a Java background, but Groovy is solving different problems than Scala, e.g. I think Scala is designed to provide much better scalability and concurrency than Groovy. I haven't used Jython, but I would have slight reservations about adopting a language that's really a JVM-port from a completely different platform, although I like Python too.
I can highly recommend "The Well-Grounded Java Developer" by Benjamin Evans and Martijn Verburg, which has a lot of stuff about "polyglot programming" with alternative JVM languages, including Scala, Groovy and Clojure. And it will help with your Java programming as well.
No more Blub for me, thank you, Vicar.
Joined: Apr 23, 2008
First of all, thank you so much! That has been what people calls a complete answer ;-)
About the Coursera course Functional Programming Principles in Scala, I signed up for it several days ago and, in accord with what you say about the course, I took the correct decision. I think I'll spend my time learning Scala before deal with Clojure. The course will give me the necessary background to understand that language.
About Jython, I'm taking part in the A Gentle Introduction to Python course, and it would be a natural step for me. In this way, I could practice the acquired knowledge over the JVM.
Groovy is one item in my TO-DO list, but always I have found another thing that has caught my eye, but your recommendation for the The Well-Grounded Java Developer and what this book offers (as TDD), have convinced me to give a chance to it.
Thank you so much. It has been an absolutely pleasure to read you answer. You have shed light on my dudes.
If you have time before the Scala course starts, it might be a good idea to read through Chapters 1 and 2 of Structure And Interpretation Of Computer Programs (SICP) which is available online for free. The Scala course uses some examples from SICP, and many of the ideas are the same. But don't panic if you don't have time or don't understand all of it. The Scala course will tell you everything you need to know anyway.
Also, get a copy of Odersky's book Programming In Scala, as some of the examples in there are also similar to ones in the course, and it's an excellent guide to the Scala language as well.
Finally, make sure you get your environment set up early, so you can avoid having to deal with IDE problems while you're trying to learn FP and Scala at the same time. The first steps in the course explain how to do this - the instructions may be available for you to do this before the course starts. You'll be using Scala IDE (Eclipse) and the Scala "simple build tool" SBT - the course tells you which versions you need - and you'll probably need to change the Eclipse memory settings (instructions on the course pages).