Is the whole thing really just the one file (110 lines)? http://github.com/alandipert/step/blob/42cee9ecd360205def359...
I know it describes itself as "tiny", and sinatra is also tiny, but that seems... small. (I don't know anything about Scala - is it especially concise?)
I like how the HTML seems to be a first-class datatype in the example (is that a Scala thing? I'd better do some research):
Yeah it's pretty small. With Scala you basically get free HTML templating because of XML literal support. It's missing a lot of Sinatra stuff though: 'splat' and regex URI pattern matching, file uploads, sessions...
Awesome. I actually fired up Sinatra on JRuby for a micro-app that needs to talk to some Java stuff last week. All of the existing stuff in Scala was way too heavy for the purpose. (Clojure/compojure has comparable overhead to Sinatra assuming you're familiar with Clojure, but it was untenable in this particular circumstance.)
At least half the magic of Sinatra is that you can write a single Ruby script, exec it and not have to fool around with build/generate/scaffold script or web server configuration to get something useful. It seems like you're pretty close, given that Java has no standard dependency retrieval system.
Very cool. I notice that you're using sbt to build. I'm using maven to build a scala project. I'd be very interested to know how sbt compares to maven if you have experience with both build systems.
I haven't used maven (the first version of this thing used ant+ivy), but it was pretty messy compared to what I have going now. I'd say if you have the luxury of working with a Scala-only project, sbt is definitely the way to go.
If this is a port of Sinatra that is an option to make a very small concise webservice. You can choose to do seperation, but if you want something very simple and compact a single file can be easier. We have a Sinatra app that has the model,view,controller, and tests in a single file that is less than 250 LOC. It would be more obfuscated to have 5 files of less than 50 LOC each (Some with as little as 4 lines).
If it doesn't provide any option for separation that is bad, but for micro services it can be really nice.
I have barely glanced at Scala, but I assume that it has HTML templating libraries. You can then make your controller pass whatever data structure you want to the template, which then takes care of rendering the view.
Microframeworks are appealing in that way: you can pick and choose which components to use, and they let you adapt MVC to whatever fits most naturally to your application. It's hard to argue with the brevity of the underlying code and the clarity of the example.
I like how the HTML seems to be a first-class datatype in the example (is that a Scala thing? I'd better do some research):