Scala Guide

Back to Library

Originate Guides - Scala

Introduction

Welcome to Originate’s Scala Guide. This guide contains recommendations for formatting conventions, coding style, and best practices based on person-decades of experience gathered across innumerous Scala projects.

Organization

The guide is organized as follows:

  1. The first section, “Code Formatting”, covers code layout conventions, i.e., guidelines that do not alter the meaning of a program:
    1. The section itself highlights the main points of the official Scala Style Guide. Reading the official guide completely is required.
  2. The subsection “Additions and Deviations” contains the points where we differ from the official guide, plus some topics that are not covered by it. To ease on-boarding and favor consistency, we try to deviate as little as possible from the official guide.
  3. The second section, “Best Practices” covers rules that may change the meaning of your code:
    1. Additional recommendations”, for the most part, are required rules that must be followed unless there is a very good reason not to. Failure to fully obey these conventions may introduce errors, degrade performance, or create maintenance headaches.
    2. Tips & Tricks” are mostly friendly reminders that may not apply in all situations. Always keep them in mind and use your best judgement.
    3. Additional Remarks” are general hints that are always helpful to remember.
  4. Finally, the “Reference” contains recommended further reading.

Static Analysis Tools & Configuration

A skeleton project accompanies the guide. It encodes and enforces as many best practices as currently available tools allow us. Try to use as much of its default configuration as you can on your Scala projects.

Back to Library