Learning Scala by Example

This is an inaugural post in the series of “Learning Scala by Example,” which is a play on words. I mean learning the book titled “Scala by Example,” and as a side benefit, learning the Scala language itself.

Learning Scala may be one of the most exciting journeys of your life. The language was designed by Martin Odersky, who was also one of the principal designers of Java – its generics. In learning Scala, you can expect to become a better developer and to learn to think more clearly and succinctly.

There are two books on Scala written by Martin, “Programming in Scala” and “Scala by Example.” In my opinion, the first one teaches you how to continue programming in the wrong style, but now using Scala. However, “Scala by Example” succeeds by focusing your attention on the new way and nothing else.

A word of caution. In many chapters of “Scala by Example” Martin asks a seemingly simple question, “Can this be done more concisely?” He then proceeds to condense the code. I believe that he has done the same to the text of the book. There is not one extra word there, so read slowly. The going can be tough, but the reward is worth the journey. You see, once you get accustomed to the mathematical style of the book, your thinking will begin to fall into the same sparse, analytical style. The real benefit, or course, is that by exposing yourself to “Scala by Example” your code too will start to flow faster and pack more expressiveness into fewer lines.

One final word about how to use this series of blog posts. In these posts, I assume that you’ve read the chapters of “Scala by Example,” and then you try to do the exercises. If you succeed, you can always check your answers against mine. I explain my solutions. If you don’t succeed in solving the exercises, it gives you more reason to look at my solutions. Either way, the reader is invited to enjoy!

Photo: Martin Odersky from his home page

Mark Kerzner
Written by:

Mark Kerzner

Mark Kerzner is the co-founder of Elephantscale. He is a Trainer, Author(AI, Machine Learning, Spark, Hadoop, NoSQL, Blockchain)

Leave a Reply

Your email address will not be published. Required fields are marked *