The Scala Programming Language
Scala is a relative newcomer to the programming scene, but it’s popularity has grown quickly. Built to be a scalable, general purpose language, Scala combines concepts of object-oriented and functional programming languages, and can easily be integrated into existing code.
Scala was first conceived in 2001 at École Polytechnique Fédérale de Lausanne by Martin Odersky, who had previously worked on Generic Java, javac, and EPFL’s Funnel programming language. Scala’s first public release came in 2004, followed by version 2.0 in March 2006. It has quickly gained in popularity, particularly amongst existing Java developers, and in 2012 it was named the winner of the ScriptBowl contest at the JavaOne conference.
Some of the key characteristics of Scala include:
- It is an object-oriented language that supports many traditional design patterns from previous programming languages.
- It is also a functional language with first-class functions, libraries, and immutable data structures.
- It was designed to be used as or incorporated into a traditional object-oriented language (such as Java) and then be gradually transitioned into more functional style over time.
- The Scala compiler can infer the types of most variables, so there’s no need to declare them.
- It allows programmers to designate multiple traits for a class, and then combine their interface and behavior.
- It supports first-class objects and anonymous functions.
- Scala supports concurrent and distributed computing.
Why Scala Is Popular
However, Scala is much more than an alternative to Java. It is a more concise language, utilizing simple, easy-to-read syntax, and typically requiring a fraction of the lines of code when compared to a typical Java program. This makes Scala faster to code, easier to read, and easier to test. And with the inclusion of functional elements, it offers a powerful, streamlined alternative.
Regardless of your learning style, there are easy ways to get started and master Scala.
There are plenty of Scala tutorials available online. The official Scala Documentation page has a resource section filled with tutorials, style guides, and cheat sheets, but these were clearly written by the Scala team, and may not be the best resources for Scala newbies. If you really want to learn to language, check out some of these pages.
- Tutorials Point: this site walks you through each of the language’s basic elements. If you’re considering Scala, it’s a great place to start. There is also a PDF version, which is a more in-depth version of the same tutorial.
- Scala Tutorials: this site provides a basic interactive tutorial.
- Jenkov.com Scala Tutorial: this series offers a thorough overview of the language and breaks down its programming principals by applications.
Since Scala is a relatively new programming language, you won’t find as many books on it as you would Java or C, but there is still a small handful of books to get you started, regardless of your previous programming experience.
- Programming in Scala: A comprehensive Step-by-Step Guide by Martin Odersky: written by Scala’s creator, this book starts with the fundamentals and builds to advanced programming techniques.
- Scala for the Impatient by Cay Hortsmann: a code-based introduction to the language, intended for experienced programmers.
- Scala in Depth by Joshua Suereth: this book is designed for Java programmers who want to integrate Scala into their existing projects.
- Introduction to the Art of Programming Using Scala by Mark Lewis: one of the few Scala books out there for beginning programmers, this title was written for introductory computer science classes.
- Atomic Scala by Eckel and Marsh: this is another book for new programmers, specifically designed for people without a background in Java.
If you find it hard to learn programming through a webpage or book, these video lessons may be more your speed.
- Learning Scala Programming: this video training series includes nearly 5 hours of instruction in 50+ lessons. Taking a project-based approach, it is designed to help viewers make real-world connections with the concepts being covered.
- Scala Programming LiveLessons: with over 4 hours of lessons, this training series breaks learning down into major concepts, such as fundamentals, data grouping, and objects.
- Functional Programming Principals in Scala: this online course, taught by Martin Odersky, was originally run in 2011, but you can still sign up and view all of his lecture videos for free.
The Scala community is growing all the time, and so are the number of free resources available to new and experienced developers. Here are some of the best we’ve found:
- Scala’s official website: This site contains everything you need to get started, including binary files, API docs, tutorials, mailing lists, and a whole lot more.
- Glitter: this Scala chat room is a great place to get questions answers and join in community discussions.
- First Steps to Scala: this intro to Scala was created by Martin Odersky and the co-authors of his Programming in Scala book mentioned above.
- Scala School: These Twitter-based lectures were designed to help experienced programmers make the transition to Scala.
- Java to Scala Cheatsheet: As the name implies, this is an essential resource for Java programmers looking work in Scala.
- Scala Style Guide: we already mentioned Scala’s official site, but this particular resource is worth pointing out all on its own. If you’re considering Scala, this is a must-have.
Whether you’re new to programming, or looking for a fast, modern language that combines the best of object-oriented and functional programming, Scala is definitely a language worth learning. The resources here should help you get started.