Scala is an object-oriented language that runs on the Java Virtual Machine. Scala is also a functional language, and combines the features and benefits of OO and functional programming. This course provides a fast-paced introduction to the language for developers with experience in similar languages (e.g. Java, C#, or C++), and then delves deeper into idiomatic uses of Scala in practice.
This module introduces the key features of Scala. We explain the kinds of problems that Scala is designed to solve, and give a brief overview of some the key characteristics in Scala that make it attractive in these scenarios. For example, we'll describe the object-oriented and functional aspects of Scala, and we'll describe how Scala relates to Java and the JVM. We also show how to get started compiling and running Scala code.
This module dives into the core syntax rules in Scala. We describe the essential data types you need to know to get started, and discuss the rules for defining and using variables. We also describe the important role of tuples in Scala. The module also discusses how to organise code, import types, and use abstract types and parameterised types.
Every language has its own rules and foibles for implementing flow control. This module describes the Scala approach to decision-making and looping, and also describes the various operators available. Additionally, the module investigates how to do pattern matching and use enumerations in Scala.
This module takes a detailed look at how to define and use traits in Scala. Scala traits are similar to Java interfaces - you can define a trait to specify a slice of functionality that should be supported by other types. Like in Java 8, Scala traits can contain partial implementation code - this means a class can effectively achieve multiple inheritance in Scala, by inheriting from multiple traits. We explore the syntax and usage patterns in this module.
Scala is an object-oriented language, which means it supports the notion of classes, objects, encapsulation, inheritance, and polymorphism. However, Scala makes it much easier to define classes than in Java (for example) - the syntax is much more concise, and you get a lot of "goodies" for free. We describe how it all works in this module. We also explore several related concepts, including visibility, overriding members of classes and traits, companion objects, and case classes.
This module investigates miscellaneous useful features in the Scala object system. We start with Predef, and show how it provides type aliases for commonly-used types. We move on to investigate the role of statics in Scala, followed by a discussion on sealed class hierarchies and the Scala type hierarchy in-the-large.
This module describes how to do functional programming in Scala. We begin by explaining what this actually means, and summarize the key language features and techniques in Scala that make functional programming a reality. During the module we'll cover important topics including recursion, function literals and closures, functional data structures, pattern matching, partial functions, and implicits.
Concurrency has become increasingly important in recent times and Scala has excellent support for creating highly concurrent and efficient code, as we show in this module. We describe the problems of shared state, explain how to define actors, and show how to send messages to actors. We explain the role of the Mailbox, and also describe essential threading and eventing issues.
This module describes how to use Scala to implement Domain Specific Languages (DSLs), i.e. a vocabulary of types, methods, and attributes that are specific to a particular domain of interest. The ability to define DSLs is a great strength of Scala, so a thorough knowledge of creating DSLs using Scala is essential if you want to get the most out of the language.
This module digs deeper into the Scala type system. The module describes how to use reflection, define parameterised types, and implement variance under inheritance. The module also duscusses type bounds, abstract types, path-dependent types, and value types.
This module discusses application design best-practices in Scala. We describe the role of annotations, enumerations, and exceptions. We also discuss how to use traits effectively, and review various design patterns from a Scala perspective.