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) > > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
