Scala Programming for Java Developers

Duration: 3 days
Type: advanced


Scala is a new language which integrates seamlessly into the Java platform. It provides an implicitly typed alternative to Java which is not limited by the constraints of backward compatibility. Scala was designed as a hybrid language that combines full object-orientation with the core features of functional programming, making it an ideal choice for tasks such as highly concurrent applications and XML manipulation.

This course provides a high speed introduction to Scala for experienced Java developers. It does not waste time rehashing familiar territory but instead builds on top of delegates existing knowledge. By the end of the course delegates will be able to write and test JSE applications using all the features of the Scala language.


Delegates must have a minimum of three years commercial Java programming experience. Knowledge of the basics of Test Driven Development is helpful, as is prior exposure to functional programming concepts (via Lisp, XSLT, F# etc...).

List of Modules

The Evolution of Scala

A brief history of the Java platform to date
Distinguishing between the Java language and platform
Pain points when using Java for software development
Possible criteria for an improved version of Java
How and why the Scala language was created

Key Features of the Scala Language

Everything is an object
Class declarations are simplified
Data typing is strong but mostly inferred
Operators are methods and methods can be operators
There is very powerful support for pattern matching
Functions are values and first class citizens
Anonymous and nested functions are supported
Traits are used instead of interfaces

Basic Programming in Scala

Built in types, literals and operators
Testing for equality of state and reference
Conditionals, simple matching and external iteration
Working with lists, arrays, sets and maps
Throwing and catching exceptions
Adding annotations to your code
Using standard Java libraries

OO Development in Scala

A minimal class declaration
Understanding primary constructors
Specifying alternative constructors
Declaring and overriding methods
Creating base classes and class hierarchies
Creating traits and mixing them into classes
How a Scala inheritance tree is linearized

Functional Programming in Scala

Advanced uses of for expressions
Understanding function values and closures
Using closures to create internal iterators
Creating and using higher order functions
Practical examples of higher order functions
Currying and partially applied functions
Creating your own Domain Specific Languages (DSL's)

Pattern Matching in Depth

Using the match keyword to return a value
Using case classes for pattern matching
Adding pattern guards to match conditions
Partially specifying matches with wildcards
Deep matching using case constructors
Matching against collections of items
Using extractors instead of case classes

Test Driven Development in Scala

Writing standard JUnit tests in Scala
Conventional TDD using the ScalaTest tool
Behavior Driven Development using ScalaTest
Using functional concepts in TDD

XML Manipulating in Scala

Working with XML literals in code
Embedding XPath like expressions
Using Pattern Matching to process XML data
Serializing and deserializing to and from XML

Writing Concurrent Apps Using Actors

Issues with conventional approaches to multi-threading
How an actor-based approach helps you write thread safe code
The Scala architecture for creating actor based systems
Different coding styles supported by the actor model