Alex, If you don't like this design, then you will not like Lift. I have been doing web development since 1995 and building web frameworks since 1996. I have seen a lot of different approaches to web frameworks and the two web frameworks that have the best approach are WebObjects and Seaside. The worst approaches are Rails and the "share nothing" ilk. Lift borrows from Seaside and WebObject. Lift seeks to abstract away the HTTP request/response cycle. State is maintained on the app server, not pawned off to some other place. This leads to better scalability characteristics. The developer deals with higher level abstractions than dissecting the HTTP request and reconstituting state.
Benefits: - Higher levels of developer productivity - Fewer defects - Much more secure sites (try doing a replay attack or parameter tampering on a Lift app) - More scalable sites (there's no single point of "state") So, in my experience and to my mind, the "tenet" of minimizing server-side state is broken and wrong. State should placed where it is (1) most secure and (2) leads to the most responsive apps. Thanks, David PS -- The reason that everybody hits a wall with moderate volume Rails apps is that the fantasy of stateless stacks devolve into a pile of dog poop when actually tested against the amazingly fragile run-time that is Ruby. On Tue, Mar 24, 2009 at 9:53 AM, Alex <[email protected]> wrote: > > Perhaps this debate has been had before but I didn't see it. I have a > feeling this might be contentious. > > Doesn't this violate the basic tenet that you should not use server > side state when you don't have to? There is no reason for instance > when someone is submitting a news group posting to bind an empty > posting in a closure and store it on the server, thereby breaking the > application in any number of cases: > > 1) The session times out because the user got distracted or lost their > connection temporarily > 2) The user abuses the back button > 3) The server fails over (assuming there is no memory replication) > 4) There is a temporary connection failure and the user reloads > 5) The server is restarted > > All of the above cases are recoverable with what, IMO, are properly > designed frameworks that minimize server-side state. Those are the > things that taught us state should be stored in the client whenever > possible. > > I saw a bit of a discussion distinguishing REST from human > interaction, saying human interactions are not stateless, but that > does not excuse the application being so vulnerable to breakage. > > This reminds me of why I dislike many ASP applications I've used - > they always break when users don't behave well or when some kicks a > server - and users, myself included, always misbehave. I use the back > button when I shouldn't, I leave forms half filled out when I answer > the phone, and as a frequent traveler I tend to use web applications > from places with shoddy internet. I also don't like to lose my work > when a server fails over or is restarted. > > There may be a few gains from designing things the lift way - > simplicity, security, etc - but they seem to come at too great a cost. > > There maybe some solutions to this, such as serialization of this data > to the client, but I'm not sure I like any of them. > > -Alex > > > On Mar 24, 2:46 am, "marius d." <[email protected]> wrote: > > The foo reference is captured in checkAndSave which is saved on > > LiftSession in function mapping. > > > > Br's, > > Marius > > > > On Mar 24, 10:23 am, Alex <[email protected]> wrote: > > > > > If I have this in a (not Stateful) Snippet, is the checkAndSave > > > closure saving state on the server? Where is the reference to foo > > > saved? > > > > > def add(form: NodeSeq) : NodeSeq = { > > > val foo = Foo.create > > > def checkAndSave(): Unit = foo.validate match { > > > case Nil => foo.save ; S.notice("Started foo: " + foo.body) > > > case xs => S.error(xs) ; S.mapSnippet("Foo.add", doBind) > > > } > > > def doBind(form: NodeSeq) = > > > bind("foo", form, > > > "body" -> foo.body.toForm, > > > "submit" -> submit("Submit", checkAndSave)) > > > > > doBind(form) > > > } > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
