Learn By Example: Scala
4.0 (656 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
5,303 students enrolled

Learn By Example: Scala

65 examples that will bring Scala to life for you
4.0 (656 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
5,303 students enrolled
Created by Loony Corn
Last updated 2/2018
English
English [Auto]
Current price: $59.99 Original price: $99.99 Discount: 40% off
2 days left at this price!
30-Day Money-Back Guarantee
This course includes
  • 7 hours on-demand video
  • 127 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Use Scala with an intermediate level of proficiency
  • Read and understand Scala programs - including those with highly functional forms - written by others
  • Identify the similarities and differences between Java and Scala, and use both to their advantage
Course content
Expand all 72 lectures 06:51:39
+ Introducing Scala
9 lectures 56:18

A quick run-through of the reasons why people are so excited about Scala

Preview 10:11

Let's plunge in! Setting up Scala is surprisingly simple. You do need Java though.

Installing Scala
09:43

Immutable variables are a big part of Scala - understand why.

Example 3 - Mutable and Immutable ‘variables’
05:16

Scala aims to achieve the best of both worlds: rapid prototyping like Python, type safety like Java, C++ and other statically typed languages.

Example 4 - Type Inference
06:34
Type Inference
1 question
Example 5 - String Operations
04:29

Scala has 3 types that unify the type system: Any (literally anything!), AnyRef (supertype to all reference types) and AnyVal (supertype to all value types)

Example 6 - A Unified Type System
05:28

Nil, null, Null, Nothing, Unit..Scala has many ways to skin a non-existent cat!

Preview 05:39
Example 8 - Type Operations
03:53
+ Expressions or Statements?
13 lectures 59:46

This is an important semantic difference - statements don't return a value, while expressions do. Scala converts many familiar constructs into expressions - which allows them to be composed.

Example 9 - Statements v Expressions
05:57

Expression blocks are prototypical "r-values", i.e. they sit on the right of assignment statements.

Preview 02:29
Example 11 - Nested Scopes in Expression Blocks
04:53

Scala has if-else expressions (not if-else statements). This is a fine point, and an important one.

Preview 05:21

Pattern matching is very easy in Scala - this is a more popular language construct than if/else expressions

Example 13 - match expressions
05:39
Example 14 - match expressions: Pattern guards & OR-ed expressions
04:26
Example 15 - match expressions: catch-all to match-all
06:14
Example 16 - match expressions: down casting with Pattern Variables
07:00
Pattern Matching
2 questions

Scala has a way to convert for loop statements into for loop expressions - using 'yield'

Preview 07:48
Example 18 - for loops: 2 types of iterators
03:17
Example 19 - for loops with if conditions: Pattern Guards
02:39

While loops are pure statements, and are rather clunky. See why they are not the most popular construct in town.

Example 21 - while/do-while Loops: Pure Statements
03:33
For Loops
2 questions
+ First Class Functions
20 lectures 01:59:01

Functions are 'first class citizens' in Scala - this actually has a technical term!

Preview 07:29
Functions v Methods
06:05
Example 22 - Functions are named, reusable expressions
06:06
Example 23 - Assigning Methods to Values
08:59
Example 24 - Invoking Functions with Tuples as Parameters
05:57

Scala allows parameters to be specified out of order - using their names

Example 25 - Named Function Parameters
03:38

Yet another mechanism to encourage code re-use

Example 26 - Parameter Default Values
03:59
Parameter Default Values
1 question

Scala loves using formidable terms for everyday concepts:-) Think generics in Java.

Example 27 - Type Parameters: Parametric Polymorphism
07:13
Example 28 - Vararg Parameters
04:57
Example 29 - Procedures are named, reusable statements
05:30
Example 30 - Functions with No Inputs
03:40
Example 31 - Nested Functions
04:04

Functions that take in other functions as parameters, or return function objects, are called Higher Order Functions

Example 32 - Higher Order Functions
07:37
Higher Order Functions
1 question
Example 33 - Anonymous Functions (aka Function Literals)
02:44

Partially Applied Functions are a really cool code re-use trick: fix some (but not all) parameters of a function and you have a new function!

Example 35 - Partially Applied Functions
07:22
Partially Applied Functions
1 question
Parameter Groups
1 question
Example 37 - By-Name Parameters
09:01
By-Name Parameters
1 question
Example 38 - Closures
10:11
+ Collections
13 lectures 01:34:16
Example 39 - Tuples
10:31
Tuples
1 question
Example 40 - Creating Lists
08:53
Example 41 - Simple List Operations
07:48
Lists
1 question
Example 42 - Higher Order Functions Introduced
12:49
Simple Higher Order Methods
1 question
Example 44 - Fold, FoldLeft, FoldRight
02:28
Example 45 - Reduce,ReduceLeft,ReduceRight
05:21
Example 46 - Other, Simpler Reduce Operations
02:39
Scan
2 questions
Fold
1 question
Reduce
1 question
Maps
1 question
Example 48 - Mutable Collections, and Arrays
10:03
Mutable Collections and Arrays
1 question
Example 49 - Option Collections
05:55
Example 50 - Error handling with util.Try
04:07
Options
1 question
+ Classes and Objects
16 lectures 01:19:57
Example 52 - Primary v Auxiliary Constructors
03:59
Primary Constructors
1 question
Example 53 - Inheritance from Classes
06:03
Example 54 - Abstract Classes
02:49
Example 55 - Anonymous Classes
02:59
Example 56 - Type Parameters
03:14
Example 57 - Lazy Values
04:27
Example 58 - Default Methods with apply
04:17
Example 59 - Operators
04:30
Example 60 - Access Modifiers
05:25
Example 61 - Singleton Objects
05:33
Example 62 - Companion Objects
09:10
Example 63 - Traits
06:10
Traits
1 question
Example 64 - Case Classes
03:25
Example 65 - Self Types
07:19
Requirements
  • Basic knowledge of programming, ideally in Java or C#
  • The course will cover the installation of Scala - no worries on that front!
Description

These 65 examples will make this cool-new-kid-on-the-block your steady, reliable friend

Let's parse that.

  • Scala is cool because its all the rage for big data applications, and because it manages to be more sophisticated and elegant than Java.
  • That said, Java is a steady, reliable friend - a language you can depend upon, and in which you can express yourself. 
  • These 65 examples will help you trust Scala the way you trust Java. Each is self-contained, has its source code attached, and gets across a specific Scala use-case. Each example is simple, but not simplistic.

What's Included:

  • The Big Ideas: Before we get to the how, we better understand the why - this course will help clarify why we even need Scala when Java serves us so well
  • The Little Details That Matter: Pattern Matching, If Expressions, For Loops & Yield: Java has if-statements, while Scala has if-expressions. Differences like these matter, this course will cover them.  
  • First Class Functions are perhaps the most dramatically new feature of Scala - the foundation of functional programming support.
  • Collections - Lists, Options, the Details of fold/reduce/shift in Scala  are yet another bit of the language that differs significantly from other traditional object-oriented languages. We will spend a lot of time on these topics too.
  • Classes, Companion Objects, Traits, Self Types and Dependency Injection are Scala's way of providing Object Oriented support. Some of these concepts are similar to Java - those we will skim over. Others are quite different - we will be sure to cover these in detail. 
Who this course is for:
  • Nope! Please don't enroll for this course if you are entirely new to programming
  • Yep! Please DO enroll for this course if you know Java and are now looking to learn Scala from first principles
  • Yep! Please DO enroll for this course if you are interested in learning functional programming concepts as embodied in Scala