O'Reilly logo
live online training icon Live Online training

Scala Fundamentals: From Core Concepts to Real Code in 5 Hours

Simon Roberts

“Scala Fundamentals: From Core Concepts to Real Code in 5 Hours” teaches core Scala syntax and concepts quickly and easily so you can get started programming today. In this course, expert programmer and trainer Simon Roberts introduces the concepts and techniques of Scala.You’ll learn the fundamental syntax and how to work with functions, methods, classes, objects, and the essentials of functional programming style along with other key concepts.

This course is aimed at mid-level programmers who have a working understanding of basic programming concepts in some other language. The topics of the course are carefully selected to give you enough of the essentials to get going, avoid most of the surprises the language can give, and to use as a foundation for your own research and deepening your own knowledge after the course, without laboring every last detail and variation. You’ll pick up the most-used concepts and the syntax elements that support them. The course is delivered in a highly practical style, with lots of code examples--created while you watch--that you will take away and keep. The delivery is heavy on understandability, practical usability, and light on academic formality.

What you'll learn-and how you can apply it

  • Scala source file structure and program launch
  • Types, literals, variables, functions, expressions and operators
  • Structured data, classes, objects, arrays, tuples, and lists
  • Control structures: conditions, recursion, for expressions
  • Higher order functions
  • Catching / matching, and throwing exceptions

This training course is for you because...

  • You might be a programmer in another language, such as Java, JavaScript, Python, or C/C++ looking to broaden your horizons
  • You might be a student about to take a course in Scala, or have taken classes in other programming languages, and want to learn about another
  • You just want to find out a bit about Scala

Prerequisites

  • You should be comfortable reading procedural program code written in some other programming language (for example, Java, JavaScript, Python, or C/C++)
  • Some understanding of Object Oriented and functional programming concepts will help, but is not required

Materials, downloads, or Supplemental Content needed in advance - It’s recommended that you have a development environment installed and configured with a Scala environment.

Resources - Source code repository on github.com will be used to distribute examples created during the course

About your instructor

  • Simon started out working as a software engineer, specializing in industrial control systems, and had a sideline teaching for a local University in his then-home-town of Cambridge, England.

    In 1995 he joined Sun Microsystems, Inc. as a senior instructor and course developer. Simon spearheaded the introduction of Java training by Sun Microsystems in the U.K. in 1995. He developed the first Java certification exams for Sun before he moved to the U.S. in 1998.

    Since leaving Sun in 2004, Simon has developed and delivered training for clients around the world.

    Simon believes that training should have an immediate purpose and application, and that the most effective training is usually "on the job" mentoring, helping to remove the immediate roadblocks to productivity that so often plague workers in fast moving environments.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Hour 1

  • Getting started, an overview of unavoidable concepts and the “Hello world!” example (15 minutes)

  • Source-files and classes

  • Classes vs. objects
  • Packages and import
  • Program start up and the main method
  • Introducing the String

  • Simple calculations (35 minutes)

  • Key Scala types: numbers, boolean, objects, and type hierarchy

  • Declaration types, val, var, and def
  • Expressions, literals, variables, string interpolation, and “computations”
  • Many of something: using Lists and arrays
  • A lightning tour of key operators and precedence rules

Break: 10 Minutes

Hour 2 - Control structures (20 minutes) - Blocks as expressions - The if expression - The while loop - Range types and a simple for expression

  • Structured types (15 mins)
  • Tuples, creation, assignment, field access
  • Simple class declarations
  • Companion objects
  • Fields and initialization
  • Auxiliary constructors

  • Declaring methods (15 minutes)

  • Declaring a method: name, arguments, default arguments, and return type

  • Providing the method implementation
  • Defining the return value

Break: 10 Minutes

Hour 3

  • More about methods and functions (50 minutes)

  • Invoking a method, argument lists, parentheses, named arguments

  • Infix invocation
  • Declaring functions
  • Pure function concept
  • Recursion
  • Assembling results in recursive functions
  • Tail recursion

Break: 10 Minutes

Hour 4

  • Higher order functions (50 minutes)

  • Passing behavior as arguments and return values

  • Function literals, the lambda expression form
  • Key operations on Lists: foreach, filter, map, flatMap
  • Using fold / reduce operations for iteration

Break: 10 Minutes

Hour 5

  • Using match clauses (10 minutes)
  • Catching and matching exceptions (10 minutes)
  • Throwing exceptions
  • Reading a file (5 minutes)
  • The apply and update methods (10 minutes)
  • Introduction to implicits (15 minutes)