Scala Tutorials
Here at allaboutscala.com, we provide a complete beginner's tutorial to help you learn Scala in small, simple and easy steps.
We are an official learning resource for Scala: http://docs.scala-lang.org/learn.html
GET OUR BOOKS:
- Scala For Beginners
This book provides a step-by-step guide for the complete beginner to learn Scala. It is particularly useful to programmers, data scientists, big data engineers, students, or just about anyone who wants to get up to speed fast with Scala (especially within an enterprise context). You get to build a real-world Scala multi-project with Akka HTTP. It has been updated for Scala 2.13, and you can buy it on Leanpub.- Machine Learning With Scala
This book is on our 2020 roadmap in collaboration with a leading data scientist. Stay in touch for updates!OUR ONLINE TUTORIALS:
Scala Introduction
A general overview of Scala
Chapter 1
Getting familiar with IntelliJ IDEA
- Introduction
- Scala Environment Setup - Install Open Java Development Kit (OpenJDK)
- Scala Environment Setup – Install Java Development Kit (JDK)
- Scala Environment Setup – How to install the IntelliJ IDE
- Scala Environment Setup - Install IntelliJ IDEA Version 2019
- Scala Environment Setup – How to install Scala plugin in IntelliJ
- Scala Environment Setup - How to install the Scala plugin in IntelliJ version 2019
- Your first Scala Hello World application
- Launch Scala application from main method
- Running Your Scala application
- Debugging Your Scala Application
- Getting Started With Scala Project
- Scala Project Classpath
- Getting Started With build.sbt
- SBT Dependencies And Maven
- Real-world build.sbt
- IntelliJ Settings and Preferences
- IntelliJ Navigation Keyboard Shortcuts
- IntelliJ Search Keyboard Shortcuts
- IntelliJ Keyboard Shortcuts – Compile, Debug, Run
Chapter 2
Learning Scala: Fundamentals
- Introduction
- Variables And Types
- String Interpolation
- How To Escape Characters And Create Multi-line String
- Type Inference
- If Else Statement And Expression
- For Comprehension
- Range
- While And Do While Loop
- Pattern Matching
- Tuples
- Option
- Class And Type Hierarchy
- Enumerations
- Enum And Algebraic Data Types
Chapter 3
Thinking in terms of functions
- Introduction
- Functions
- Function With Parameters
- Function With Option Parameters
- Function With Option Return Type
- Function With Implicit Parameter
- Implicit Function
- Typed Function
- Polymorphic Function With Generic Return Type
- Variable Argument Function
- Functions As Symbols
- Function Currying With Parameter Groups
- Higher Order Function
- Higher Order Function - Call By Name Function
- Higher Order Function - With Callback Parameter
- Function Using The Val Keyword Instead Of Def
- Function Composition Using AndThen
- Function Composition Using Compose
- Tail Recursive Function - @annotation.tailrec
- Tail Recursive Function - scala.util.control.TailCalls._
- Trampoline Tail Recursive Function Using scala.util.control.TailCalls._
- Partial Function Using the PartialFunction Trait
- Nested Function
Chapter 4
Object Oriented using classes
- Introduction
- Classes And Objects
- Companion Objects
- Companion Objects' Apply Method As A Factory (Class Hierarchy Via Inheritance)
- Values And Fields In Companion Object
- Singleton Object
- Case Class
- Type Alias: Type Aliasing Versus Case Class
- Implicit Class - Extension Methods
- Package Objects
- Extend Abstract Class
- Case Class Inheritance
- Typed Class
- Covariance
- Contra-Variance
Chapter 7
Mutable Collection
- Introduction
- Array
- ArrayBuffer
- ArrayStack
- ListBuffer
- Map
- HashMap
- ListMap
- LinkedHashMap
- Queue
- PriorityQueue
- Set
- HashSet
- SortedSet
- TreeSet
- LinkedHashSet
- BitSet
Chapter 8
Collection Functions
Chapter 9
Futures
- Introduction
- Method with future as return type
- Non blocking future result
- Chain futures using flatMap()
- Chain futures using for comprehension
- Future Option with for comprehension
- Future Option with map
- Composing Futures
- Future Sequence
- Future Traverse
- Future foldLeft
- Future reduceLeft
- Future firstCompletedOf
- Future zip
- Future zipWith
- Future andThen
- Future configure threadpool
- Future recover
- Future recoverWith
- Future fallbackTo
- Future promise
Chapter 10
Scala Test and Cheatsheet
ScalaTest:
- Introduction
- Add ScalaTest as dependency to build.sbt
- Create a test class using FlatSpec and Matchers
- Equality Test
- Length Test
- Boolean Test
- Collection Test
- Type Test
- Exception Test
- Private Method Test
- Future Method Test
Collection:
General:
- Add line break
- Convert multi-line string to single line
- Check value of an Option
- Read file content as a String
- Create enum using sealed trait
- Int division and return float
Futures:
Chapter 11
Learn SBT
Install SBT:
sbt run:
sbt test:
- Run all tests
- Run only one specific test
- Run all integration tests
- Run a specific integration test
- Run one method in a test class
sbt debugging:
sbt resources:
Chapter 12 - Part 1
Learn Apache Spark 2
Project Setup:
DataFrame SQL Query:
- DataFrame Introduction
- Create DataFrame from a CSV file
- DataFrame schema
- Select columns
- Filter by column value
- Count rows
- SQL like
- Filter chaining
- SQL In
- SQL Group By
- SQL Group By with filter
- SQL order by
- Cast column data type
- Filtered dataframe
- Dataframe Join
- Join and select columns
- Join on explicit columns
- Inner Join
- Left Outer Join
- Right Outer Join
- Distinct
Chapter 12 - Part 2
Learn Apache Spark 2
Spark SQL:
- Spark SQL Introduction
- Register temporary table
- List all tables in Spark's catalog
- List catalog tables using Spark SQL
- Select columns
- Filter by column value
- Count number of rows
- SQL like
- SQL where with and clause
- SQL In clause
- SQL Group by
- SQL Group by with having clause
- SQL Order by
- Typed columns, filter and create temp table
- SQL Inner join
- SQL Left outer join
- SQL Right outer join
- SQL Distinct
- Register User Defined Function (UDF)
Chapter 12 - Part 3
Learn Apache Spark 2
DataFrame Statistics:
- DataFrame Statistics Introduction
- Create DataFrame from CSV
- Average
- Maximum
- Minimum
- Mean
- Sum
- Group by query with statistics
- DataFrame Statistics using describe()
- Correlation
- Covariance
- Frequent Items
- Crosstab
- Stratified sampling using sampleBy()
- Approximate Quantile
- Bloom Filter
- Count Min Sketch
- Sampling With Replacement
Chapter 12 - Part 4
Learn Apache Spark 2
DataFrame Operations:
Chapter 13 - Part 2
Learn Akka
Akka Actors & ActorSystems:
Akka Routers:
Akka Dispatchers:
- Akka Default Dispatcher
- Akka Lookup Dispatcher
- Fixed Thread Pool Dispatcher
- Resizable Thread Pool Dispatcher
- Pinned Thread Pool Dispatcher
Akka FSM:
- Actor FSM become()
- Actor FSM unbecome()
- Actor FSM protocol
- Actor LoggingFSM
- Actor LoggingFSM Part Two
- Actor LoggingFSM Part Three
- Actor LoggingFSM Part Four
- Actor LoggingFSM Part Five
- Actor LoggingFSM Part Six
- Actor FSM Scheduler
Akka TestKit:
Chapter 16
Data Science & Machine Learning
Chapter 12 - Part 5
Learn Apache Spark 2
Spark Functions:
- Create DataFrame from Tuples
- Get DataFrame column names
- DataFrame column names and types
- Json into DataFrame using explode()
- Concatenate DataFrame using join()
- Search DataFrame column using array_contains()
- Check DataFrame column exists
- Split DataFrame Array column
- Rename DataFrame column
- Create DataFrame constant column
- DataFrame new column with User Defined Function (UDF)
- DataFrame first row
- Format DataFrame column
- DataFrame column hashing
- DataFrame String functions
- DataFrame drop null
Chapter 13 - Part 3
Learn Akka
Akka HTTP:
- Akka HTTP project setup build.sbt
- Start Akka HTTP server
- HTTP GET plain text
- HTTP GET JSON response
- JSON encoding
- JSON pretty print
- HTTP POST JSON payload
- Could not find implicit value
- HTTP DELETE restriction
- Future onSuccess
- Future onComplete
- Complete with an HttpResponse
- Try failure using an HttpResponse
- Global rejection handler
- Global exception handler
- Load HTML from resources
- RESTful URLs with segment
- RESTful URLS with regex
- RESTful URLs multiple segments
- Query Parameter
- Optional query parameter
- Typed query parameters
- CSV query parameter
- Query parameter to case class
- Http request headers
- Http client GET
- Unmarshal HttpResponse to case class
- Http client POST JSON
- Akka HTTP CRUD project
- Akka HTTP CRUD project - part 2
- Akka HTTP CRUD project - part 3
Chapter 13 - Part 1
Learn Akka
Akka Actors & ActorSystems:
Introduction
Akka Actors:
- Actor System Introduction
- Tell Pattern
- Ask Pattern
- Ask Pattern mapTo
- Ask Pattern pipeTo
- Actor Hierarchy
- Actor Lookup
- Child Actors
- Actor Lifecycle
- Actor PoisonPill
- Error Kernel Supervision
Chapter 14
Learn Apache Cassandra
Introduction:
Chapter 15