Say I want to explore Scala web apps, and am comparing web
frameworks. The four in the subject are what I've seen first. Lift
was around for a long time and is big; others seem more compact by
comparison.
How do folks compare them for a simple project? I'd like to run it on
a cloud-hosted platform such as GAE, so interop with cloud is a plus.
But generally, what is the workflow which makes people pick
lightweight frameworks like Scalatra and especially Unfiltered versus
Lift?
Do people run Play with something other than Anorm back end, the
latter making incorrect claims against ORMs (hint: you can query
PostgreSQL about the schema ahead of time, cf. PGOcaml for example).
Specifically, what do you use to run on GAE?
Let's make it even simpler.
(a) Is there any reason to use Unfiltered for web sites other than
RESTful services?
(b) Is there any reason to delve into Lift for a simple web project to
explore Scala web apps instead of
(c) Scalatra or Play?
(d) so which is it, Scalatra or Play? (Typesafe's using Play for its
website, right?)
I'll definitely be following this thread. I can only comment on Lift, as I decided to go with the de facto standard:
1) Very poor API documentation, frustratingly so. But this seems common in open source projects. (I'm a tech writer, so I'm picky about this.) 2) 2 Free books out and one electronic one in preview, all decent, none The One True Book. 3) Lift has evolved rapidly, and has tried out and discarded many ideas--this may be one reason it's larger. For example, its method for associating functionality with (X)HTML markup is very nice, but many examples still use the earlier method, which isn't as nice. You have to be sure you're doing things the right _current_ way. 4) Lift gives you fairly sophisticated user management for free. If you need to change the way it does that, it may be difficult, or it may be easy. 5) Highly responsive and active Google group.
Just out of curiosity, I just took a look at Play and Anorm. I have to say I strongly disagree with the premise of Anorm. If you're writing SQL by hand and manually processing the results, not only are you just making more work for yourself, but you've also added an indirect level of needed testing which I suspect makes for a _lot_ of work in complex cases. Now granted, ORMs can't make sure your queries return what you want, but they do eliminate a _lot_ of errors and generally ensure that your queries are at least valid SQL.
In Lift, there are two standard ORMs, Mapper and Record. (Like I said in my first post, there's been a fair bit of experimentation to find the best way of doing things.) I would say Mapper is easier to use, and is good for relatively simple things. If you'll be doing really complex queries, you can use squeryl with Record (or on its own--you don't need to use one of the Lift ORMs). Note that the previously mentioned user management features are implemented using Mapper, so if you use squeryl, you can't declare relationships or do SQL queries between the User table and squeryl/Record tables.
With a language like Scala, I want to be working at a higher level of abstraction, and Anorm seems to be going back to a lower level of abstraction. Oh well, just my opinion.
The choice of a framework is a reflection of one's philosophy, and so questions about this choice are introspections into one's own philosophy about what a web application is, how it works, and what you expect to lose and gain from your chosen tool.
The four you've listed fall into 2 groups: full-stack (lift and play) and minimal (scalatra and unfiltered). Are you a full-stack or minimal? Decide and you are half way to your answer. If you think a framework should provide rich layers over key technologies including your protocol, data store, presentation, and state management, then you want full-stack. Such frameworks are fine, but it is incumbent upon you to have an intimate understanding of how such frameworks abstract over this infrastructure, as well as the infrastructure itself. Some will disagree with that, arguing that the very reason you want these abstractions is so you don't need this understanding. If you buy that then I wish you luck; you'll surely need it should you decide to develop a non-trivial application.
The other two, scalatra and unfiltered, are much lighter. These are similar in that they provide a syntactic abstraction for working with http, but intentionally avoid abstracting it away. Instead the embrace the protocol and keep it front and center. This naturally makes some tasks more involved (like state management), but such tools make it easier to wield http, instead of wrangle it into something it isn't. Additionally, because they're so small and so bound to the medium, they're much easier to learn.
I've worked a fair bit with lift and play in the past. I like lift's component-like architecture but found it generally obtuse. I found play much easier to get started with, and if you're a RoR-flavored MVC type, it's definitely a good choice. Both pack abstractions over http and come with ORMs, view and state management out of the box. That said, I'm not sure I would choose to use either of these simply because I'm more minimal. In my experience I've found that the bigger the framework, the bigger the chance of it getting in your way.
I work full time on a mid-sized web app built entirely with unfiltered. I've worked with unfiltered in some manner since it surfaced, and for the time being it's unlikely that I would pick something else. Why? It simply matches my philosophy about web apps, and it leverages scala's strength to wrap http. For example, instead of using string patterns that the framework parses on the fly (like scalatra), unfiltered uses partial functions to pull apart a request as a pattern match. The library has many intuitive extractors to help you pull apart requests based on content types, authentication headers, encoding types, and includes a combinatorial library for sending responses in various formats. It runs on GAE (I have two such apps deployed), standard servlet containers, and netty.
So by now my bias is clear, but I'm not really the emotional type. I arrived at unfiltered after years with many different frameworks, and after having a go with both lift and play. They are fine frameworks, but they don't match my philosophy.
> Say I want to explore Scala web apps, and am comparing web > frameworks. The four in the subject are what I've seen first. Lift > was around for a long time and is big; others seem more compact by > comparison.
> How do folks compare them for a simple project? I'd like to run it on > a cloud-hosted platform such as GAE, so interop with cloud is a plus.
> But generally, what is the workflow which makes people pick > lightweight frameworks like Scalatra and especially Unfiltered versus > Lift?
> Do people run Play with something other than Anorm back end, the > latter making incorrect claims against ORMs (hint: you can query > PostgreSQL about the schema ahead of time, cf. PGOcaml for example). > Specifically, what do you use to run on GAE?
> Let's make it even simpler.
> (a) Is there any reason to use Unfiltered for web sites other than > RESTful services? > (b) Is there any reason to delve into Lift for a simple web project to > explore Scala web apps instead of > (c) Scalatra or Play? > (d) so which is it, Scalatra or Play? (Typesafe's using Play for its > website, right?)
I think Chris' answer is a very good summary. I just wanted to mention I ported a mid-sized app from Wicket over to Scalatra and the resulting code base is much lighter and the code is far easer to understand. Also, the Java world has some great persistence API's that I'm familiar with so having a framework with persistence baked-in wasn't important for me. But if you're not up on one of those you might want a framework with persistence built in.
Got to say unfiltered looks interesting ...
The other two, scalatra and unfiltered, are much lighter. These are similar
> in that they provide a syntactic abstraction for working with http, but > intentionally avoid abstracting it away. Instead the embrace the protocol > and keep it front and center. This naturally makes some tasks more involved > (like state management), but such tools make it easier to wield http, > instead of wrangle it into something it isn't. Additionally, because they're > so small and so bound to the medium, they're much easier to learn.
My only experience with the frameworks mentioned has been some fiddling about with Play. Generally I like what I see in said framework. It dispenses with all the needlessly obtuse J2EE junk and gets you up and running quickly with a work flow that is very close to what you are used to if you've done any work recently using Ruby, Python or PHP. The simple approach to web apps endorsed by Play may not be appropriate for 100% of web applications but it is probably a better bet than J2EE for about 95% of stuff.
With regards to the Anorm component I am surprised to see so many people with negative opinions of it. As I understand it Anorm mostly just lets you query using SQL (Which is a pretty reasonable proposal if you ask me) and get back objects which are easy to work with. It's possible to do various other stuff with it, but the aforementioned feature is its key strength.
Whether or not you agree with the Anorm philosophy is just one of those things. Some people love top-heavy ORM systems and the supposed safety ropes they provide.Other people run into problem after problem after problem and just want something less long-winded. It's a matter of choice and I personally applaud Anorm for helping to provide that choice.
Overall, I like ORMs but think the programmers working with them should still have a firm grasp of SQL. Unfortunately this is not always the case :-/
On 2 September 2011 05:52, Brian Schlining <bschlin...@gmail.com> wrote:
> I think Chris' answer is a very good summary. I just wanted to mention I > ported a mid-sized app from Wicket over to Scalatra and the resulting code > base is much lighter and the code is far easer to understand. Also, the Java > world has some great persistence API's that I'm familiar with so having a > framework with persistence baked-in wasn't important for me. But if you're > not up on one of those you might want a framework with persistence built in.
> Got to say unfiltered looks interesting ...
> The other two, scalatra and unfiltered, are much lighter. These are similar >> in that they provide a syntactic abstraction for working with http, but >> intentionally avoid abstracting it away. Instead the embrace the protocol >> and keep it front and center. This naturally makes some tasks more involved >> (like state management), but such tools make it easier to wield http, >> instead of wrangle it into something it isn't. Additionally, because they're >> so small and so bound to the medium, they're much easier to learn.
On Thu, Sep 01, 2011 at 11:13:59PM -0400, Chris Lewis wrote: > The choice of a framework is a reflection of one's philosophy
Lift claims to have a lot of security built in against stuff like cross-site scripting and replay attacks [1], without the developer having to do anything special or even think about it. I haven't used any of the frameworks enough to know. Can anyone comment on this claim?
> With regards to the Anorm component I am surprised to see so many people > with negative opinions of it.
??? Did someone say something negative about Anorm? My take was that folks were pointing out other persistence frameworks that have worked successfully.
Hey, I don't see that Anorm supports database transactions. Is that really true or am I missing something? (SQL without transactions seems like a pretty significant oversight ...)
> With regards to the Anorm component I am surprised to see so many people > with negative opinions of it. As I understand it Anorm mostly just lets you > query using SQL (Which is a pretty reasonable > proposal if you ask me) and get back objects which are easy to work with. > It's possible to do various other stuff with it, but the aforementioned > feature is its key strength.
> Hey, I don't see that Anorm supports database transactions. Is that really > true or am I missing something? (SQL without transactions seems like a > pretty significant oversight ...)
>> With regards to the Anorm component I am surprised to see so many people >> with negative opinions of it. As I understand it Anorm mostly just lets you >> query using SQL (Which is a pretty reasonable >> proposal if you ask me) and get back objects which are easy to work with. >> It's possible to do various other stuff with it, but the aforementioned >> feature is its key strength.
> Whether or not you agree with the Anorm philosophy is just one of those > things. Some people love top-heavy ORM systems and the supposed safety ropes > they provide.Other people run into > problem after problem after problem and just want something less > long-winded. It's a matter of choice and I personally applaud Anorm for > helping to provide that choice.
> Overall, I like ORMs but think the programmers working with them should > still have a firm grasp of SQL. Unfortunately this is not always the case > :-/
Well that's exactly the way I would explain it. If you prefer ORMs, there are quite some choices in Scala, Anorm is about lightweight API that will allow you to do plain old JDBC nicely and doesn't assume you own your database (data lives more than applications) and assumes you want to use the full power of your database. Nevertheless, Play doesn't stop you from using ORMs.
> On 2 September 2011 05:52, Brian Schlining <bschlin...@gmail.com> wrote:
>> I think Chris' answer is a very good summary. I just wanted to mention I >> ported a mid-sized app from Wicket over to Scalatra and the resulting code >> base is much lighter and the code is far easer to understand. Also, the Java >> world has some great persistence API's that I'm familiar with so having a >> framework with persistence baked-in wasn't important for me. But if you're >> not up on one of those you might want a framework with persistence built in.
>> Got to say unfiltered looks interesting ...
>> The other two, scalatra and unfiltered, are much lighter. These are >>> similar in that they provide a syntactic abstraction for working with http, >>> but intentionally avoid abstracting it away. Instead the embrace the >>> protocol and keep it front and center. This naturally makes some tasks more >>> involved (like state management), but such tools make it easier to wield >>> http, instead of wrangle it into something it isn't. Additionally, because >>> they're so small and so bound to the medium, they're much easier to learn.
In terms of documented API, Lift's not great. However you'd really have to mod Lift up in terms of "books to read" for newcomers looking for an quick onramp to the technology:
This is an interesting thread an I would for the most part agree with "chris" on his view about web frameworks and libraries. Finding one that fits the way you work is the key to being successful. With that being said, there is indeed quite a gulf between feature sets so it is important to understand what you are trying to do.
I'm fairly amazed that no one has yet pointed out the obvious division of stateful vs stateless. All the ones you listed are specifically stateless, or at least, they do round-tripping of their state for each request either into a cookie or some other store. Lift doesn't do that and as such has a pretty different approach. One of the other commenters asked about Lift's security, and yes, it does have sophisticated security built into all the component rendering which essentially makes attacks like CSRF impossible. Thats the tip of the iceberg and there's a lot of stuff in there that people don't use or isn't widely published.
So how do you decide? First and foremost, think about what you are doing: is it a site, pure services or an application? You'll find that each of the projects you listed fits more naturally into one of these categories. For example, unfiltered is excellent for services, but sure, you could do them in Lift or Play, but unfiltered's natural fit is for services (IMHO), and it does that excellently. Conversely, Lift is great for building rich applications, but likewise, can also do services.
Clearly having written a book about Lift I am biased, but i've also used unfiltered and several others... its about strengths and weaknesses: all projects have them and you need to match those against your own approach. Many people like Play! because it has good documentation and uses a familiar MVC pattern of implementation, and whilst I can respect those who understand the approach and choose it because it fits them, it's really not an approach that fits me or my needs.
I just want to close by talking a little bit about this notion of full stack or not. IMHO, this is a complete red herring and not something that really matters. Sure things like Lift and Play come with their own persistence and other plumbing, but there is really nothing to say or require that you should use them. Within my applications i'm using lift-webkit and thats it; otherwise i'm either using ScalaQuery for RDBMS access or Salat for MongoDB. That being said, there are excellent projects like Rogue built on top of Lift's persistence systems... again, its about choice. Building your application stack is up to you, and isn't mandated by any of the frameworks you mentioned above. I personally think that is a really important thing to note, because it means that you choose the tools that work for you, from top to bottom.
Thanks, Tim
PS: Just seen some new mails come in about deployment; all of the projects you listed can be built as WAR files, so they'll deploy to pretty much any cloud hosting service. GAE comes with extra limitations around creating new threads, but that affects all toolkits. If you want cloud hosting you have cloudbees, heroku or plain ec2.
If you like Unfiltered, take a look at BlueEyes. It does a bit more than Unfiltered but has a very similar model. FWIW, I've developed apps in BlueEyes and Lift and agree with most of the statements expressed in this thread.
HTH, N.
-- Noel Welsh Untyped Ltd http://www.untyped.com/ +44 (0) 121 285 2285 i...@untyped.com UK company number 06226466
On Thu, Sep 1, 2011 at 9:21 PM, Jim McBeath <sc...@j.jimmc.org> wrote: > On Thu, Sep 01, 2011 at 11:13:59PM -0400, Chris Lewis wrote: >> The choice of a framework is a reflection of one's philosophy
> Lift claims to have a lot of security built in against stuff like > cross-site scripting and replay attacks [1], without the developer having to > do anything special or even think about it. I haven't used any of the > frameworks enough to know. Can anyone comment on this claim?
Some of the techniques (pages are treated as DOM-like objects instead of templates during processing) takes its toll on development. It is really hard learn. I don't buy the argument about leaking primary keys; it has not been a problem on any framework I've worked - It is bad developers who leak primary keys, not the framework.
If I am to buy into it, it would not be for security bad rather that it is the only framework built completely around Scala.Note that I am biased because I find Lift to be too time consuming for me to learn. I'd prefer a simpler framework like Play! In fact, I am writing a tutorial for it now!
If don't think so. For one, JDBC nicely abstracts transaction bounds; having to manually code the transaction bounds using your database's particular SQL dialect is enough of a deal breaker to NOT use Anorm. For another thing, transactions are used to do things like read a value, do some processing with that value and then update the value in the database. If Anorm, forced you to do ALL of that in straight SQL in order to use transactions, why would I bother with it? In that case it's offering me less than straight JDBC and far, far less than most other persistence frameworks.
Er...I would imagine that since Anorm involves writing actual SQL that using
> a transaction involves writing the actual SQL for said transaction...
> On 2 September 2011 07:02, Brian Schlining <bschlin...@gmail.com> wrote:
>> Hey, I don't see that Anorm supports database transactions. Is that really >> true or am I missing something? (SQL without transactions seems like a >> pretty significant oversight ...)
I'm not sure anyone is saying that Lift not "leaking primary keys" is the biggest feature in the world, IMO, the XSS, CSRF and overall security argument with Lift is far more compelling. Broadly, Lift is attempting to make it more work for the developer to do something silly and introduce vulnerabilities, whilst making the more secure route easier and the default choice.
Lift's documentation is not the best, that is true, but i've had a lot of good feedback from readers of my book who are now enjoying Lift having previously struggled with it, so maybe it's worth a second look for you. In any case, everyone has their preference and there are lots of products to choose from within the ecosystem, as myself and others have previously commented.
> Some of the techniques (pages are treated as DOM-like objects instead > of templates during processing) takes its toll on development. It is > really hard learn. I don't buy the argument about leaking primary > keys; it has not been a problem on any framework I've worked - It is > bad developers who leak primary keys, not the framework.
> If I am to buy into it, it would not be for security bad rather that > it is the only framework built completely around Scala.Note that I am > biased because I find Lift to be too time consuming for me to learn. > I'd prefer a simpler framework like Play! In fact, I am writing a > tutorial for it now!
I was just responding to Jim's question about Lift's security features. Personally I like to learn more about Lift's approach to security as well. I just wanted to start off with the information I've come across and my thoughts on it.
I understand that Lift makes security a fundamental part of the framework. That's a good thing. It's just when I read things like "Lift apps leak fewer primary keys and other information than do other apps" it smells like market speak to me. That, just a small part of Lift's features list, was something I didn't like.
Regarding "Lift in Action", I am afraid to say I haven't read it. But I have added it to my read it later list!
On Fri, Sep 2, 2011 at 12:00 PM, Timothy Perrett <tperr...@gmail.com> wrote: > Hi John, > I'm not sure anyone is saying that Lift not "leaking primary keys" is the > biggest feature in the world, IMO, the XSS, CSRF and overall security > argument with Lift is far more compelling. Broadly, Lift is attempting to > make it more work for the developer to do something silly and introduce > vulnerabilities, whilst making the more secure route easier and the default > choice. > Lift's documentation is not the best, that is true, but i've had a lot of > good feedback from readers of my book who are now enjoying Lift having > previously struggled with it, so maybe it's worth a second look for you. In > any case, everyone has their preference and there are lots of products to > choose from within the ecosystem, as myself and others have previously > commented. > Thanks, Tim
You want to use JDBC -> Api is ugly and mutable -> you wrap it into a nicer safe api -> you want to support more types -> you add typeclasses -> you get overwhelmed with parsing the same structures the same way -> you add combinators -> you get Anorm
I hope this explains better the picture.
On Fri, Sep 2, 2011 at 7:47 PM, Brian Schlining <bschlin...@gmail.com>wrote:
> If don't think so. For one, JDBC nicely abstracts transaction bounds; > having to manually code the transaction bounds using your database's > particular SQL dialect is enough of a deal breaker to NOT use Anorm. For > another thing, transactions are used to do things like read a value, do some > processing with that value and then update the value in the database. If > Anorm, forced you to do ALL of that in straight SQL in order to use > transactions, why would I bother with it? In that case it's offering me less > than straight JDBC and far, far less than most other persistence frameworks.
> Er...I would imagine that since Anorm involves writing actual SQL that >> using a transaction involves writing the actual SQL for said transaction...
>> On 2 September 2011 07:02, Brian Schlining <bschlin...@gmail.com> wrote:
>>> Hey, I don't see that Anorm supports database transactions. Is that >>> really true or am I missing something? (SQL without transactions seems like >>> a pretty significant oversight ...)
I'm using Play! and I sorta like it. It feels simple and productive to me, and I'm used to MVC frameworks. There are two things that I don't like though:
1) It's a bit bloated. Building a war archive of a "Hello world" app with the Scala plugin enabled gets you a 53 MB file! I'd love to have a way to strip stuff that I don't use like JPA-based ORM's, Anorm, Groovy, and whatnot. 2) It lags behind Scala releases. No Scala 2.9.x support yet.
By the way, Scalatra looks way cool. If I was starting my project now, I'd probably pick it.
On Fri, Sep 2, 2011 at 10:38 PM, John Cheng <johnlich...@gmail.com> wrote: > Hi Tim,
> I was just responding to Jim's question about Lift's security > features. Personally I like to learn more about Lift's approach to > security as well. I just wanted to start off with the information I've > come across and my thoughts on it.
> I understand that Lift makes security a fundamental part of the > framework. That's a good thing. It's just when I read things like > "Lift apps leak fewer primary keys and other information than do other > apps" it smells like market speak to me. That, just a small part of > Lift's features list, was something I didn't like.
> Regarding "Lift in Action", I am afraid to say I haven't read it. But > I have added it to my read it later list!
> On Fri, Sep 2, 2011 at 12:00 PM, Timothy Perrett <tperr...@gmail.com> > wrote: > > Hi John, > > I'm not sure anyone is saying that Lift not "leaking primary keys" is the > > biggest feature in the world, IMO, the XSS, CSRF and overall security > > argument with Lift is far more compelling. Broadly, Lift is attempting to > > make it more work for the developer to do something silly and introduce > > vulnerabilities, whilst making the more secure route easier and the > default > > choice. > > Lift's documentation is not the best, that is true, but i've had a lot of > > good feedback from readers of my book who are now enjoying Lift having > > previously struggled with it, so maybe it's worth a second look for you. > In > > any case, everyone has their preference and there are lots of products to > > choose from within the ecosystem, as myself and others have previously > > commented. > > Thanks, Tim
> You want to use JDBC -> Api is ugly and mutable -> you wrap it into a nicer > safe api -> you want to support more types -> you add typeclasses -> you > get overwhelmed with parsing the same structures the same way -> you add > combinators -> you get Anorm
> I hope this explains better the picture.
No, I don't think you understand my point. My question is: Does Anorm support transactions? I found some discussion about it on this thread: https://groups.google.com/forum/#!topic/play-framework/qA6GyRn_eew but it doesn't look like Anorm allows you to explicitly demarcate transaction boundaries. You can add all the syntactic sugar you want to make it a type-safe, combinator filled, 'nicer safer' api. But without transaction support, it's just a toy framework that I would not put into production.
Just to be clear, here's why transactions are important: // initialize value in a database account.currentBalance = 100.00
// Run in thread A val a0 = account.currentBalance val b0 = a0 + 100.00 account.currentBalance = b0 // commit to database
// Run in thread B val a1 = account.currentBalance val b1 = a1 - 100.00 account.currentBalance = b1 // commit to database
The prize to anyone who can tell me what the value of account.currentBalance is in the database when both threads are run *without* transactions.
With that said, it looks like the Anorm authors are at least thinking about adding transaction support. -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlin...@gmail.com
I'll admit up front I'm biased. I work on unfiltered. My bias isn't
that though. It's in picking the right tool for the right job.
ALL of the libraries mentioned above have their merits.
Lift is undoubtedly the most mature of the family of web based
software in scala. You should take note of that because that usually
means most of the bugs and kinks are worked out already. It has been
around the longest and has had the most man hours put into it. You
will most likely get the best "out of the box" experience with it if
you are writing a certain style of application. The problem with
having been around for so long, and for a while, being pretty much
your only option, is that in order for it to be a good out of the box
experience for everyone, it had to cater towards everyone's needs.
This inevitably leads to bloat and tight coupling. Most libraries
written for lift are tightly coupled together which is good if you
know you are going to be on lift forever but bad if you know in the
future you want some flexibility. Application style-wise lift is very
much like apache wicket if you are coming from the java world. It's
heavily based on server side state and components which needs to be
synchronized with client side state (views). This works for some types
of applications but as you grow you are inevitably working with a
leaky abstraction as your need to make sure clients don't ping pong
between servers that may not have the same synchronized serialized
session. My 2 cents here is that lift is rails before for rails went
rack. It's still coupling you to its ideas and libraries.
I haven't really used Play enough to speak to all of its merits but it
seems to fall under the category of good out of the box experiences.
The scala component seems very complementary to the java component so
starting with java and migrating to scala here would require the least
amount of effort. It seems to have good modularity but one thing I
noticed (I am not an expert so take this with a grain of salt) is that
it decided to create its own classloading model. I think it has since
been able to adapt to traditional java deployment containers but it
was an after through. This means that writing components of a play app
you would not easily be able to switch to another framework if you
chose to. For this reason I put it under the same category as lift
"box"es. Beware of getting boxed in. If you are cool with that this
falls under the same category as lift.
Scalatra looks nice for simple apps but falls under the category of
one of my pet peeves, it's just copying a framework from one language
and porting it to another. Every language and their mother at one
point tried to copy rails and more recently the ruby web framework
sinatra. Sintara is very attractive, sexy even, because it's almost
nothing (no out of the box orm no enforced idioms or structure). For
this reason it's also attractive to copy. I think the original impl of
scalatra ("step" then) came from a short blog post of some just doing
a simple proof of concept to learn scala. I don't think it was
originally intended to be serious but it has taken on new life since
then. While imitation _is_ a sincere form of flattery, there is a
problem with doing this in software. It's where your eyes are at.
Groovy on Grails had this problem as well. They were always looking to
copy the latest features of ruby on rails while rails was always
looking at inventing the future. This meant that grails would forever
be behind the real rails. I see people following the same path falling
into the same pit. Rather than looking towards the future they are
copying the past. I _do_ like the sinatra style of applications but if
I wanted to write a sinatra app, I'd just use sinatra :) It's still
the best implementation. Outside of that, I'm surprised no one
mentioned http://circumflex.ru/ which has almost the exact same dsl,
has been around longer, and looks to be better documented (not even
copying sinatra's documentation styles!). All of that aside, The guys
behind scalatra seem pretty keen on keeping it around so if you are a
ruby dev looking to move to scala, you may be a good first stop. It's
not going away anytime soon and neither is the hipness of Frank
himself.
I've just recently started hearing about BlueEyes which seems to
follow the same design of unfiltered in terms of how it handles
requests (partial functions). I haven't really looked that much into
it besides the readme, but promoting yourself the way it does is very
off-putting to me web 3.0? I'm guessing that means html6 (j/k) In all
fairness, it looks like right style of development to me. It's using
scala idioms which I think is very important in a scala library.
However, unlike unfiltered, it seems very tightly coupled with netty.
So if you are targeting netty this is a good thing. If you are not, it
doesn't provide much value. I predict the use of netty to be close to
the future in the realm of java/scala/jvm web libraries. It has some
pretty nice wrappings around the complexities of nio. Netty may not
web 3.0 but it is use is moving towards that direction :)
Finally there is unfiltered. Why another framework? Two things, 1)
it's actually been around for a while, almost a subculture. So there
weren't enough out there to put it in the `yet another` context at the
time. When we started writing it, there weren't many options that
suited our philosophy. We wanted something that that was simple and
just tied together a few simple concepts using idioms people are
already used to in scala programming: partial functions and
extractors. That's really about it. 2) It's not a framework! I kind of
hate that term. A framework implies that you are designing yourself
around an enclosed structure. Once you put up the walls, you're pretty
much stuck there. I'd rather say unfiltered is an http library or tool
kit or tool belt. It's just a set of libraries that you decide on how
you want to compose yourself. There is no orm, there is no expected
directory structure. You can write an executable app in one line of
code. If you wanted, there even could be no server dependency. Or if
you wanted to you could, with minimal effort, switch between server
dependencies (including netty, jetty, or if you wanted which ever
backend you want to implement). It's just a set of libraries that try
to be loosely coupled so that you can solve your problem and get out
of the way. The compromise here is not out of the box experience build
into the framework it self. Instead we encourage you to look at that
problem in a different way, much better imho. Use another library to
do the packaging for you and leave that out of the framework. That's
where the giter8 project came from. Giter8 follows the same
philosophy. Loose coupling. Is giter8 tied to unfiltered? No! It's
just a library for templatizing pretty much anything and exposing your
templates over the web.
I will admit that unfiltered's weak spot right now is really a good
traditional view templating system but I encourage you to think of
that problem in other ways too. Maybe a lot of serverside templating
isn't the best answer for your problem. Maybe you want client-side
templating. Maybe scala isn't the best tool for that. Maybe you don't
need templating at all. Maybe you just need static files. I find it
frustrating when our best solution is to look at how we handled things
in the past and how others are currently doing them. I commend lift
for it's view binding approach as this seems a bit nicer than wickets
view binding model. More recently, lift has added a nicer query
interface for manipulating views which I prefer. That may have been
inspired from the clojure library that already did that and just does
that. I really like that style.
Hopefully this all get interpreted the way I meant it, that is, with
no disrespect to anyone's hard work. Everyone of these libraries
started in someone's spare time and exist as open source for anyone to
contribute to.
There are _NO_ bad scala web libraries. Asking "which is the best?" is
just asking the wrong question.
If you are looking to use one, you may want to
1) think about the problem you are trying to solve
2) think about how you expect that solution to evolve in the future
3) be opinionated but be honest
4) know your own design philosophies and see how the tools you choose
align with those
5) have fun!
5 is probably the most important. It doesn't matter which library you
choose as long as you are having fun writing code!
> If I am to buy into it, it would not be for security bad rather that > it is the only framework built completely around Scala.Note that I am > biased because I find Lift to be too time consuming for me to learn. > I'd prefer a simpler framework like Play!
Lift is a Big framework, but it is not inherently difficult to learn; in fact, it is inherently very easy to learn enough to become quite productive. But, the API documentation is absolutely horrible (by no means an open-source shortcoming restricted to Lift), and the three books available each do some of the job of what's needed, but not of them are complete enough. So you fall back on the Lift newsgroup.
What's needed is a really short intro to what you need to know to do the 90% most common tasks in Web development, plus much better API docs. I've volunteered to one of the committers to contribute some API doc, we'll see if that flies.