Course 495:
Programming with Scala: Basics and Beyond

(5 days)

 

Course Description

This course combines the basic and advanced courses on programming with Scala into a single week. It will teach you the basics of the language and take it further, covering the idiomatic aspects of the syntax, with an eye to the creation of Domain Specific Languages in Scala and being able to read and understand the most complex code.

Learning Objectives

  • Gain a deep grasp of the Scala programming language
  • Understand the idioms of object-oriented programming in Scala
  • Understand the idioms of functional programming in Scala
  • Get a good feel for implicits, what they are for, and how they work
  • Learn about using Scala to create your own Domain Specific Languages (DSLs)
  • Become comfortable writing advanced Scala code through hands-on labs

Who Should Attend

The intended audience consists of professional developers of any background who are looking to learn and specialize in Scala development, fast-tracking their understanding of the language with an intense week of training and hands-on labs

Prerequisites

In order to make the most of this course, prospective students should have a couple of years of solid professional experience in at least one object-oriented programming language.


Course Outline

  • Overview
    • Scala Overview
      • About Scala and Its Uses
      • REPL, IDEs, and sbt
      • Statements, Expressions, Blocks
      • Variables (val and var) and Type Inference
      • Declaration, Initialization, Assignment, Reference
  • The Basics
    • Data Types and Operators
      • Numeric Types and Operators
      • Boolean Values and Operators
      • Strings, Characters, and Operations on Them
      • Tuples
    • Flow of Control
      • The If Expression
      • For, Generators, and For Comprehension
      • While and Do-While
      • Simple Pattern Matching
  • Classes
    • Instantiation
      • Primary Constructor and Constructor Overloading
      • Constructor-Local Parameters and Variables
    • Defining and Using Classes
      • Positional and Named Method Parameters
      • Access Modifiers and Scope of Protection
      • Fields and Accessor Methods
  • Objects
    • Objects vs. Classes
    • Companion Objects
  • Inheritance
    • Basic Examples
    • Overriding of Stable/Unstable Members
    • Constructor Inheritance
    • Abstract Classes and Methods
    • Protected Modifier and Access Modifier Recap
  • AnyVal
    • What Is AnyVal?
    • How Scala Treats AnyVal Types
    • Extending AnyVal
  • Custom Operators
    • Operators as Methods
    • Idiomatic Method Invocation
      • Prefix, Infix, and Postfix Notations
    • Defining Operators
      • Unary, Left-, and Right-Associative Operators
      • Operator Precedence
      • Assignment Operators
  • Traits
    • The Need for Traits
    • Using Traits
      • Declaring and Mixing-In
      • Overriding Traits
      • Mixing-In at Object Creation
  • Linearization of Traits
    • Stackable Trait Pattern
    • Abstract Overrides
  • Generic Types and Methods
    • Declaration, Reference, Assignment
    • Upper Bounds
  • Variance in Scala
    • What Is Variance?
    • Invariant, Contravariant, Covariant
    • Upper Bounds and Lower Bounds
  • Collection Types
    • Scala Collections API
      • List, Vector, Set
      • Map
      • Default Implementation Classes
    • String and Array Wrapping
    • Mutable vs. Immutable Collections
    • External vs. Internal Iteration
    • Main Collection Operations and the Cons Operator
  • Def, Val, Lazy Val
    • Review
    • Run-time Differences
  • Streams
    • Potentially Infinite Collections
  • Exception Handling
    • Traditional Approach
    • The Union Type Approach
    • The Try Type
  • Functional Programming
    • An Intuitive Approach
    • Functional Syntax and Lambdas
      • Lambda Shortcuts
    • Closures
    • Higher-Order Functions
    • Functions vs. Methods
      • Eta Expansion
    • Recursion and Tail Recursion
    • Partial Application and Currying
  • Functional Programming and Collection
    •  List Pattern Matching
    • map, filter, flatMap
    • Folding and Reductions
    • For Comprehension Equivalence
    • Functional Use of Option and Try
      • Mapping, Flattening, and Flat-Mapping
  • TDD Principles and ScalaTest
    • Testing Styles
  • Using ScalaTest and ScalaMock
    • Matchers
    • Stub and Verify Approaches
  • Extractors
    • Case Class Features
    • Defining Extractor Methods
      • Fixed Arity
      • Variable Arity
      • Infix Operator
      • Boolean
    • Use of Extractors
      • Pattern Matching
      • Variable Assignment
      • “for” Generators
  • Introduction to Implicits
    • Two Flavors
    • What They Are For
    • How They Work
  • Implicit Parameters
    • Two Flavors
    • Resolving Ambiguitie
  • Implicit Conversions
    • Conversion Classes
    • Conversion Methods
    • Implicit Extensions
  • Implicit Application, Resolution, and Scope
  • Call-by-Name vs. Call-by-Value
    • Background
    • Call-By-Name Syntactic Sugar
  • Type Classes
    • Background
    • Definition and Usage
    • Context Bounds
    • Partial Functions
    • What Is a Partial Function?
  • Partial Function Methods
    • Map as a Partial Function
    • Lifting Partial Functions
  • Scala for DSLs
    • Accessor and Mutator Methods
    • Method Invocation Operators
    • Operator Overloading
    • Call-By-Name Blocks
    • Extractor Methods
    • Interpolators
    • Partial Function Idiom

Please Contact Your ROI Representative to Discuss Course Tailoring!