Thursday, July 31, 2008

A novice Scala programmer: Eclipse vs. IntelliJ IDEA vs. Netbeans. Creating and running Scala project with Netbeans.

In a first post in this Scala mini series I described my experience with installation of Eclipse, IntelliJ IDEA, and Netbeans applications and installation of Scala plugins in those environments.
In a second post I explained how would I create, set up, run and debug Scala project in Eclipse.
In a third post I explained how would I create, set up, run and debug Scala project using IntelliJ IDEA.
Now, let's now follow the process of creating, configuring, running, and debugging a simple Scala project with Netbeans. As a test project I will use the same "Rational" class defined in chapter three of the wonderful Programming in Scala book written by Martin Odersky, Lex Spoon, and Bill Venners.

VII. A process of creation Scala application with Netbeans plugin is not described anywhere (I haven't found it; this page explains how to setup environment), but Netbeans is highly automated and interface is really intuitive. I didn't have any problem with it.
1. Start Netbeans. Use File | New Project menu to start process. Choose "Scala Application", then, on the following screen set the name of Project, Project Location, Main Class Name (as PackageName.ObjectName) and hit Finish. That's it! Everything is automatically created; nice folder structure is created too. There are templates for adding more classes / objects. (Note, that
Netbeans does not automatically create a project folder, as opposed to both Eclipse and IntelliJ IDEA. You don't need to do it manually.) You don't need to select application type as Java Module. You don't need to manually point to a right Scala SDK installation. Much easier to use, than Eclipse or IntelliJ IDEA.

2. Add necessary classes/objects. Save everything.

VIII. There is no need for complex setup run-time environment. It works fine right away and by default in Netbeans.

Click on a Run or Debug button and enjoy. Breakpoints are set by clicking on a gray area to the left from code.