Scala Fundamentals
Scala is a statically typed language that combines object-oriented and functional programming on the JVM, with JavaScript and native targets. Its immutable values, pattern matching, and concise syntax help you build expressive, reliable application code.
itProgramming languages | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
Scala Fundamentals
Scala is a statically typed language that fuses object-oriented and functional programming. Martin Odersky designed it at EPFL. Scala code runs on the JVM and can also target JavaScript and native platforms. The language is not a framework: a useful program also needs a target platform, a build setup, and often libraries.
Scala's mental model is types plus expressions. A type describes the values an expression can hold. val declares an immutable reference. var declares a mutable one. Reach for immutable values first; keep mutation visible and local when you need it.
val greeting = "Hello"
val message = s"$greeting, Mina"
A unified type hierarchy
Every value has a type. The type hierarchy puts Any at the top. AnyVal covers value types such as Int, Double, and Boolean. AnyRef covers reference types such as classes. At the bottom sits Nothing, the type of expressions that never produce a value. You will meet Any, AnyVal, and AnyRef in signatures and error messages, so recognizing them pays off.
val count: Int = 42
val label: String = "bytes"
Scala often infers a type from an expression. The inferred type still shapes what the code can do.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://docs.scala-lang.org/tour/tour-of-scala.html
Supports
- Scala combines object-oriented and functional programming in one statically typed language
- The Tour of Scala is the official starting sequence for language concepts
- https://docs.scala-lang.org/tour/basics.html
Supports
- val declares an immutable reference and var permits reassignment
- Scala supports type inference and expression-oriented definitions
- https://docs.scala-lang.org/tour/unified-types.html
Supports
- Any is the supertype of all types, with AnyVal for value types and AnyRef for reference types
- Nothing sits at the bottom of the type hierarchy
- https://docs.scala-lang.org/tour/higher-order-functions.html
Supports
- Functions are values in Scala
- Higher-order functions take functions as parameters or return functions as results
- map applies a function to each element and returns a new collection
- https://docs.scala-lang.org/tour/pattern-matching.html
Supports
- Match expressions decompose values by trying each case in order
- Type patterns check and bind in one step and a wildcard matches anything
- https://docs.scala-lang.org/tour/for-comprehensions.html
Supports
- For comprehensions chain generators, guards, and yield into readable collection operations
- A for comprehension with yield produces a collection of yielded values
- https://docs.scala-lang.org/scala3/reference/contextual/givens.html
Supports
- Given instances provide values the compiler can supply automatically
- Using clauses mark parameters the compiler may fill from the context
- https://docs.scala-lang.org/scala3/reference/contextual/extension-methods.html
Supports
- Extension methods add methods to an existing type without modifying its definition
- https://en.wikipedia.org/wiki/Scala_(programming_language)
Supports
- Scala is designed by Martin Odersky at EPFL and released under a BSD license
- Scala source code can compile to JVM bytecode, transpile to JavaScript, or compile to native executables
- Scala supports immutable values, pattern matching, and a unified object-functional design
- Scala 2.8.0 shipped on 14 July 2010 and Scala 2.12.0 required Java 8 on 3 November 2016
- Scala 3.0.0 released on 13 May 2021 and Scala 3.3.0 was the first LTS release on 30 May 2023
- Scala 1.0 reached the public in early 2004 after an internal release in late 2003, and Scala 2.0 followed in March 2006 with the compiler rewritten in Scala
- A .NET target shipped in 2004 and was officially dropped in 2012
- Scala 2.10 added futures and promises, value classes, implicit classes, and string interpolation in January 2013
- Scala.js was declared no longer experimental in 2015 and Scala Native had its first release on 14 March 2017
- Typesafe Inc., later renamed Lightbend, was launched on 12 May 2011 to provide commercial support for Scala
- Apache Spark is a well-known open-source cluster computing solution written in Scala
- Scala's actor model support is now available as the source-available Akka platform licensed by Lightbend
- https://github.com/lauris/awesome-scala
Supports
- Awesome Scala is a curated Scala ecosystem list; no entry was included without a verified project destination
- https://www.scala-lang.org/
Supports
- The reference Scala language and compiler distribution is the subject of this course
- https://www.scala-sbt.org/
Supports
- sbt is the classic Scala build tool used by most multi-file Scala projects
- https://scala-cli.virtuslab.org/
Supports
- Scala CLI is a single-file scripting and project tool that lowers the entry cost before a full sbt setup
- https://www.scala-js.org/
Supports
- Scala.js is the Scala compiler target that compiles to JavaScript for browser and Node.js
- https://scala-native.readthedocs.io/
Supports
- Scala Native is the LLVM target that compiles Scala to a native executable with a lightweight runtime
- https://scalameta.org/metals/
Supports
- Metals is the Scala language server that powers Scala editing in VS Code and other LSP-based editors
- https://www.jetbrains.com/idea/
Supports
- IntelliJ IDEA offers first-class Scala support, free in the Community edition and paid in Ultimate
- https://scalameta.org/scalafmt/
Supports
- Scalafmt is the standard Scala code formatter that enforces one consistent style across a project
- https://github.com/scalacenter/scalafix
Supports
- Scalafix is a refactoring and linting tool that applies migration and cleanup rules across a Scala codebase
- https://scastie.scala-lang.org/
Supports
- Scastie is the official browser playground for running Scala snippets including Scala 3
- https://index.scala-lang.org/
Supports
- The Scala Package Index is the search index for published Scala libraries across JVM, Scala.js, and Scala Native targets
- https://akka.io/
Supports
- Akka is the actor and streams toolkit that grew out of Scala's original actor support, now source-available with paid tiers
- https://spark.apache.org/
Supports
- Apache Spark is the open-source cluster computing engine written in Scala
