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?
A first look at Scala
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:
- Scala is very well suited for creating both internal and external domain specific languages (DSLs).
- Scala has structural typing, sometimes referred to as duck typing done right (I have no idea if it actually is though). David Pollak describes Scala as “the statically typed dynamic language”.
- Scala has traits which can be likened to interfaces with implementations, or controlled multiple inheritance.
- Scala supports both thread based and message based concurrency, the latter using the actors model like Erlang.
- There are a number of web frameworks for Scala of which Lift seems to be the most popular.
- Several Java IDEs have support for Scala.
- There are a number of existing testing frameworks, both for creating traditional unit tests and BDD-style tests.
- Scala works smoothly on Google App Engine and can be used to create Android apps.
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.
My learning companion
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.
The next step
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.
Posts in the series
- Introduction (this)
- Installation and tools
- Executing Scala code
- Classes and constructors
- If statements and loops
- Scala’s type hierarchy and object equality
- Uniform Access
- And more coming in the near future…
- Learning Scala part six – If statements and Loops
- Learning Scala part eight – Scala’s type hierarchy and object equality
- Learning Scala part three – Executing Scala code
- Learning Scala part nine – Uniform Access
- Learning Scala part seven - Traits
- Learning Scala part four – Classes and Constructors
- Learning Scala part two – Installation and tools
- Learning Scala part five - Methods