Great Lakes Software Symposium

November 8 - 10, 2013

Scala Koans - A New & Fun Way to Learn Scala (Bring a Laptop)

Sunday - Nov 10 11:00 AM - Ballroom 1/2

Daniel Hinojosa

Daniel Hinojosa

Independent Consultant/Developer

Have you looked into Scala? Scala is a new object-functional JVM language. It is statically typed and type inferred. It is multi-paradigm and supports both object oriented and functional programming. And it happens to be my favorite programming language.

If you are interested in Scala, how you are planning to learn Scala? You probably are going to pick up a book or two and follow through some examples. And hopefully some point down the line you will learn the language, its syntax and if you get excited enough maybe build large applications using it. But what if I tell you that there is a better path to enlightenment in order to learn Scala?

Scala Koans, a set of test cases that will teach you Scala language. The Scala koans will help the audience learn the language, syntax and the structure of the language through test cases. It will also teach the functional programming and object oriented features of the language. Since learning is guided by failing tests it allows developers to think and play with the language while they are learning.

Workshop Requirements

This session is a workshop. Please come prepared.

Namaste,

For those planning to attend the Scala Koans…

Welcome to Scala Koans!

Scala Koans is an interactive session that puts the programming and learning in your hands. Therefore, a laptop is required by all participants. If you do not have a laptop, then perhaps you have a friend with a laptop, is so, well, that would work too. In order to participate in the Scala Koan endeavor, a few things are required:

  • A laptop
  • A modern JDK installation. JDK 1.6+ will suffice. Remember that it should be a JDK and not a JRE!
  • Your JDK should be mapped properly to JAVA_HOME and your PATH variables.
  • An installation of your favorite IDE or editor.
  • An inquisitive mind.

The process of actually running the koans will be covered during the session. Unfortunately, Internet connectivity is sometimes a dicey affair and at times it can rain on our parade. To avoid having to wait for the install at the conference you can prepare for the koans before the conference! If you don't have the opportunity to do this, we will have either memory sticks or private networks at the conference.

If you want to get started with the set up:

  1. Download the koans by visiting https://bitbucket.org/dmarsh/scalakoansexercises and click on the download link on the right hand side of the page. (or you can clone the bitbucket project)
  2. Unzip the koans: dmarsh-scalakoansexercises-#####.zip
  3. cd into the dmarsh-scalakoansexercises-#### folder
  4. If you are in Linux or MacOSX run: ./koans, on Windows ./koans.bat
  5. After some initialization, you are now in the koans/sbt shell (you should see a > prompt)
  6. In the shell run the following commands:
    a. test:compile
    b. eclipse (if you are planning to use Eclipse)
    c. gen-idea (if you are planning to IntelliJ Idea)
  7. Exit the shell by typing exit

Before attending the koans session, you may want to take the opportunity to load some Scala Plugins onto your favorite IDE and Editor. Below is a list of resources that you can use to enhance your environment so that you can enjoy Scala syntax highlighting and other helpful tools like refactoring, debugging and analysis.

Eclipse - The Eclipse has an IDE plugin for Scala called aptly scala-ide. All the information about the plugin can be found at http://scala-ide.org including an easy to follow along video located at http://scala-ide.org/docs/current-user-doc/gettingstarted/index.html. Scala-IDE is also available at the Eclipse Marketplace!

IntelliJ - IntelliJ has a Scala plugin that can be found by going to Settings -> Plugins, clicking on 'Browse Repositories' button and searching for the 'Scala' plugin on the left. Right click on the 'Scala' and choose 'Install'. IntelliJ will prompt you to restart the IDE, do so, and enjoy.

NetBeans - Currently, Github user 'dcaoyuan' hosts a NetBeans Scala plugin at the address: https://github.com/dcaoyuan/nbscala. I have not tried this out since the number of NetBeans users has shrunk in recent years. If you are an avid NetBeans user, and wish to try it, you can let me know the results during the session. There is additional information at: http://wiki.netbeans.org/Scala

Emacs - Github user 'aemoncannon' has created 'ENSIME' (ENhanced Scala Interaction Mode for Emacs) at the address and has a great following. https://github.com/aemoncannon/ensime with some documentation at http://aemoncannon.github.io/ensime.

VIM - For VIM users you can use https://github.com/derekwyatt/vim-scala as a VIM plugin that offers Scala color highlighting

That is it. Hope to see you soon.

Video Preview

About Daniel Hinojosa

Daniel is a programmer, consultant, instructor, speaker, and recent author. With over 20 years of experience, he does work for private, educational, and government institutions. He is also currently a speaker for No Fluff Just Stuff tour. Daniel loves JVM languages like Java, Groovy, and Scala; but also dabbles with non JVM languages like Haskell, Ruby, Python, LISP, C, C++. He is an avid Pomodoro Technique Practitioner and makes every attempt to learn a new programming language every year. For downtime, he enjoys reading, swimming, Legos, football, and barbecuing.