Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

École Polytechnique Fédérale de Lausanne

Effective Programming in Scala

École Polytechnique Fédérale de Lausanne via Coursera

Overview

Scala is an expressive, versatile, and safe programming language. In this course, you will learn how to get the most out of Scala to solve common programming tasks such as modeling business domains, breaking down complex problems into simpler problems, manipulating data, or running parallel tasks. Along the journey, you will also learn the best practices for writing high-quality code that scales to large applications, how to handle errors, how to write tests, and how to leverage a productive development environment. This comprehensive, hands-on, course aims at leveling up your programming skills by embracing both functional programming and object-oriented programming. You will become familiar with the standard library and the common patterns of code used in the real world. Each week contains about 1h30 of video lectures. Each lecture is a ~10 min video focused on a specific skill or concept. We always start by looking at concrete problems, and then explain how language features or libraries make you more productive to solve these problems in general. Lectures are generally followed by a quiz to assess your progress. At the end of each week, a graded assignment inspired by real-world applications will give you an opportunity to put things in practice. The course covers Scala 3, and it mentions the differences with Scala 2.

Syllabus

  • Getting Started, Basics, Domain Modeling
    • First, get up and running with Scala on your computer. Then, learn how to write and evaluate basic expressions and definitions. Last, learn how to model a business domain by defining case classes and sealed traits.
  • Standard Library, Loops
    • Manipulate collections of values by using the generic List data type from the standard library. Then, learn about the other generic data structures provided by the standard library (sets, sequences, and maps), and their respective use cases. All the collection classes have a comprehensive set of high-level operations to transform, filter, and iterate over their elements. Last, you will learn a couple of techniques to implement loops in Scala, and their tradeoffs.
  • Build Tools, Modules
    • How to write Scala projects larger than a worksheet? Learn how to define an entry point for a Scala project, and discover the tools you can leverage to write, compile, run, and debug your code. Then, use object-oriented programming techniques to break down a complex project into small modular components. Finally, we discuss when to use case classes versus simple classes.
  • Reasoning About Code
    • The recommendation in Scala is to use immutable data types by default. Indeed, they have desirable properties such as being thread-safe and allowing local reasoning. However, in some cases, mutable variables lead to simpler code, as you will see in the lectures. We then dive into different testing techniques such as unit testing, property-based testing, integration testing, and mocking.
  • Type-Directed Programming
    • Programs automate repetitive tasks. Sometimes, writing a program is a repetitive task. We look into a unique feature of Scala that lets the compiler write some (repetitive) parts of your programs for you! Based on the expected type of a parameter, the compiler can provide a value for this parameter if it finds an unambiguous candidate value. This technique is often used to automatically generate the serializer and deserializer of a data type, solely based on its definition, for instance.
  • Error Handling, Concurrent Programming
    • Scala supports a simple low-level mechanism for error handling: exceptions. We discuss the pros and cons of this mechanism, and we show alternative approaches that you can apply when you want to make it explicit in a method signature that it can fail with an error. We then move to a similar topic, input data validation, where we want to construct nice-looking error messages listing all the errors that the user needs to fix. We conclude with a couple of lectures showing how to work with asynchronous computations, and how to leverage the multiple CPUs of a computer by running tasks in parallel. You will see that the same idioms we used for writing data validation rules can also be used to write graphs of parallel computations.

Taught by

Julien Richard-Foy and Noel Welsh

Reviews

4.7 rating at Coursera based on 153 ratings

Start your review of Effective Programming in Scala

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.