Older blog entries for abryant (starting at number 0)

24 Aug 2003 (updated 24 Aug 2003 at 03:04 UTC) »

I ran into this in graydon's diary:

I have an ongoing thesis at the moment which I'm exploring in the programming language literature, which is that programming language features do well (all other things being equal) when they eliminate either distant or dynamic state and replace it with either close or lexical state. the underlying point being that we may favour language features that facilitate copying and modifying small bits of code -- fragments which work in their new context -- as a fundamental programming activity.

I wonder if this is a good way to explain some of the benefits of Seaside's approach to web-app session management. Because Seaside lets you describe multi-page sequences in one block of code, a lot of state that would normally have to be stored in some kind session object can simply be in local variables. For example, shopping cart checkout code can look something like this:

  |customer shippingAddress billingAddress| 
  customer := self loginCustomer.
  billingAddress := self getBillingAddress.
  [self requiresSeparateShippingAddress]
     ifTrue: [shippingAddress := self getShippingAddress]
     ifFalse: [shippingAddress := billingAddress].
  self processOrderFor: customer billTo: billingAddress shipTo: shippingAddress.

If you're unfamiliar with Smalltalk syntax, the || at the top is a set of local variable declarations.

I often talk about the fact that it's much more maintainable to have this entire flow in one chunk of code, but I don't tend to dwell on the locality of state too much. Perhaps I should.

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!