Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 3.1 KB

learning_scala.md

File metadata and controls

48 lines (35 loc) · 3.1 KB
layout order title site_nav_entry
page
15
Learning Scala
true

This guide assumes no prior knowledge of Scala and will get you set up to the point where you have Scala installed on your computer and can hack on a project.

Learn

We recommend reading Programming in Scala to learn the language.

If you come from an object oriented background, you will hear people talk about Functional Programming (FP), monads and typeclasses. Learn about them by getting Functional Programming in Scala for Mortals by @fommil.

Before installing any software, you can complete exercises online at scala-exercises.org and execute code in your browser at scalafiddle.io.

Install

  1. Install Java: Scala runs on the Java Virtual Machine (JVM).
    Prefer free/libre OpenJDK to proprietary versions of Java.
    Install OpenJDK using your system package manager:
  • sudo pacman -S openjdk8-src (ArchLinux)
  • sudo apt-get install openjdk-8-source (Debian)
  • Zulu Java for all other systems
  1. Install sbt: sbt will install all the build tooling you need, including Scala.
  1. (GNU / BSD, Optional): If you anticipate using multiple versions of Java, install jenv.

First Project

If a volunteer would like to pad out the following, that'd be great. Until then, try Daniel Spiewak's "Getting Started in Scala" guide

  1. checkout a basic tutorial project, e.g. 99 problems or scalania
  2. start sbt and cheatsheet of basic commands (for now, try sbt common commands)
  3. hello world in the editor without ensime (e.g. /editors/emacs/scala-mode) starting from scratch with sbt new eed3si9n/hello.g8

Only when you have been able to write simple puzzles should you start ensime server, for now read Getting Started.

Bear in mind that there are several components (for Emacs with sbt) that go beyond just Scala the language:

  • Emacs itself for common text editing and project management
  • sbt the build tool for downloading your deps and building / running your app and tests
  • sbt-mode for interacting with sbt from within emacs
  • sbt-ensime, our plugin to the build tool to generate a .ensime file and provide nice functionality in the build.
  • ensime-emacs, our emacs plugin to talk to the server
  • ensime-server, our server component that indexes your binaries and understands source code context