I enjoy developing with Scala and highly recommend it to anyone writing server applications and other types of programs suitable for Java-like languages. If you are working in domains suitable for running the Java Virtual Machine such as web applications, services, jobs, or data processing, then Ill certainly recommend that you try using Scala.
Reason 1Your Code Will Be Better
You will be able to start using functional programming techniques to stabilize your applications and reduce issues that arise from unintended side effects. By switching from mutable data structures to immutable data structures and from regular methods to pure functions that have no effect on their environment, your code will be safer, more stable, and much easier to comprehend.
Your code will also be simpler and more expressive. If you currently work in a dynamic language such as Python, Ruby, or JavaScript, you already are familiar with the benefits of using a short, expressive syntax, avoiding unnecessary punctuation, and condensing map, filter, and reduce operations to simple one-liners. If you are more familiar with statically typed languages like Java, C#, or C++, youll be able to shed explicit types, punctuation, and boilerplate code. You will also be able to pick up an expressive syntax rarely seen in other compiled languages.
Finally, your code will be strongly typed (even without specifying explicit types) and support both multiple inheritance and mixin capabilities. Also, any type incompatibilities will be caught before your code ever runs. Developers in statically typed languages will be familiar with the type safety and performance available in Scala. Those using dynamic languages will be able to drastically increase safety and performance while staying with an expressive language.
Reason 2Youll Be a Better Engineer
An engineer who can write short and expressive code (as one expects in Ruby or Python) while also delivering a type-safe and high-performance application (as one expects from Java or C++) would be considered both impressive and valuable. I am assuming that if you read this book and take up Scala programming you will be writing programs that have all of these benefits. Youll be able to take full advantage of Scalas functional programming features, deliver type-safe and expressive code, and be more productive than you have ever been.
Learning any new programming language is a worthwhile endeavor, because youll pick up new and different ways to approach problem solving and algorithm and data structure design, along with ways to express these new techniques in a foreign syntax. On top of this, taking up a functional programming language like Scala will help to shape how you view the concepts of data mutability, higher-order functions, and side effects, not only as new ideas but how they apply to your current coding work and designs. You may find that working with inline functions and static types are unnecessary for your current needs, but youll have some experience with their benefits and drawbacks. Plus, if it becomes possible to apply these features in a partial manner to your current language, such as the new lambda expression support in Java 8, youll be ready to handle them appropriately.
Reason 3Youll Be a Happier Engineer
This is admittedly a bold statement from someone you havent met and who shouldnt presume to know what effect Scala development will have on your brain. Ill only state that if your code proficiency improves to the point that you are easily writing code that works better, reads better, debugs better, and runs faster than before, and on top of all this takes less time to write, youre going to be happier doing so.
Not that life is all about coding, of course. Nor does the work schedule of average software engineers involve more than half of their time spent actually writing code.
But that time spent writing code will be more fun, and youll be able to take more pride in your work. That should be reason enough to learn something new.
Why Learning Scala May Not Be for You
You should know that Scala has a reputation for being difficult to learn. The language combines two apparently conflicting software engineering paradigms: object-oriented programming and functional programming. This synergy will be surprising to newcomers and the resulting syntax takes some practice to pick up. Scala also has a sophisticated type system that enables custom typing declarations at a level rarely seen outside of academic languages. Ascertaining the syntax and utility of this type system will be challenging, especially if you do not have academic experience with abstract algebra or type theory.
If you do not have enough time to spend on reading this book and going through its exercises, or alternately prefer more challenging or theoretical routes to learning the language, then this book may not be suitable for you.