Resources Software Development

Scala Threads, Futures and Promises, links and resources


Scala Futures – link to the api documentation

Concurrency vs Parallel computing – good article on the subject

Don’t use actors for concurrency – article about using actors and futures for concurrency

A journey into concurrent programming in Scala – this article explains the basics of using futures and an execution context for concurrency. This is very basic.

Throttling Instantiations of Scala Futures – a very good article pointing out some of the issues with using Scala futures and how to back pressure them.

Understanding play thread pools – this is from the documentation on how to create thread pools

Scala Futures and Promises – Article from the Scala lang website documenting how Futures and Promises work in Scala

Scala Future Execution Context API documentation

Link to Java Executor documentation – for working with execution contexts

Link to an article about Scala async/await on the scala-lang site

Asynchronous Programming and Scala – a really good article about async programming and how it works in Scala.


Scala futures

Future Calculations (in Scala)

Scala Programming – Introduction to Threads and Futures

Futures and Async: When to Use Which?

This video explains more of the theory of how Futures, Async and promises work than how to actually use them.

How to Write Controllable Futures in Scala | Rock the JVM

Awaiting Futures (in Scala)

Resources Software Development

Reactive web applications notes

These are my personal notes about Reactive Web Applications by Manuel Bernhardt – It was written in 2016 it is a bit dated already as it covers Play Framework 2.4 and it is currently at 2.8 some of the things in play have changed. Play and everything in Scala world is changing so quickly all books are outdated the day they are published but they are still useful.

This book contains a lot of good general information about how Play Framework works.

One problem is certain things have either been removed from play framework code API and no one bothered to leave a link in the API docs, or the code was wrong. In particular chapter 5

import play.api.libs.concurrent.Execution.Implicits._

The compiler complains Execution does not exist.

The book is still full of great information and examples that give you a good idea of why you should do things a certain way and even examples of things to avoid.

But these are my notes for me.

Good coverage of  how Plays ExecutionContext works in Chapter 5 starting on page 110 in particular. This chapter covers Futures, how to use them in Play and how the Execution context works. It covers how to create custom execution contexts for such things as DB access or for each service of a larger app.intensly

Chapter 5 page 11 covers Async Controller Actions, how to create them and why, lots of good info on pages 110 – 111.

Chapter 5 page 112 Covers Custom Error handlers, very useful information here, for handling errors when working with Futures.

Chapter 5 page 114 covers correctly configuring and using an ExecutionContext. It covers when and why you would want to do so.  Page 115 & 116 carries on and goes into deeper coverage with Specialized Execution contexts such as DB heavy code. Pages 117 & 118 continue to cover Execution context in depth  This is the best coverage of Play Frameworks Execution context I have found anywhere yet.

Page 119 & 120 covers testing futures a little

Page 120 section 5.2 talks about Designing Asynchronous business logic with Futures and identifying parallelizable elements.

Pages 121 through 128 continue to cover using Futures, the quirks associated with them and how to avoid them.

Page 123 mentions the reason Futures are better than callbacks is because futures can be composed or combined, this can make swapping things out quicker.

page 126 makes an interesting point about Futures and the order in which you declare them. This mentions a gotcha with a good example of something that wouldn’t work the way you expect it to with Futures.

Page 128 – 132 covers Handling errors when using futures.

Chapter 6 is a quick introduction to Akka Actors and how to use them in play apps.

Page 144 lists the actor methods such as tell, forward etc. and gives brief coverage.

Page 147 makes a point about using var over val for actors to make them immutable.

Pages 148 and 149 cover common beginner mistakes with actors and how to avoid them.

Page 149 quickly covers when to use an Actor vs Future, very good and useful insight here.

Page 154 Section 6.2.3 has good information about letting actors die and reviving them and other error/exception recovery information.

The rest of chapter 6 pages 155+ deal with monitoring and preventing actor service overload, circuit breakers and more on handing errors.

Page 157 – 158 address avoiding duplicate actions

Page 159 covers Actor Message priority as a way to keep an actor system from overlaoding.

Resources Software Development

Scala Option resources, links and info

When programming in Scala you will see Option used everywhere. What is Option? Basically Option is Scala’s version of Null. However using Option/Some/None is a way of handling errors it doesn’t tell you what went wrong. In order to know what went wrong you must use exception handling.

Option/Some/None is most useful when you have a function that needs to check for a value and tell you if it exists or not. It can’t tell you for example that something didn’t exist because an error occurred. This must be taken into consideration when programming.

Scala Option API documentation link – this is the actual API documentation showing all methods etc.

Tutorialspoint Scala Options – a great introduction to Scala Option
Using the Scala Option, Some, and None idiom (instead of Java null)

Using the Scala Option, Some, and None idiom (instead of Java null) – nice coverage of Option, Some, None syntax and how to use it and how it functions.

Scala best practice: How to use the Option/Some/None pattern – more coverage of Options in Scala

Resources Software Development

Scala SBT resources

SBT is the main build tool for Scala. It builds, compiles, runs tests and much more. Below is a list of articles, videos and other useful information about SBT.


All that jazz – In depth article by James Roper about SBT what it is how it works etc.

Resources Web Development

Scala Play framework twirl template resources and links

The documentation for play framework twirl templating engine left me with more questions than answers.

Below I am gathering a list of resources that better explain how the twirl template engine works. Eventually I will write some articles about what I discover.
Creating Play Framework template functions (examples) –  This does a better job of explaining the basics of template functions. He explains some of their lingo such as “reusable block” that threw me off too.


Making Our First View with Play using Scala – Explaining Basics of twirl templates

Making Our First Page with Play using Scala


Random Scala stuff for newbs

Random Scala stuff for newcomers

The Scala ecosystem is huge. All kinds of tools, new tools, special tools, tool tools. Some are familiar to Java people, some are Scala specific. This page is a collection of tools I have encountered and things new people will find helpful. There is also the Scala resources page and many other resources listed in the resources page. This page lists some of the things you will encounter first. You should also check out the Scala Best Practices page. Which has links to articles, pdfs and other information about Scala best practices. Maybe you would enjoy a good Scala/Java joke this is how I chose Scala over Java LOL. You might also check out my page that lists Scala Frameworks and tools 


You will need an IDE and I suggest IntelliJ IDEA . I used to use Netbeans and tried eclipse, but Intellij seems to work the best and is the most preferred by Scala Devs. I use the free version and have not tried the paid edition yet, but it adds features I may find handy when I really get to writing Scala code. I use Windows. The first time I installed Intellij and started it, it hung up and froze badly. If this happens just restart windows. That is what worked for me and it has worked every since. I think it messed up during install some how.


First you must install SBT. Forget maven, gradle etc. Everything is SBT. If you don’t want to use SBT you are in a huge world of hurt like the kind of person who wants to swim upstream in rapids during a snow melt flood. So first you must read all about SBT. Everything everywhere refers to SBT so don’t fight it, just learn it.

Link to SBT website.

Link to the Scala website on how to use SBT with Scala.

Link to the SBT section of the Scala Book. I wish this book was around when I started learning Scala.

I like this book and would suggest it. It is from 2016 and right now it is only $1.99 US used, but it won’t be long watch. SBT in Action by Joshua Suereth and Matthwe Farwell


You will constantly run into references of Giter8 in Play, Lagom and other frameworks etc. Giter8 makes setting up Scala projects much easier. It is basically a template system that you use through the command line which quickly creates the project structure for you with the basic files and folders needed.
Giter8 documentation 


You will need this for Giter8. A wicked web we weave. Conscript makes it easier to install Giter8 and other Scala command line tools. Read the Conscript documentation and information, it is really a nice little tool.

Cake pattern

Eat that Cake – an article about building inheritance, objects and dependency management in scala.

DI in Scala: Cake Pattern pros & cons

Scala Cake Pattern – more about the cake dependency injection pattern.


Scalable component abstractions


Scala Best Practices

Scala allows so much freedom that you must absolutely use some best practices. This page contains links to best practices that I have found useful. Many of these are repetitive some are not. Some do better at explaining some concepts than others. This is why I like multiple references to the same subject for cross referencing. There are lots of things to avoid in Scala for many reasons. Scala is one of those languages you should know well before using it to build something Enterprise. Following these best practices can help you as you along your way. Because if you are like me you don’t care to get to really know Scala first. LOL

Scala Best Practices – A good place to start.

Even more best practices from Alexandru on github

Here is some good information about picking good names for classes/functions etc and clean coding.

This short article about Scala best practices has some redundant information as above, but it also has some unique information and insights.

This isn’t really an article it is a page with a list of articles related to some best practices.

Here is a decent pdf from Brown university about some Scala best practices.


Resources Software Development Web Development

scala web development resources

Resources for web development with Scala

Scala tags. This library is for creating HTML from Scala. Thanks lihaoyi

ScalaCSS a library for creating CSS from Scala


Scala tools and libraries

ScalaSTM Software transaction memory


Scala resources

Scala links

Here are some Scala resources I have found helpful.  I’ll be adding to the list as time goes on. I have books I have not had time to read which I will list later, I’ll also list new resources as I find useful ones. This serves mostly as a collection of notes so that I can remember what I read and where I read it so I can find it again later.

The number one place to start learning Scala is the new Scala book   written by Alvin Alexander. Alvin does an excellent job of explaining Scala concepts.  The Scala tour should link to the related parts of that book.

Here is a link to the Scala Api, these are the classes that make up the language. This is the best place to get a peak under the hood of Scala and find all of the methods of a Class or a Traits signature. You will see there are links to the Library API, the Compiler API and the reflection API. This is an excellent website with tons of tutorials and information about Scala.

Scala Glossary of Terms. Here are many of the terms you will encounter when using Scala or reading about it.

All about Dependency injection in Scala.

Here is more information about dependency injection in Scala.

Simple Dependency injection in Scala without special frameworks.

Functional programming approaches to dependency injection.

Here is another article about functional programming and dependency injection with links to more information.

More about dependency injection and Functional programming vs OOP. How to Trick OO Programmers into Loving Functional Programming

Scala is full of lots of magic, magic that can make it hard to learn because you see things done in so many ways in so many places with often little to no explanation . 4 Fun and Useful Things to Know about Scala’s apply() functions   So much of what you will read assumes you know Scala inside and out and upside down, like the Lagom documentation here where it states “As you can see, the sayHello method is implemented using the apply factory method on ServiceCall” Which you look and look and there is not an apply factory method to be seen anywhere, so you have to stop and do some google work to figure out what is going on. This little line of magic is what the documentation means ”

 ServiceCall { name =>
    Future.successful(s"Hello $name!")

It is assumed that you know that in Scala anonymous functions always contain a hidden apply method etc. like the bottom of the linked article mentions.  The main learning curve to Scala is all of the 10001+ things you have to remember about everything everywhere, my brain just does not like to memorize everything about everything, it likes to solve really hard problems.


New Dotty Scala 3 indentation link

Scala Books

Programming in Scala 3rd edition.  By Odersky, Spoon and Venners these are the authors of the programming language so this is one of the more in depth books of about 800+ pages and covers all parts of Scala.  This is a good book and basically a must have reference you will want to look back at from time to time. It has many small examples that can be run in the command line. You can also create scripts and call them from the command line, which is how I did the larger examples instead of typing in all of the code.  This is an older book but it is still 100% relevant in case you are wondering.

Programming in Scala 2nd edition Wampler & Payne. This is another good book that covers Scala slightly differently than the Programming in Scala by Odersky, Spoon and Venners.  This book covers Object Oriented programming in Scala as well as Functional programming. The book is almost 550 pages long, not too large or small. It also covers the type system fairly well. I like it’s discussion of implicits, these can be confusing if you come from other languages.  This is also an older book but it is still 100% relevant.  This is one of my more favorite books.

Scala Cookbook by Alvin Alexander. I feel this book is one of the Scala must haves, this book lives on my desk.  Alvin has an amazing ability to explain complex subjects in simple terms that every day developers can understand.  This book is almost 700 pages long, it is older too, from 2013 but it is also 100% relevant. This book is so wonderful because it shows hundreds of ways to do things in Scala. This is a wonderful book to have while learning and long after you have learned Scala. Many times while learning a new language you will ask yourself of others “how do you do this in this language”, this book has all of those types of answers.  This book shows how to do so much and is full of so much useful information, this is one of the must haves.

Functional Programming Simplified by Alvin Alexander. This is a wonderful book of 800+ pages that tells a story about the pieces of functional programming, breaking down the subject into over 100 small 1 to 5 page chapters. If you want to understand functional programming in Scala this is the best place to start. Even though the book is over 800 pages, the short chapters along with the authors unique ability to express complex ideas in simple terms made this programming book fun to read.  I found that the small chapters were perfect for when I only had a few minutes to read. I honestly wish more books were written in this fashion.

Functional and Reactive Domain Modeling by Debasish Ghosh. This is another good book about functional programming in Scala.  At under 300 pages it is concise and to the point.  This book cover Scalaz and almost makes you want to use it just from reading about it.  It is best to read this book after the Alvin Alexander functional programming book, this book is more advanced.  In this book the author covers why you would want to use a functional paradigm and makes a strong persuasive argument for it.  Overall I really liked this book and it is a good addition to any serious Scala programmers library.


Scala best practices I wish someone’d told me about – Nicolas Rinaudo

I wish this video had been around when I first started learning Scala it answers a lot of the questions I had at first. This is one of the best videos about Scala, so much useful information here.
Nicolas gets right to it in this video

  1. Array Comparison ~2:00
  2. Type Annotation ~3:55
  3. Unicode operators ~5:30
  4. Enumerations ~7:20
  5. Sealed Traits ~8:45
  6. ADT Algebraic Data Types ~12:20
  7. Case Classes ~15:50
  8. Custom Extractors ~18:45
  9. Structural types ~20:55
  10. Exceptions ~24:05
  11. Errors ~29:50
  12. The return Keyword ~31:45
  13. Implicit conversions ~33:55
  14. Implicit resolution ~36:30
  15. String concatenation ~39:45

Scala: Beyond the basics with Christopher Batey

This is an excellent video, this will clarify quite a few things for new comers to Scala.

This video covers how to rely on the compile more and libraries less. At about 3:30 he hits on what I noticed. I have learned like 7 different languages and thought I would just learn Scala. Well Scala is so much different it is like learning to program all over again. With the OOP and the Functional capabilities along with no sort of suggested best way to do things, it makes the beginners head roll, especially when you then discover there are multiple ways to do things. Even after you learn Scala for a while you have more options and more things you can do, so you have to come up with your own rules and make sure you and your teams stick to them.

The first 11 minutes of the video discuss expression vs statement based programming. At 11 minutes Christopher starts talking about Function composition which is the main concept of this video. This video is an excellent introduction to what functional programing really is. Type Aliases covered at 12:00 mark, I googled for a while trying to figure this out when I saw it, I got very little luck. The shenanigans of learning Scala is what inspired this website. Traits are discussed at ~12:30. At about 15:00 Christopher talks about repositories using traits. Traits are used for many things in Scala.

At about 16:00 the talk about functional programming begins.

  1. ~18:00 Curried functions are explained
  2. ~20:00 Function Composition explained
  3. ~23:15 Currying and Partial function application
  4. ~25:00  Scala Class use cases
  5. ~26:30  Implicits
  6. ~28:15 Higher Kinded Types
  7. ~39:15 Implicits conversion
  8. ~45:30 He gets to how it is harder to learn Scala than other common languages. Scala is a really different kind of language. I like it most for it’s conciseness. But learning it requires learning many programming related concepts you don’t normally learn or think about. Scala requires that you and your team have MUCH MORE DISCIPLINE and you have to force yourself to stick to a paradigm or else you will get a mess.

An excellent book that covers the subject of Functional programming and function composition is Functional and Reactive Domain Modeling by Debasish Ghosh  The book is well written with clear language in less than 300 pages it is all about Functional Scala with code examples. The book covers many subjects, it is one of the books I keep in a stack next to my desk. Check the table of contents of Amazon.