ClouDE
on githubClouDE is a project I worked on for a seminar on software tools in the spring of 2014. It is a Java IDE written in Scala that runs in a web browser.
I chose to write this project in Scala because I wanted to experiment with the language. I had done a few project Euler problems, but I wanted something I could really sink my teeth into. I decided to target the browser because writting GUIs in java (or Scala for that matter) is unpleasant.
The stack I used:
-
Scalatra: Scalatra describes itself as a lightweight web framework. Coming from PHP and Python Flask, I did not find that to be the case. Nontheless, Scalatra does the job and has some nice features. Using the simplest project generator, you get code-reloading and WAR packaging for free. I also used the nice routing and JSON middleware. There are other features that I didn’t use and won’t mention; one that stands out is Swagger, which claims to fully generate a JSON api and persistence layer from a Scala class.
I did like Scalatra, but my more recent project in Scala used unfiltered which I greatly prefer. Unfiltered basically has you write a giant partial function from request to response and takes care of the rest for you. The persistence, serialization, and servlet container (if you chooose to use one), etc., is totally up to you.
-
SBT (simple build tool): SBT is the most complicated development tool of it’s kind that I’ve ever used. Every Scala programmer that I’ve talked to has a few complaints about it. But for all of its warts, it does a lot of things:
- automatic compiling
- automatic testing (with integration with most of the big Java/Scala testing frameworks.
- WAR packaging a reloading (with the xsbt-war plugin)
- Lets you choose what Scala runtime/compiler you use.
- Dependency management
All in all, I was very happy to be using SBT once it was set up.
-
Java reflection api: for compiling and running arbitrary code, it was either this or interacting directly with the operating system. A stipulation of the assignment was that I not go the operating system route. I adapted some code from a the java documentation to Scala. Code that uses reflection is usually hairy, but I will say that the Scala API is less verbose than its Java counterpart.
-
Angular.js: Angular has become my default choice for web applications. It works very well.
After five weeks of work (while doing other coursework) I was able to edit, compile, and run code from my browser.
This is obviously an experiment and not suited to any real use, but it was a fun way to get familiar with web development in Scala.