Idling over Twitter I came across a post on Signify blog about a list of Scala Job Interview Questions. The post in fact referenced a GitHub repository. Now the post came with a pointer to ready-made answers, but I decided to take the exercise and try to reply myself. The intent was both to check my knowledge and to learn something new since I’m no Scala guru.
The post contained many questions, grouped by topic. So I prefer to split my answers along several posts to keep them short and manageable.
Let’s start with general questions.
What did you learn yesterday/this week?
This is a tough one, and indeed something that can actually be asked during an interview. Unfortunately, I am not always that aware to cherry-pick what I learned the past week. Also, learning implies some form of retention of what you were exposed to. E.g. two weeks ago I tried writing some python tests (pyUnit) for testing Web UI and REST API. I can recover the code, but I worked on this stuff too shortly to be able to recall all the names of the tools.
During the past week, I worked mainly on project directions, so I found a good template for user stories… doest this count?
Why and how did you start learning Scala?
Thank you for asking, it was 2014 and I just landed a new job. I had been a C++ programmer for most of my professional career and I was confronted with a quite large codebase in functional Scala with Akka and Play implementing the working demo of the system I had to turn into a rock-solid, industrial-grade server. So I had to turn myself into a Scala programmer.
In fact, it took me quite a while to bridge the gap between “traditional” programming I was used to and Scala functional programming. At first, I didn’t like the new language that much, it seemed too much academic with scarce attention to the industrial needs. For example, everything in Scala is public by default and the type can be omitted in most contexts for variables and function return values. Also Scala and the functional approach were orders of magnitude slower than traditional C++ code.
Then I started appreciating the conciseness and the elegance of the language. The expressiveness of functional constructs up to the point that I started trying to apply such patterns and constructs to my C++ code (with mixed reactions by fellow C++ programmers who read my code).
What excites or interests you about coding in Scala?
Scala is quite a new language to me that opens a new paradigm of programming. I’m plain curious to apply algebra to programming, how to segregate side effects for taking full advantage of functional programming.
At the risk of being a write-only language, Scala lets the programmer focus on the solution minimizing the overhead needed to code it.
What is a recent technical challenge you experienced and how did you solve it?
This is always a good question for interviews and is not confined within Scala borders. Unfortunately, it has been quite a while since my last line of Scala code. I remember I worked on implementing state machines over Akka actors (avoiding the Akka Fsm which I consider limited and somewhat messy) and a driver for CanOpen.
More recently I’m pretty proud of my porting of FP concepts in C++ programming. The challenge with embedded systems, my daily job, is adding features and constructs which the compiler can optimize and translate into fast and light code. I ported Option, Either to C++, and tried to get a workable implementation of the for comprehension. Besides, I designed an Error class that can be composed (much like an
Either<ErrorCode,Unit>) so that error handling is easy to code without the need for exceptions.
Talk about your preferred development environment. (OS, Editor or IDE, Tools, etc.)
IntelliJ Idea beats everything hands down IMO. Idea is a capable and mature IDE that understands Scala and tools pretty well and is open for customization via plugins. Besides the community edition is free and can be used for most of the backend projects.
Also IntelliJ family has IDEs for python, c++ and C# all based on the same platform, so you can switch among these languages without the need of rewiring your brain to a different IDE.
Usually, I prefer using sbt from the command line in a terminal separate from the IDE, there isn’t much rationale behind this choice, but for the impression to be better in control.
What are your thoughts about the other JVM languages compared to Scala?
The other JVM languages I know are Java and Kotlin. Java language is quite dated and strongly rooted in the OO paradigm. It’s very verbose and quite dumbed down, likely with the intent of allowing junior programmers to jump-start writing code (that’s what I would define as a Bad Idea) and keep the complexity low (which instead could be a good idea). What I like of Java is the strong commitment of the vendor (Sun first and then Oracle) to provide extensive libraries. Also when a specific library shows limits or problems, it gets replaced with a new API.
The other language running on the JVM I know of is Kotlin. I have just a general knowledge of Kotlin, so I know it is quite young, modeled after Scala, with easier interoperability with Java, but with the goal to appeal to a more industrial target and is nowadays the language of choice for Android app development.
Do you think that the Scala language and community is mature enough?
This is a strange question. Scala has been around since 2003, that makes nearly 20 years. Despite alternating fortunes, Scala never climbed in the top 20 most popular languages on the Tiobe index.
In my experience the quality of tools available to programmers vastly improved over the last decade – IDE, debugger, build tool. I think Scala is a mature language – at least in version 2, version 3 is too new even if it builds on Scala 2, but not (yet) widely known. Scala has a steep learning curve and this could be one of the reasons for the current state. Also, Lightbend – the company the promoted Scala, produced the same libraries for Scala and Java, thus making less compelling the switch from Java to Scala for those willing to use such libraries.
I haven’t much experience with the Scala community, I learned about controversies and really bad behaviors, but I can’t stigmatize the entire community because of a few bad apples. When I attended Scala Italy in the past years (and Scala Days in 2016) I found an enthusiast and welcoming and inclusive community.
General Questions Conclusions
I enjoyed these questions, open enough to let candidates share their experience, yet close enough to get an insight into candidate attitudes and interests. From the candidate’s answers, a good interviewer may enter more specific technical topics, or navigate on more abstract issues about quality and process.
In the next post, I’ll delve into the language-specific questions, it’ll take a bit more time because some questions need to do some research.