Horia Constantin@constantinhoriaJust when I thought I knew enough programming: "Defining a set as a function that says whether an item is included in the set or not" 🤯 #scala
type Set = Int => Boolean
def contains(s: Set, elem: Int): Boolean = s(elem)09:16 AM - 19 Jan 2021
Learning Scala doesn’t have to be painful. In a previous article, I proposed the use of a checklist to give structure to learning a new programming language. My intention with this article is to demonstrate how to use a checklist to learn scala.
- Personal why’s for learning Scala: I’ve wanted to start to learn a new programming language for some time. I chose Scala thinking that I can get a freelance gig faster than anything else. And because a former colleague recommended it.
- Find a project/application to build with Scala: a web app that supports most technologies that are required these days for a fully-featured website. I called it scalatraseed since it uses the Scalatra web framework at its core.
- Find a high-quality online Scala course/book: I’ve found excellent resources here. Scala originated in EPFL, so I started with Functional Programming Principles in Scala.
- Find/create Scala cheat sheet: here
- Find the official Scala documentation: start with the standard library
- Find/create a comparison between Scala and Java: these docs and this course
- Find/create a dictionary/glossary of the concepts, keywords, etc.: I haven’t been doing very well at this point because I tend to look up a concept as soon as I encounter it.
- Take notes: questions, curiosities, “strange” code: useful point, but the questions and curiosities change from one day to another that it makes it useless to write it here.
- Start collaborating on an open-source library: this point was a bit more complicated than I thought. Many libraries are either too big or have too many contributors already or are too advanced for a beginner or don’t have good-first-issues. I decided to settle down on Scalatra because I was already using it in my demo project.
- Find/create a roadmap that describes the learning process: this is a good start
- Find a code conventions document: the online Scala course that I’ve started uses Scalastyle for enforcing the style of the code. If it’s good enough for the Scala core team, it’s good enough for me.
- Find/create a list of antipatterns: I couldn’t find anything, probably because Scala is such a flexible language (allowing full OOP or FP and anything else in between). The small things that I’ve found so far revolve around using the language constructs correctly (e.g., use “if” as an expression, not a statement). So, nothing useful here.
- Find and learn how to use the most popular build tool: I wanted to leverage my maven knowledge initially, but it’s a constant uphill battle. Sbt for the win!
- Find a list of Scala project seeds: from lightbend
- Find the frameworks: Scalatest, Scalatra, Sangria
Having applied the checklist, I’m discovering that some points are part of the continuous process of learning (take notes; create a dictionary/glossary), while others are a one-time task (find the official documentation).
I’m also learning that some tasks are not so useful as others. That can be because they’re part of another, more comprehensive task (the online Scala course that I found uses Scalatest) or because they’re not that important at this stage of learning (they just take up mental and checklist space).
Based on this experience and the idea of lean learning, I’ll be updating the checklist template so that it is a more effective learning resource. For historical reasons, I’ll keep the checklist in this article as it is.