A while back I read a blog post titled “If you have to learn just one programming language” by Babu Srinivasan in which he played with the scenario where you as a professional developer were to learn one, and only one, new programming language. In the post he listed 13 criteria and then compared a bunch of languages to those. Out of all of the languages, which consisted of Common Lisp, Scheme, Fortran, Smalltalk, C, C++, Objective C, Ada, Java, Javascript, C#, D, Prolog, Perl, PHP, Python, Ruby, Groovy, Clojure, Lua, Forth, Factor, Erlang, OCaml, F#, Clean, Haskell and Scala he proclaimed Scala the winner.
While I think it’s an excellent idea to learn new programming languages, if not only to view the ones you work with on a daily basis from a new perspective, I’ve been kind of stuck in the .NET world since I started working professionally with software development. Reading Babu’s article peaked my interest not only in Scala but in learning a new language in general. Also, in June I had the pleasure to attend the Norwegian Developers Conference where there was quite a lot of talk about looking outside the Microsoft ecosystem (if not only to bring back new ideas to it), particularly at Ruby.
So, I decided to learn (at least) one new language this summer and while there are quite a few languages that interest me I thought I’d give Scala a go as it seems to be a fascinating programming language with a bright future ahead of it.
I think writing is a great way to consolidate and cement knowledge so therefore I plan to write about my experiences and what I’ve learned from diving into Scala in a series of blog posts of which this is the first. They will be very basic, at least at first, and written from a C# and (sometimes) Java developers perspective. Join me on an adventure outside the comfort zone?
Scala is a statically typed language that was conceived in 2001 by Martin Odersky who has also written the Java reference compiler and co-authored Java generics. It is both a functional language, meaning that functions are values, and also an object oriented language where every value is an object. Scala compiles to byte code for the Java Virtual Machine (JVM) making it platform independent. That also means that we from a Scala program can use existing Java libraries and vice versa. While it seems the primary focus is on the JVM it can also be compiled for the .NET framework’s Common Language Runtime (CLR).
Other than the fact that Scala is a multi paradigm language that can be used both on the JVM and the CLR I’ve also found a bunch of other things that I find interesting about it:
For some great slides on the many cool things that Scala has to offer check out Jonas Bonér’s Pragmatic Real-World Scala presentation.
When it comes to learning a technology that I’m totally new to I like to enlist the help of a book. I settled on Programming Scala by Dean Wampler of Object Mentor and Alex Payne from Twitter, mainly because it was the shortest book I could find about Scala. While I put my faith to this book to give me a solid introduction to Scala I will probably create my own curriculum to suite my, and hopefully the readers of this blog’s, background.
In the next part of the series we’ll look at how to install Scala and at a few tools that we can use. Once we’re done with that we’ll do the mandatory Hello world application in the third part of the series.
PS. For updates about new posts, sites I find useful and the occasional rant you can follow me on Twitter. You are also most welcome to subscribe to the RSS-feed.
This blog is built with EPiServer Community, EPiServer CMS, ASP.NET MVC and a bunch of other great products. The source code is available for download at the projects page, where you also can read more about this site and my other projects.
read more
Comments
JK 1 years ago
Scala is not very good for beginners. For start it classpath documentation is very small, sometimes misses completely. In many cases you simply have to fallback into java.
Next, there is IDE support but is still far behind Java or other languages. How you want to learn refactoring if your tools does not support it or crashes when you try?
And last, Scala is very elegant, but mixes many paradigmas together. Also corner cases can be very complex and error messages very hard to understand.
I would not recommend Scala to complete beginner, I think Java would do better job.
steve 1 years ago
@JK:
Sorry, but the things you claim are just not true.
1. Scala is a very good language for beginners, because it is much more consistent than Java and doesn't force you to use AOP, Dependency Injection, Annotations or XML config like Java if you want to do anything remotely complex later on.
2. The documentation is usually not small and Scaladoc is no match for Javadoc at all (client-side filtering, collapsible elements, much more links to other helpfull classes, more information about super and sub classes, direct link to source code.)
3. Scala has the best IDE support right after Java on many Java IDEs. And that's only weeks after the release of Scala 2.8. In some parts the Scala support just needs more features, because Scala is much more powerful than Java.
4. That's why Scala is sometimes called an object-functional hybrid. Scala integrates OO- and FP-concepts in very straightforward ways. No other language to this date has achieved this tight and beautiful integration between object-oriented and functional paradigms.
Just look at other languages who tried to "bolt on" some additional paradigms like Java 7, C# 4, Ocaml, F# or PHP and you will see that Scala is much cleaner, easier and more predictable.
5. I would never recommend Java to a beginner: the ugly mismatch between primitives and objects, between == and equals, between numbers and BigInteger/BigDecimal, the non-integration between collection classes and arrays, the use-site variance, the checked exceptions, tons of useless boilerplate the need to use AOP, Annotation-Frameworks and XML configuration to do anything elaborate is just too much for a beginner.
Additionally Java doesn't even have a REPL, which might be the most important tool for teaching and learning, because it eliminates that write-build-run-cycle and gives helpful feedback immediately.
jk 1 years ago
I am not going to argue. Just one point: I dont think begginer should even know what is AOP or Dependency Injection.
Scala is more powerful then Java, I dont think this is good for beginners.