Scala Fundamentals Training Course
The Scala Language Fundamentals course serves as an introduction to the Scala language, with particular attention to its novel approach combining the object-oriented and functional programming paradigms. Students with a background in imperative, object-oriented programming will learn to incorporate patterns from functional programming into their design repertoires.
On completion of this course, students will have written a simple application using idiomatic, functional-style Scala. The application will demonstrate how the use of first-class functions and pattern matching, along with a powerful expressive type system can result in very easily understandable and maintainable code. Students will be able to:
- Explain what Scala is and how it compares to both its object-oriented and functional language predecessors
- Exploit the compositional nature of functions and expressions to avoid the pitfalls associated with Java-style imperative code
- Navigate and utilize Scala's rich standard library
- Write highly composable, modular code using a pure functional style
sbtto manage the build lifecycle and dependencies
The Scala Language Fundamentals course is geared primarily toward developers with some Java experience, who are interested in becoming more effective or leading more effective teams by adopting the next generation of JVM-platform languages. Prior experience with Java is not strictly required, but will be helpful to understand some examples where the two languages, and the patterns and frameworks used most commonly in each, are compared.
The course is also appropriate for developers with experience in other object-oriented languages who are interested in understanding the principles of functional programming, applicable to many other languages gaining momentum in the industry including Clojure and Haskell.
Students enrolled in the Fundamentals of Scala course should have some prior software development experience, preferably in Java. The course assumes some familiarity with:
- IDEs such as Eclipse or IntelliJ IDEA
- Build tools such as Make, Ant or Maven
- Basic procedural language constructs (e.g.
for-loops) and object-oriented programming concepts (e.g. inheritance, polymorphism)
For twelve years, Dan has been doing his best to write and help others write some damn fine code. Dan is author of Marakana's Scala Fundamentals course, the latest addition the the Marakana course catalog. Before joining Marakana, he worked as a Developer Advocate at Atlassian, teaching developers how to write plugins for Atlassian's collaboration and development tools. Prior to Atlassian, Dan worked in both engineering and sales for Coverity, helping developers maintain code quality using Coverity's sophisticated static and dynamic analysis tools.
Between Coverity, Atlassian and Marakana, his tutorials have covered C/C++ best practices, Java web development (including Maven, Spring, OSGi, Guava, and RESTful web services using Jersey and Jackson), front-end development using jQuery, and functional programming with Scala.
Dan's latest hobby is lurking on StackOverflow as user "mergeconflict," waiting for tricky Haskell and Scala language questions to jump on. More about Dan Rosen...
- Scala's pedigree: Java, Haskell, Pizza, GJ
- Who uses Scala? Debunking the Functional Programming "ivory tower" myth
sbt: "Simple Build Tool" and the Scala REPL
- The "Scala IDE" plugin for Eclipse
- Scala API docs
Data and Control Flow
- Syntax introduction: declaring classes, primary constructors and class members (
- By-value and by-name parameters
- Scala's unified type hierarchy
- Local type inference
- Pattern matching and control-flow expressions
- Syntactic sugar: omitting dots and parentheses
- Classes, objects and companions
- Case classes and case objects
- Inheritance and Polymorphism
- The "Uniform Access Principle"
- Fine-grained access modifiers
- Traits, mix-in inheritance and linearization
Introduction to Generics
- Parametric polymorphism: generic classes and generic methods
- Generic type bounds: when inheritance and generics collide
- A quick peek at variance annotations
- Functions are objects
def foo(a: A): Bis a function
A => Bor a
- Functions can be bound to variables and passed as parameters to other functions
- Standard functional collection methods:
- Anonymous functions (lambdas, closures)
- Syntactic sugar: the mysterious
- Currying and partial application: the "loan" pattern
- Error handling
finally(with pattern matching)
- Turning exceptions into
- Common mistakes
- Pattern matching pitfalls: variable patterns vs. stable identifier patterns
- Underscores gone awry: block expressions and function literals