O'Reilly logo
live online training icon Live Online training

Scala Core Programming: Methods, Classes, and Traits

IDEs, methods, and classes

Daniel Hinojosa

Scala is a dynamic, general-purpose programming language for the Java Virtual Machine (JVM) used in everything from data science to distributed computing. Join expert Daniel Hinojosa for a deep dive into core Scala programming topics, including IDEs and other build tools, methods, classes, and traits. You’ll master best practices so you can write Scala code that is elegant, scalable, and fully interoperable with Java.

This class is a great follow-up if you’ve taken Daniel’s Learn the basics of Scala in 3 hour course or if you already understand concepts such as manipulating variables, classes, and functions.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • How to use recursion in methods
  • Prerequisites and class constructors
  • What a trait is and how to stack and mix in traits

And you’ll be able to:

  • Create and set up basic projects
  • Determine and use generic types
  • Avoid the "diamond of death" when using inheritance
  • Use self types to guide how to inherit classes and traits

This training course is for you because...

  • You're already using Scala, and you want to know more about classes, abstract classes, and traits.
  • You want to understand object-oriented programming in Scala and compare object orientation in Scala to the language you use.
  • You want to explore Scala in more detail.


Materials or downloads needed in advance:

A machine with the latest JDK 8 or JDK 9, Scala, the latest IntelliJ or Eclipse with the Scala and Scala-IDE plugins, and SBT installed and set up

Recommended preparation:

"Why Is Scala So Popular?" (article)

Scala School Basics (tutorial)

A Scala Tutorial for Java Programmers (tutorial)

Recommended follow-up:

Scala Fundamentals (Learning Path)

Functional Programming in Scala (book)

Scala School (tutorial)

About your instructor


The timeframes are only estimates and may vary according to how the class is progressing

Scala methods (40 minutes)

  • Lecture and hands-on exercises: Embedding methods; recursion; repeated parameters; default parameters

Break (10 minutes)

Scala classes (65 minutes)

  • Lecture and hands-on exercises: Scala classes overview; case classes overview; preconditions; subclassing; abstract classes; basic generics

Break (10 minutes)

Determining instances (15 minutes)

  • Lecture and hands-on exercises: isInstanceOf; asInstanceOf

Scala traits (40 minutes)

  • Lecture and hands-on exercises: Interface replacement; abstract class replacement; mixins; avoiding the "diamond of death"; stacking traits; self types