News for hackers. Stuff that matters.
Re:Sinatra clone in Scala by holaberlin on Sunday May 31, 2009 @11:29AM (#634736)
It looks like there is no separation between view and controller. Mixing HTML into your controller methods seems like a step backwards.
Re:Sinatra clone in Scala by wastedbrains on Sunday May 31, 2009 @02:27PM (#634937)
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.

Re:Sinatra clone in Scala by wooby on Sunday May 31, 2009 @03:33PM (#634992)
For sure. I'm just using XML literals in the example because it looks cool. But I'm also using this for a client job, and it's producing JSON.

It's not nearly as powerful as the real Sinatra, but it saves me the shenanigans of warbling Sinatra apps for servlet deployment.

Re:Sinatra clone in Scala by gcv on Sunday May 31, 2009 @02:14PM (#634924)
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.

Re:Sinatra clone in Scala by weavejester on Monday June 01, 2009 @04:53AM (#635787)
Presumably there's nothing stopping you from factoring out all that HTML into methods on a 'view' class.