Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala web microframeworks

Tags:

I'm looking for a Scala web framework that has some of the following properties.

  • Modularity, in case (say) I don't want to use the particular templating language or the DB interface that the framework defaults to.
  • Avoid "magic" or yucky design decisions (with general preference for Unfiltered's functional style) - things like thread-local request/response objects, reflection (cf. Bowler's function-name-convention), etc.
  • DB interfaces. Any that support the same degree of flexibility as SQLAlchemy (both ORM and SQL support with smooth interop and escape hatches)?
  • Templating/view languages. Pretty flexible here, though I am interested in component-based approaches.
  • Performance, scalability (Comet support).

What is the best Scala web microframework that fits the bill? Some frameworks I've been looking at:

  • Scalatra
  • Bowler (builds on Scalatra)
  • Play (the Scala interface)
  • Circumflex
  • Unfiltered (minimal HTTP request handling, no DB interface/templating language)

But without spending time playing with all of these, it's hard to tell what to use.

like image 669
Yang Avatar asked Jul 08 '11 20:07

Yang


People also ask

What is Scala web framework?

Scalatra is a simple, accessible and free web micro-framework. It combines the power of the JVM with the beauty and brevity of Scala, helping you quickly build high-performance web sites and APIs.

Is Play framework still used?

Play is rock-solid and used by hundreds of thousands of Java and Scala developers every month. Play is still extremely relevant to today's application and web development and has a passionate and very capable community around it ensuring that it has many good years left.

Can I use Scala for Web development?

Scala has an exact syntax, eliminating boilerplate code. Programs written in Scala require less code than similar programs written in Java. It is both an object-oriented language and a functional language. This combination makes Scala the right choice for web development.


2 Answers

Bowler is pretty much Scalatra + Scalate, with some enforcing/nudging of the developer towards good RESTful practices, such as proper use of Content-Type and Accept HTTP Headers for responding and emitting HTML and JSON and dealing with GET, POST, DELETE and PUT in appropriate ways (and making bad uses of GET and DELETE harder).

If you are curious about component oriented UI's, Bowler does support Scalate's Scuery style, which combined with Bowler gives a very composable UI style heavily influenced by Apache Wicket.

In terms of front-end vs. serverside, Bowler takes quite a strong view that client-side code (JavaScript/CSS) is client-side code, and serverside code is serverside. No nasty "integration" of JavaScript with serverside Scala code, instead you should use best-of-breed on client and server, integrated through a common, well-understood format such as JSON.

like image 163
wfaler Avatar answered Sep 25 '22 13:09

wfaler


Not sure it qualifies as a "microframework", but I like Lift. I haven't really looked at the others you suggest, but here are some comments on Lift:

  • It's big, but you can pick and choose what parts you want to use
    • I've never bothered with large portions of it: e.g. DB interface(s), magic forms, Screens, Wizards, ...
  • The designer-friendly views/templates are really nice
  • I like the way rewrite rules are done
  • Performance is extremely good in my experience
  • Box is great
  • Big, helpful community

Lift does have Request- and Session-scoped variables. I like them, but they might fall into your description of "yucky" design.

It also includes a comet implementation that is supposed to be very good, though I haven't used it myself.

Work-in-progress book and docs here.

like image 31
overthink Avatar answered Sep 22 '22 13:09

overthink