Thursday, August 11, 2005

Next Programming Model -- My 2 cents

This article is making the rounds. It suggests that what we sometimes need in the software development world isn't just more tools, but an actual shift in the way we think about programming. He suggests two shifts for the web development world, and they are both good suggestions.

If I were to suggest an idea, it might be that we focus on languages and frameworks which hide the webness of web programming. The end result being that we get back to the boring days of functions and variables and stop worrying about HTTP requests, responses, cookies, etc.

And that's exactly what a framework like SISCweb do. For example, it lets you write code like this:

(Sorry, this is only going to be interesting if you know a bit of scheme...)

  (define (get-billing-info)
    (render (use-form 'billing-info-form)
            (lambda (shipping-same-as-billing? billing-data)
                (if shipping-same-as-billing?
                    (checkout billing-data billing-data)
                    (get-shipping-info billing-info)))
            (lambda (_ _)
              (get-billing-info))))

This code defines a function which collects billing information. It says to render the billing-info-form (whatever that is) and provides two functions to invoke when the form is filled in. One function is invoked if the form is submitted properly, the other function is invoked if the form fails to validate for some reason.

In the first function, I check a variable to see if the shipping and billing address is the same. If so, call the checkout function (and pass the billing-info as both billing-info and shipping-info, afterall, they are the same, right?). Otherwise, call the get-shipping-info function. If validation fails, then we loop around and try again.

What I like about this example is that it shows that one can write a web application with the same directness that you would write any other kind of application.

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails