Table of Contents
- 7 steps to learn Scala easily and quickly for beginners
7 steps to learn Scala easily and quickly for beginners
Scala is in vogue and is here to stay. It is a typesafe JVM language which imbibes both functional and object oriented paradigms nicely.
Scala is also a functional language which encourages immutable collections by default.
In my experience, I have found Scala to be
- Concise yet powerful: You might end up writing 30%-40% less code when compared with Java for the same output.
- Less verbose yet more expressive: The syntax makes the language much more expressive. You can even ignore “.” operator in some cases and write something like N1 add N2 which is more readable.
1. Install Scala, SBT and use Scala Worksheets for practice
Mere talking or reading is not going to help, you need to deep dive into Scala to learn it. The first step is to install Scala on your system, integrate it with your IDE and make sure that Scala console and Scala Worksheets are available and accessible. Scala worksheets are interactive and produce the results instantly on another column when the file is saved. Some people call worksheets as REPL on steroids, when reading through a new concept or example make sure you practice it in Scala worksheets.
2. Learn Java 8 – lambdas and Stream
If you are from Java background and know about Lambdas and Streams you have got the stones rolling then. If not, do have a read about Lambdas and Streams before you jump to Scala. Familiarisation with these concepts will help you conditionalize to Scala, though it’s not a pre requisite.
3. Read Books
Scala for the Impatient is a very good book for every novice. The first part of this book is for free and available over the internet. It is specifically written for people who have prior experience in programming and doesn’t go about in length about explaining what a normal developer knows. The examples and explanations are crisp and clear. There are other good books available too and it narrows down to individual preferences.
scala-excercises.org is a great place to familiarise yourselves with scala syntax and concepts. It is an open source project for learning scala technologies. This website uses Scala test assertions where the user needs to evaluate his answers for given problem. A variety of examples, topics and API’s have been covered on this website.
5. Courses on Coursera/Pluralsight/Udemy/Youtube
There are a variety of online portals where Scala courses are available, on coursera you can register for free and get first-hand insight from the designer of Scala, Martin Odersky. His video lectures are pretty good and he defines most of the concepts clearly with examples though it is easy to get overwhelmed after a couple of sessions if you don’t have any previous knowledge of Scala. Pluralsight tutorials are also good for starters.
6. 99 scala problems/Hacker Rank
99 Scala problems site list out easy to medium problems in scala. The problems solutions are also given but I would recommend to give try to first 25 problems at least with sincere effort. Here is a link to my GitHub for first 25 problems
Hacker Rank is used by various companies to evaluate your programming skills. Nonetheless, they also provide you with functional programming runtime environment for Scala to practice.
7. Apply Scala to real world problems/projects
It is easy to read, practice and then forget. In my experience, unless a language is applied to a project/problems it is difficult to master it. So go ahead and create a new scala project and apply it to a real scenario/use case.