"We cannot solve our problems with the same thinking we used when we created them."
– Albert Einstein
When we try to solve problems by writing programs, our intention is to write better code. More precisely, we mean that code should be readable and efficient at compile time and runtime. Readability and efficiency are two major factors, along with other important concepts such as concurrency, asynchronous tasks, and so on. We can think of the first two as the building blocks for the next set of characteristics we want. Scala, as a multi-paradigm language, provides multiple constructs that ensure the code we write is optimized, and also provides syntactic sugar wherever required. Many of the functional constructs or concepts used in functional programming enable you to write better code that not only fulfills the first two...