Scala Programming Introduction
(C) Copyright Elephant Scale
September 05, 2022
Overview
Scala may be the next wave in developer productivity. It is concise, object-oriented, functional, and offers support for concurrency, but is compatible with Java and is JVM – based. Scala is also a great platform for functional programming. For these reasons, Scala has been attracting the interest of many organizations.
This training is targeted for programmers who need to get introduced to Scala. They may be new to Scala, they may be coming from a Java, Python, or even mainframe environment.
This training program is designed to help developers learn the language through guidance and hands-on training.
Goals
- Learn one of the hottest languages
- Be a productive programmer with Scala
- Learn functional programming style
- Learn the best software development practices with Scala
Audience
- Developers, architects
Skill Level
- Introductory – Intermediate
Duration
- Three days (can be customized)
Format
- Lectures and hands-on labs (50% – 50%)
Prerequisites
- Comfortable with development in an object-oriented environment
- Even though most people come to Scala from Java, any experienced developers are welcome
Lab environment
Local environment (Highly recommended)
We recommend attendees have a local environment setup. Install the following:
- JDK 11 or higher
- Scala latest 2.x (2.13)
- Scala programming IDE, such as IntelliJ IDEA (recommended), Eclipse, or NetBeans.
Cloud environment
A cloud-based environment can be provided if required.
Students will need the following
- A reasonably modern laptop with unrestricted connection to the Internet. Laptops with overly restrictive VPNs or firewalls may not work properly.
- A modern browser
Detailed Course Outline
Introduction to Scala
- From Java to Scala
- JVM language and interoperability
- A quick tour of Scala features
- What’s new in Scala 3
- Lab: Installing and setting up Scala
Getting Started with Scala
- Scala REPL environments
- SBT
- Lab: First Scala program
- Lab: Working with SBT
Scala Types
- Built-in types
- Variables and immutability
- Type inference
- Lab: Working with types and type inference
Scala Collections
- Built-in collections
- Mutable and immutable collections
- Arrays, Lists, Sets, Maps
- Understanding the performance of various collections
- Lab: Working with collections
Control Flow and Functions
- IF-Else
- Loops
- Match expressions
- Functions
- Anonymous functions
- Higher order functions
- Pure functions
- Lab: control flow
- Lab: functions
Functional Programming
- Evolution of programming and functional programming
- Introduction to functional programming
- Filter, Map, Reduce
- Lab: functional programming
Scala Classes
- Defining and using classes in Scala
- Singleton classes
- Packages and imports
- Inheritance and abstract classes
- Traits
- Lab: Working with classes
Case Classes and Pattern Matching
- Understanding case classes
- Pattern matching with Case classes
- Handling null values using Options
- Lab: working with case classes, options and pattern matching
Testing
- Testing strategies in Scala
- Learning various testing frameworks
- Lab: Testing with Scala
IO programming
- Understanding Scala IO system
- Reading/writing data from/to files
- Reading from URLs
- Network socket programming
- Lab: IO programming in Scala
- Lab: Simple web server in Scala
Concurrency Programming With Akka Framework
- Concurrent programming concepts (threads, locks, race conditions, dead-locks ..etc)
- Introduction to Akka
- Learning Actor based systems
- Lab: Concurrent programming with Akka
Workshops
Students will design and implement solutions using Scala