Yuan Tian

PhD life | Computer & Health Science | Music and Dance | Views Are My Own

Functional Programming in Scala

Categories: iLearn    Tags: 2017    notes   

Yuan Tian Posted at — Jan 6, 2018

Functional programming (FP) finally goes mainstream. It is not a new concept, but it is absolutely a complex one for beginners including me. I got exposed to a large set of references, online courses and books, and I will try to organize them in a useful way.

Why Functional Programming (FP)? Why Scala?

I enjoyed the talk given by Martin Odersky, which answer the two key questions with very simple code examples. The 15-minutes talk is Working Hard to Keep it Simple with slides on SlideShare.

Where should I start with FP in Scala? click here

1. Set up and get started in Scala:

A super quick start will be using Scastie, Scala in browser, to jump directy into Scala without installing anything.

You always can choose to work with an IDE such asIntelliJ with sbt, which you need to set up the environment in your local machine.

A third option is to user docker. Install docker and then use the docker image to launch Appache Zepplin which has mutiple interpreters supporting Spark, Scala, Python and other languages.

docker run -p 8080:8080 --rm --name zeppelin apache/zeppelin:0.7.3
docker run -p 8080:8080 --rm -v $PWD/logs:/logs -v $PWD/notebook:/notebook -e ZEPPELIN_LOG_DIR='/logs' -e ZEPPELIN_NOTEBOOK_DIR='/notebook' --name zeppelin apache/zeppelin:0.7.3

After setting up the Cassandra Spark Connector with login, here is the new command:

docker run -p 8080:8080 --rm -d -v $PWD/interpreter.json:/zeppelin/conf/interpreter.json -v $PWD/logs:/logs -v $PWD/notebook:/notebook -e ZEPPELIN_LOG_DIR='/logs' -e ZEPPELIN_NOTEBOOK_DIR='/notebook' --name zeppelin apache/zeppelin:0.7.3

2. Beginner's Guide

The documentation is always the first-hand source you need to explore. There is no better way to learn a programming language than getting your hands dirty in the codes. Of course, we need instructions and guidance. Here is a list of places that you can start:

comments powered by Disqus