What are some best resources to learn scala language effectively


#1

Hey, I’m new to Scala. I want to learn it effectively.
In internet there are so many resources. But, I’m confused which one should I follow.
Any suggestions?


#2

Hello,
The best resource to learn Scala language in my opinion is Martin Odersky’s two (Principles and Design courses) Scala courses available in Coursera.

I wonder if any one teaching Scala better than the creator himself. Martin is also a professor in Ecole polytechnic in Switzerland so he knows how to teach.

Once you finish these two courses then based on your interest you can start learning Spark or start developing applications or micro services using the language. In the latter case you may need to learn cats library but not necessary.

I can say that I started loving this language after completing the two courses mentioned above.

One last note. Taking those two courses is not an easy ride but it is definitely worth it.


#3

If your background is in Java/C#, I usually recommend beginning with the book Scala for the Impatient, which is designed as a flying start in the language for people who are already comfortable with traditional OO.


#4

I know. But, they are paid courses and some people can’t afford to it right?


#5

I am an experiment in action. Since I am trying to teach myself Scala while working full time as a java developer. At this point I view Scala as a very, very , very difficult language to learn. I mean to become competent in the Scala eco system appears to be a daunting task. ON the other hand, if you can learn it on the job in an environment that is using , perhaps that might make it easier to do.
So far my approach ( on and off ) has been to study Odersky’s book , Programming in Scala. But that book can only take you so far before you become confused. There is a rather badly written book on Akka Actors whose first few chapters will help a little also before you become confused again and then forced to revisit Orderky’s book, Programming in Scala , again.
During those episodes , I also made use of examples in the internet. Eventually I went thru a series of exercises in converting old java algorithms to scala to become slightly more familiar with some of the simple aspects of Scala. THese aspects include what Java developers would be somewhat comfortable with such as : Classes, Traits, for loops, case expressions .
Eventually, I took a bold step at trying to understand the book: Functional Programming In Scala. I think I made it to the 6th or 7th chapter before it became OVERWHELMING.
I am currently back at the AKKA stage, trying to get thru the book “Akka In Action”. Up to chapter 8 at this point. From my perspective, I think learning Scala by yourself boils down to perseverance. I am slowly becoming very familiar with the language. But it has been a very difficult journey so far. I view myself as a beginner Scala Developer at this point. ONe thing I can say is that the Book “Functional Programming In Scala” is a very important book. But it is not a book that you can easily grasp initially. It requires several readings. Meaning , the first time you read part of it and learn a little bit. THen you study other references on scala and you will see why that book is very important. I have yet to attempt to read the book the second time but I do look forward to doing that because I can probably appreciated what it is trying to teach much better now. Another thing that seems to help in learning the language is to try to learn some of the frameworks associated with Scala. Akka Streaming , Akka http, Routes … are very interesting to understand; maybe attempt to write your own microservice. In java, I was and am an expert in concurrency/multithreading. So in Scala I have a unique interest in the Future trait. I would recommend looking carefully at the Future trait so that you can compare Scala’s multithreading with java’s multithreading. Scala’s multithreading is infinitely more sophisticate and better than Java’s multithreading ( in my opinion ). Also a lot of Scala’s frameworks make heavy use of the Future trait.


#6

I’ve been coding in Scala for 8 years now, and I love it. I have no interest in Java as a first-choice language any longer. It took me about 2 years to get to that point. Java is a professional necessity sometimes, but I find myself and the teams I work with incredibly more effective and efficient when I use Scala.

I can confirm, however, that it takes much effort to learn Scala: the collection system, the mind-shift that comes with learning functional programming (when coming from an OO mindset), the details of the Scala type system, figuring out what the heck “abstract override” is, what path-dependant types are and how they work, innately understanding the rules for implicit precedence, etc. – each of these are hard to master. It is hard, and indeed it does require searching out source material, and reading things over again and again. You really need to engage your brain to make the shift.

But it is worth it. There’s are problems you can solve in Scala and Akka (and sometimes scalaz, Monix/ZIO/fs2) that are just not achievable in Java. There are problems you don’t even attempt in Java; you are (maybe subconsciously) trained to avoid them because they are too hard, too complex, or not practical. These problems are approachable and solvable with functional programming, and the Scala toolset is a good way to program functionally.

Brian Maso


#7

Nope, those courses are free. Start here: https://www.coursera.org/learn/progfun1 , and choose the ‘audit’ option for taking the course, which will let you take it for free.


#8

Thank you very much:smile:


#9

As some people have indicated, the correct answer to this depends on your background. I like the answers that others have given assuming that you have significant background, especially in something like Java or C#. However, if you are more novice or have a need to also improve your CS foundations, I don’t think those resources are good options. Atomic Scala was designed to get people going with Scala who don’t have a background. I also have materials that I use to teach CS1 and CS2 using Scala. These include two textbooks: Introduction to Programming and Problem-Solving Using Scala and Object-Orientation, Abstraction, and Data Structures Using Scala, Second Edition. You have mentioned that money is an issue so you might find it more useful to go to the YouTube videos that I have for both courses that are free on my channel.


#10

Scala, Akka and functional programming are three distinct things that you don’t have to learn all at the same time.


#11

Hey Mark, I’ve been watching your playlist since a week it’s quite precise and easily understandable.
I’m willing to build web applications. Can you make more videos on Scala using Play Framework in future. That would be helpful.

Cheers!


#12

I would say more strongly that you shouldn’t try to do all three at the same time, unless that’s a specific goal of yours. It makes things unnecessarily difficult…


#13

I’m glad that you have found the videos to be helpful. I was actually just thinking about doing a video playlist for Play. I’m teaching a class this semester that will be using Play, and I was considering making a Playlist for it. Hopefully I can get going on that in the next week or two.


#14

That’s great :smile:


#15

Interesting. Scala , Akka and functional Programming being viewed as 3 distinct unconnected things. This probably has more to do with where your interests lie. I view them a one combined thing. Scala represents the basic building block. Functional programming is the grammar of that building block. Akka is a framework that extends the two onto a multi-node environment. I am and always have been keenly interested in multi processing/ multi threading. So it is hard for me to separate the three from one another. Also,I might contend that due to the very nature of hardware nowadays it seems foolish not to view any programming language as a means to exploit multiple cores and multiple nodes simultaneously. The combination of Scala, functional programming along with the “HUGE” akka framework make this possible.
Oh I forgot about something. The “Old” Object-Oriented thing. I tend to push that one down into the guts of Scala Programming language; a given; something that comes with the territory. Maybe viewed more as a way to structure the data you manipulate; a way to structure your programs. I think one of the major obstacles a person has to overcome when learning Scala if you come from a Java background is to “not think that OOP and Design Patterns” are the cure for all evils.


#16

Regarding Scala and (basic) functional programming, I’m with you. Learning functional programming as someone coming from an imperative style often includes learning a new language anyway (with features more suited to FP), might as well be Scala.

But Akka, as an external library, usually requires you to already have an understanding of how typical Scala code works, so I’d say it should definitely come later. Of course you can learn it before getting to advanced FP concepts, but those mostly are in external libraries too. Also, Akka is not the only way of using multithreading and is not always the right choice. Parallelizing operations on large collections for example is much simpler with the builtin parallel collections.


#17

For basic FP, I agree. Really, at this point I think basic FP is necessary in almost every programming language – from JavaScript to C#, that’s been an assumption for a long time – but in Scala it is essential.

But it’s important to keep in mind that there are multiple definitions of “FP” floating around. Closures and higher-order functions are a core part of the language, and it’s very hard to get anything done without them. On the other hand, there is pure FP – writing in a strictly functional style. (What I think of as “Red Book Scala”.) That is not usually mandatory; most Scala programmers don’t work in that style. (I’m finally getting into that style, after 10 years of Scala programming.) Moreover, if you are used to OO style, it tends to be quite a bit more work to learn. So I don’t usually recommend starting out there unless it is a specific goal of yours – as @sidhartha11 has shown, trying to learn Scala that way can be significantly harder.

Note: I don’t believe that FP is intrinsically harder – far as I can tell, it’s much easier to learn if you don’t have years of mutable habits to undo. So for a new programmer, I might recommend starting out that way. But for folks coming from other languages, I would take things step-by-step.

As for George’s point about Akka – look, I’m a hardcore hakker. I have been playing with Akka literally since the day Jonas released the first prototype (long before it was named Akka), and my company is entirely built on it. I teach classes on it. It’s useful, and it’s important. But most Scala programmers will never touch it directly, nor should they – it’s crucial for certain use cases (specifically, where you need to be managing in-memory state at large scales), but not for most of them. So I strongly think it shouldn’t be conflated with learning Scala: it’s a separate learning process, and arguably a much larger one if you want to cover all of Akka.

Not to mention, Akka is significantly in tension with hardcore FP programming – while I believe the two approaches are more compatible than many folks claim (and moreso with Akka Typed), they’re certainly very different approaches to building applications at the moment. I rarely hear of Akka and pure-FP being used together – I’ve had to do a lot of experimentation just to push them together as much as I have, and I’ve only taken a few steps in that direction yet. So tackling all three seriously at once is setting yourself up for contradictions…