From: Julian Fitzell Date: 2004-05-08T16:35:06+09:00 Subject: Re: What is Borges? Carl Youngblood wrote: > >> http://my.site.com/reprice.rb?item=8789 >> http://my.site.com/reprice.rb?item=8790 >> >> There are two types of state here: The logic information keyed to a >> cookie, and the item information keyed in the URL. Is this the sort of >> thing that could be done in Borges? > > That is what I have seen usually done. Borges doesn't use meaningful values for parameters in URLs. All the GET/POST parameters are unique keys which tell the system which link to click on, etc. Every link, every button, and every form field has an associated callback block which, in the case of a button or link is executed or in the case of a field is passed the new value for the field. You never need to think about marshalling the state out as a string in the URL. If you iterate over a list of objects and print out an anchor for each, the object will get captured in the context of the callback block and you'll have it to work with when the block is executed. But see below... >> From seeing the presentation at RubyConf last year it seemed very >> impressive to me, but at the same time I had reservations because it >> seemed like URLs that are so dependent on state would heavily resist >> bookmarking ... are those reservations fair? Bookmarking is an issue with Seaside/Borges just as it would be with, say, Microsoft Word. But again, it just comes down to defining your desired semantics. What does it mean if I create a bookmark while in the find and replace dialog with foo.doc open and "bar" typed in the find field? If I go back to that bookmark do I expect to be in the same place? with the same file open? with the field filled in? What does the user expect a bookmark to be when they're in the middle of buying the items in their Amazon cart? > That's what I've been told. Supposedly Borges is for application > development so users shouldn't be bookmarking URLs, since they reflect a > particular state of the program and not a place where content is It's not that the user *shouldn't* be bookmarking. It's just that the semantics aren't necessarily clear. But you're right that Seaside/Borges are primarily designed for web /application/ development. It makes many of the problems like complex session state and program flow simple but the tradeoffs may not be worth it for all projects. Pick the right tool for each job... > located. I disagree with this compartmentalization, since I can > envision plenty of content-based web sites that use authentication. I'm not sure I understand the significance you attribute to authentication here. The way Seaside handles bookmarking in general (not sure if Borges implements this) is that you can add URL segments for your own use. So, by default it might generate a URL that looks like: /seaside/myapp/@fovoYawazbbotlBU/CvKjJaGf but you can, based on the section you're currently in, ask it to make a URL like this instead: /seaside/myapp/browse/8789/@fovoYawazbbotlBU/CvKjJaGf If the session key and page key can be found, the user will go back to exactly the same place in their session. If they cannot, you are given a chance to select a default entry point. You can then use /browse/8789/ to figure out that they were on a browse page looking at item 8789. It just comes down to figuring out the semantics you want (same as with the back button). Heck, if you have enough disk space, you can write all the sessions out to disk so if the user ever comes back with a bookmark, they'll actually end up exactly where they left off. Let's see Word try that... ;) Julian