Fireship · @fireship
Scala in 100 Seconds
Uploaded July 30, 2024 · Length 3:28
Summary
This video teaches how to get started with Scala, a high-level statically typed programming language that combines object-oriented and functional programming paradigms.
- scala programming language
- functional programming
- object-oriented programming
- java virtual machine
- scala tutorial
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
Scola a highlevel statically typed
- 0:02
programming language famous for fusing
- 0:05
objectoriented and functional
- 0:06
programming paradigms together in a
- 0:08
clean concise syntax it was designed in
- 0:10
Switzerland by computer scientist Martin
- 0:12
ODI and first released in ' 04 the name
- 0:15
Scola means scalable language and it's
- 0:17
lived up to that name by powering the
- 0:19
large scale analytics engine Apache
- 0:21
spark the large scale social media
- 0:22
platforms of X and Linkedin and
- 0:24
large-scale genomics projects like atom
- 0:27
it's one of many jvm languages that
- 0:29
compile to code to run on the Java
- 0:31
virtual machine it can interupt with
- 0:33
Java and use Java libraries but what it
- 0:35
doesn't have is Java's boilerplate no
- 0:37
static void main string args just to say
- 0:39
hello world but most importantly it gets
- 0:42
functional by making no distinction
- 0:44
between statements and expressions
- 0:46
everything is a value that means every
- 0:48
if statement or for Loop can be assigned
- 0:50
to a variable when combined with type
- 0:51
inference the end result is concise
- 0:54
expressive and safe code and it provides
- 0:56
features like higher order functions
- 0:58
null safety pattern matching and
- 1:00
algebraic data types that dramatically
- 1:02
reduce the amount of pain you'll suffer
- 1:03
as a Java developer to get started
- 1:05
you'll first want to install the jvm and
- 1:07
then the skulla compiler from there
- 1:09
we'll create an SBT file which is
- 1:10
scola's build tool and includes metadata
- 1:12
about the application and then we'll
- 1:14
write the actual code in a DOT Scola
- 1:16
file just like in Java we can create a
- 1:18
class and then inside that class Define
- 1:20
a main function we can also Define a
- 1:21
trait to apply a type interface to this
- 1:24
class or by changing the class keyword
- 1:26
to object we automatically create a
- 1:28
Singleton it looks like typical o P but
- 1:30
here's where things get weird any
- 1:32
variable declared with vow is immutable
- 1:34
and most data structures in the standard
- 1:35
Library like list are also immutable
- 1:37
although it is possible to make values
- 1:39
mutable with VAR and notice how the type
- 1:41
is automatically inferred as an integer
- 1:43
although it could be made explicit now
- 1:45
everything is a value so if we have an
- 1:47
if statement like this we can assign it
- 1:48
to a variable like that that's cool but
- 1:51
if you're a Java developer you've likely
- 1:52
been tortured by null pointer exceptions
- 1:54
this bad code example is trying to cast
- 1:56
null as an integer which could lead to
- 1:58
runtime errors but in skola you can use


