Intro

Futures in Scala

published on

Not-yet-available values in Scala: Futures!

Whenever we want to use a value that is not readily available yet – for example, when we call a function to compute or fetch something over the network – we can not be sure if things go as were planned. What if the database connection is down? What if the user typed in an invalid string?

Read More...

For + yield = for comprehension

published on

For loops and for comprehensions in Scala

Looping over a collection of items and transforming the individual elements within is quite a common task. So it seems natural that Scala offers a nice way to solve this.

Read More...

Options in Scala

published on

Handling missing values in Scala: Options

Whenever we want to use a value that is not readily available yet – for example, when we call a function to compute or fetch something over the network – we can not be sure if things go as were planned. What if the database connection is down? What if the user typed in an invalid string?

Read More...

Scala collections - part 3

published on

Basic data structures in Scala: Maps

After Lists and tuples, let’s have a look at Maps.

They are sometimes called “hashtables”, “hashes”, or “dictionaries” in other programming languages.

Maps are a bit more complex than what we’ve seen before. They come handy when you need to store associated pairs of data, or when you need to easily look up a value corresponding to another value (which we will call the key).

Read More...

Scala collections - part 2

published on

Basic data structures in Scala: Tuples

In the previous post we learned about Lists in Scala. Now I’ll briefly cover tuples.

You can think about a tuple as simple “wrapper” around a handful of things, it just keeps its elements together, at their own place.

Read More...

Scala collections - part 1

published on

Basic data structures in Scala: Lists

In the following couple of posts we’ll learn about basic data structures, and how they can be used in Scala.

Lists are what their name suggests: they can keep a list of things. The order of its elements will be kept, and a list does not care if an element appears more than once in it (which means it will not remove duplicates).

Read More...

Our first Scala dojo

published on

What is a coding dojo?

In short, a coding dojo is an event where a group of programmers practice their craft in an organized way, focusing on a single coding problem.

A dojo usually lasts a couple of hours, depending on the style and the task to be solved.

Read More...

Testing our Scala code

published on

Why test our code?

This is a more ‘practical’ topic, and I’m sure that many would argue that learning how to use a unit testing framework is not strictly necessary for newcomers. But according to my experience, getting into the habit of writing tests regularly quickly pays off.

Read More...

Basic pattern matching in Scala

published on

Introduction to pattern matching in Scala

Pattern matching is a quite commonly used “programming pattern” in functional languages, because it fits nicely into the “functional way of thinking”, and it is quite powerful and handy as a tool.

Read More...

Enums in Scala

published on

Enumerations in Scala

Generally in programming, enumerations (a.k.a. enums) are light-weight means to create a very simple model within our code, for representing a custom type with a limited set of possible values with readable names. This description might sound a bit too abstract, so let’s see an example instead.

Read More...

Short intro to Scala

published on

Welcome!

You’re probably here because you’ve heard that Scala is a cool programming language and you’d like to learn more about it. Because, hey, it’s object-oriented and functional at the same time!

I’ll show you something very basic at first: a bit more “personal” version of the famous “Hello World” program.

Read More...