Hacker News new | past | comments | ask | show | jobs | submit login

I've been interested in venturing into Scala but have not found a good resource for getting a development environment setup. Should I be using an IDE or will sbt/Sublime be sufficient?



I'm using Scala with Ensime in Emacs. It is not as good as the Scala IDE, but it is quite good. The reason I'm doing it is that I like to use the same editor for all the languages that I'm using, so that any additional plugins / modifications I do are not just for this one language, but can be leveraged for everything I do.

However, If that is not a requirement for you, you should really be using the Scala IDE (Eclipse plugin), it has great autocompletion, refactoring, and more.

I have to say I also started with Scala IDE because, when starting with a completely new language, I tend to just install the default IDE so that I don't have to fight two battles in the beginning but can concentrate fully on the language. Otherwise, you'll loose interest / give up even faster.


Take a look at Typesafe Activator - www.typesafe.com/activator - it's a pretty slick way to get up and started without all the IDE setup costs by simply running an IDE for you in your browser.


You'll level up much faster with an IDE (IMO).

Ensime in Sublime is kinda pointless I think since it only updates on file change. The REPL and SBT integration is nice.

I use Sublime for quick examples in Scala, or as a VIM alternative for larger projects (as opposed to my main editor like with Ruby).

For most of my Scala work I use IntelliJ though. The lack of half-decent theming in Eclipse and Preferences/Settings being all over the place really puts me off ScalaIDE personally.

Going from Zero to Code in IntelliJ and SBT (on OSX) is pretty trivial. Given a command-line "Hello World" with a traditional Maven layout:

First, install IntelliJ, navigate to "Plugins" under preferences and install the Scala plugin.

Now make sure you have Homebrew installed (http://brew.sh)

  $ brew update
  $ brew install sbt --devel # currently 0.13.0-RC5
  $ cd ~/src/
  $ mkdir hello-world
  $ cd hello-world
  $ mkdir project
  $ echo "sbt.version=0.13.0-RC5" | tee project/build.properties
  $ cat <<EOS | tee project/plugins.sbt
    resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")
    EOS
  $ cat <<EOS | tee build.sbt
    name := "hello-world"

    version := "1.0-SNAPSHOT"
    EOS
  $ mkdir -p src/main/scala
  $ cat <<EOS | tee src/main/scala/Whatever.scala
    object Whatever extends App {
      println("Hello World!")
    }
    EOS
  $ sbt
  > compile
  > gen-idea
  > run
And there you go. It could be simpler if we were having a LOC competition, but this is actually very close to the exact setup I use for projects day in and day out, including getting a jump on the next version of SBT and best-practicey stuff like setting the SBT version in build.properties.

If this were a Play app, you might have a "project/plugins.sbt" that looked something like this (to get a jump on the upcoming Scala 2.10 version of Play, that integrates with SBT 0.13.x):

  // Comment to get more information during initialization
  logLevel := Level.Warn

  resolvers := Seq("Maven Central" at "http://repo1.maven.org/maven2/",
                "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
                "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/",
                "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/")

  addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-M2")

  addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")
This just adds a few more common resolvers you might use for dependencies, and locks you to the latest Play milestone snapshot. You can pretty much otherwise copy/paste files/folders from a sample Play app, like you might see with the Typesafe Activator for example.

Good luck!


Excellent, thx.

(just remember "brew doctor" first).

Also for non-maccies: http://www.scala-sbt.org/0.13.0/docs/Getting-Started/Setup.h... (it would be nice to discuss the red hat and debian distro families in that Setup page, it looks like you can't currently "apt-get sbt"


Wow, thanks so much for this! I really appreciate it.


there's this https://github.com/n8han/giter8 project that's supposed to create scala project templates for you from the command line, but never really got into it so i can't really comment.


  > The lack of half-decent theming in Eclipse and
  > Preferences/Settings being all over the place
  > really puts me off ScalaIDE personally.
Agree. I can recommend http://eclipsecolorthemes.org/ combined with https://github.com/jeeeyul/eclipse-themes.


sbt + sublime is certainly sufficient. I program in Scala all day long. I know many developers use the IntelliJ IDE.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: