CS:2820 Object-Oriented Software Development
Spring 2015

Internal Resources

Several of the tools used in this course will be installed on the machines in the CS labs.

All tools below are installed on the Linux machines of the DIVMS labs. To use those installations, you need first to log in to a lab machine. You can do that either

  • directly, by using one of the Linux desktops in 301MLH, or
  • remotely from any computer connected to the internet and running the NoMachine client to connect to the lab's Linux server. See the CLAS help pages for how to install and use those clients; specifically, the Remote Linux Environment page.

These tools are freely available and you can also download and install them on your own computer if you want. See the External Resources section for pointers.

Scala

  1. Scala Editors and IDEs
  2. Scala Interpreter
  3. Simple Build Tool (sbt)

UML

  1. Violet and ArgoUML diagram editors

Scala Editors and IDEs

For the programming work in this course you can use any editor of your choice to create and edit Scala programs. Several editors provide syntax highlighting for Scala, although you might have to install the necessary extension yourself. Available editors on the Linux machines include Emacs, BlueFish, jEdit, gedit. The current gedit's installation supports Scala files as is.

Scala is also supported by all major IDEs (Eclipse, IntelliJ IDEA and Netbeans). Although using such IDEs is overkill for this course, you are welcome to use them if you are already familiar with one of them. However, you will have to install the necessary plugins yourself (on the Linux machines or your own).

Scala Interpreter

  1. Open a terminal, for instance by selecting Applications Menu|Terminal Emulator from the top menu of the Gnome Desktop.

  2. At the terminal's prompt enter: scala

  3. You can now interact with the interpreter by entering any Scala code you wish.

The scala compiler scalac is also available from the terminal. However, sbt is a more convenient tool for developing and compiling Scala projects.

Simple Build Tool

SBT can be used from a terminal window in Linux or MacOs and from a command window in Microsoft Windows.

Creating a simple project with SBT

  1. First create a base directory to store the contents of your project, for example my_project.

  2. Add all source files you wish to include in your project to the directory my_project/src/main/scala.

  3. In my_project create a file called build.sbt. This file will contain build settings for your project.

  4. Edit build.sbt in your preferred text editor.

A build.sbt file is a set of key-value pairs describing various configurations of your project. Values are associated with a given key in the build.sbt file using the following syntax key := value .

Typically three key-value pairs are always defined in build.sbt:

name, the name of you project;
version, the version of your project; and
scalaVersion, the version of Scala to be used with your project.
For example, here is how the contents of a typical build.sbt might appear:
   name := "Hello"
   version := "0.1"
   scalaVersion := "2.11.4"

SBT also allows users to indicate library dependencies for their project. These dependencies can be defined by adding the following in build.sbt:

   libraryDependencies += <groupId> % <artifactID> % <revision>
Note that the operator += appends a library to the previous value of the libraryDependencies attribute (where := would replace the previous value).

Check the External Resources section for more information of how to set up build.sbt.

Working with SBT on the CS Linux machines

  1. Open a terminal, for instance by selecting Application Menu > System > Terminal from the top menu of the Gnome Desktop.

  2. At the terminal's prompt change to your sbt project directory, for example:
    cd my_project

  3. At the terminal's prompt enter:
    sbt

  4. Running sbt like this will start it in interactive mode.

SBT Interactive mode

When using SBT in interactive mode users are presented with a command prompt where they can enter a variety commands. The most useful commands for the purposes of this class are:

compile
Compiles the main sources of your project.

run
Runs the main class of the project.

test
Runs any tests defined in the subdirectory src/test/scala/ of your project.

For convenience sbt also allows commands to be automatically rerun whenever a source file of the project is modified. This is done by prefixing a given command with ~. For example,

    ~ compile
will watch for changes in source files and automatically recompile them accordingly.


Violet and ArgoUML

Working with the Violet UML editor on the CS Lab machines

  1. Open a terminal, menu of the Gnome Desktop. for instance by selecting Application Menu > System > Terminal from the top menu of the Gnome Desktop.

  2. At the terminal's prompt enter:
    /group/class/cs_2820/violet
    or
    /group/class/cs_2820/argo





Copyright: Cesare Tinelli, The University of Iowa, 2015