Get startedGet started for free

The essence of Scala

1. The essence of Scala

Congrats! You've made it to the end of this

2. The final video!

Introduction to Scala course. You now have a solid foundation for deciding what's next. Hopefully that's continuing further because the language seems like a great fit for you! Here's one final takeaway on programming styles in Scala.

3. The functional style

In the functional style, we prefer operations of our program to map input values to output values. An analogy for this is a pipe with no leaks. Input liquid from other pipes, flowing in, those liquids combining to create something new, then that new mixture flowing out of the pipe, again with no leaks in between.

4. Non-functional code

When this statement isn't true, we've got a pipe with leaks. Not all leaks in a pipe with leaks spurt out water: sometimes the water flows a certain way to pass over it or a piece of debris or sediment blocks the leak. In large systems of pipes though, there is bound to be a leak that spurts SOMEWHERE and streams of water spurt out as a side effect.

5. The functional style

When your script or application runs often or affects lots of users, it's nice to have non-leaky, well-maintained pipes. Well-written, functional-style Scala code lets you have this.

6. Benefits of the functional style

The first three benefits of the functional style are similar to those of immutability. You won't change variables accidentally, since you don't CHANGE variables passed as inputs to your functions. You just use them to create a new result. Your code becomes easier to reason about, as functions are less entangled. In, out, that's it. You won't have to test for side effects. Plus, the functions you create are more reliable and reusable.

7. Scala is a hybrid imperative/functional language

Remember, Scala is a hybrid imperative/functional language. vars and side effects are not intrinsically evil. Sometimes, programming in an imperative style with the Scala code you write solves your problem better. The designers of Scala suggest the following: look to use vals, immutable objects, and functions without side effects at first instinct, then use vars, mutable objects, and functions with side effects when the need arises. Experience is the best teacher so continue your Scala journey to understand what finding this ideal balance feels like.

8. What's next

What else is next in that journey? Scala is a rich language so there's plenty to learn, both in terms of programming fundamentals and data-specific applications, like using types specifically designed for financial data, big data analysis with Apache Spark, interacting with databases, and more. So exciting.

9. The essence of Scala

Let's end the course on a quote from Martin Odersky, the designer of Scala. At the 10th anniversary of the Scala Days conference, he discussed the reason why he created Scala in the first place:

10. The essence of Scala

he wanted to show that the fusion of functional programming and object-oriented programming

11. The essence of Scala

in a statically-typed setting could be practical and powerful. He said this combination is the essence of Scala, since Scala was the first mainstream language to successfully try the first two with the third. He's been proven right. Scala powers some of the world's largest websites, applications, and data engineering infrastructures.

12. Congratulations!

Now, it's official. Congratulations on finishing the course!