2022: My Year of Scala

scala
learning
How I added a new tool to my toolbox
Author
Published

September 15, 2022

My Year of …

Neil Gaiman, illustrious author and everlasting source of wit, has a really cool mental exercise to help him complete his projects.

You don’t have to write. You have permission to not write, but you don’t have permission to do anything else.

I would go down to my lovely little gazebo at the bottom of the garden, sit down, and I’m absolutely allowed not to do anything. I’m allowed to sit at my desk, I’m allowed to stare out at the world, I’m allowed to do anything I like, as long as it isn’t anything. Not allowed to do a crossword, not allowed to read a book, not allowed to phone a friend, not allowed to make a clay model of something. All I’m allowed to do is absolutely nothing, or write.

For a couple of years now, I have adapted a version of this exercise to help me complete my learning projects. Every year I make the grand announcement that this will be the year of X. Where X is a learning topic or a new programming language that I wish to focus on.

I declared this my year of Scala all the way back in Jan, but I only started this blog in July, which is why this post is published in September 😅.

🎉 2022 year is my year of Scala! 🎉

Inspired by Neil’s rules, my rules for this year are:

  • For every project that requires coding, I am going to try and use Scala
  • But, I give myself permission to not use Scala if it is just not the right option for my use case
  • However, I do not have permission to try out any other shiny new programming language I might be tempted by

What is Scala?

Scala is a programming language that is probably most famous for consistently showing up as one of the “Top Paying Technologies” in StackOverflow’s annual survey 🤑🤑🤑. In Data Science, Scala is famous for being the language used to build the Apache Spark engine, which makes Scala essentially the core language that “Enterprise Big DataTM” is run on.

// Illustrating Scala's legible syntax
// and method chaining pattern
val inputs = Vector(1,2,3,4,5,6,7,8)
inputs
    .map(x => x + 1)
    .filter(x => x % 2 == 0)
    .slice(2,6)
//res1: Vector[Int] = Vector(6, 8)

My 1-liner description of Scala (with the caveat that I am pretty much still a beginner) is that Scala feels like a language designed for modelling and manipulating data.

I enjoy Scala’s

Why Scala?

The main reason is that I recently joined a team where our main codebase is in Scala. This gives me a practical incentive, as well as, the opportunity to be surrounded by knowledgable colleagues who I can pester with my questions.

The secondary reason is curiosity. Scala is designed to support both the object-oriented paradigm and the functional programming paradigm. Through Scala, I hope to dip my toes into the great ocean that is Functional Programming.

Fingers crossed that one day, I’ll be able to explain what a monad is.

How has the year gone so far?

Pretty good! I have not burnt out and I have found opportunities to use Scala in my projects for work, school and play. So far I have used Scala to:

  1. Write applications to improve my tooling for work

  2. Build random number generators for a module for school

  3. Create a rudimentary (and incomplete) blog engine

  4. Inch my way through the excellent Hands-on Scala book

  5. Automate small scripting tasks (although I’m still not convinced Scala is my 1st choice as a scripting language)

  6. Build a simple website without writing 1 line of javascript (😲!!) thanks to Scala.js

Additionally, I have also found small ways to engage with the small but fascinating community. For example, I enjoyed learning a little history behind Scala by asking the Reddit community What’s the story behind Scala’s logo?.

My rendition of Scala’s logo. What does this look like to you?

Ending the year strong

I still have a good couple of months until the end of 2022. I would like to accomplish the following before the end of this year:

  • Build a Scala application which serves more users than just myself
  • Attempt this year’s Advent of Code in Scala
  • Write a recap blog post at the end of the year reflecting what I liked/disliked about Scala

Appendix

─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 (2023-06-16)
 os       macOS Ventura 13.5
 system   x86_64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Asia/Singapore
 date     2023-08-10
 pandoc   3.1.6 @ /usr/local/bin/ (via rmarkdown)
 quarto   1.3.433

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 sessioninfo * 1.2.2   2021-12-06 [1] CRAN (R 4.3.0)

 [1] /Users/ddanieltan/Code/ddanieltan.com/renv/library/R-4.3/x86_64-apple-darwin20
 [2] /Users/ddanieltan/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.3/x86_64-apple-darwin20/84ba8b13

──────────────────────────────────────────────────────────────────────────────
We are not given a short life but we make it short,we are not ill-supplied but wasteful of it. Life is long if you know how to use it. – Seneca

Reuse

Citation

BibTeX citation:
@online{tan2022,
  author = {Tan, Daniel},
  title = {2022: {My} {Year} of {Scala}},
  date = {2022-09-15},
  url = {https://www.ddanieltan.com/posts/2022scala},
  langid = {en}
}
For attribution, please cite this work as:
Tan, Daniel. 2022. “2022: My Year of Scala.” September 15, 2022. https://www.ddanieltan.com/posts/2022scala.