Hacker News new | past | comments | ask | show | jobs | submit login
Seaside 3.0 released (seaside.st)
49 points by pietrofmaggi on Sept 12, 2010 | hide | past | favorite | 17 comments



I saw a demo of Seaside a few years ago where they were using continuations to write code like

   while( updateBillingInfo() != 'done' ){
       displayUpdateBillingInfo();
   }
   renderCheckoutScreen();
   ....


The point was that a method call that might present output to a user or read in a value could be an entire http render/response cycle. The 'updateBillingInfo()' method above could include arbitrary web interaction with the user. What was allowing all this was the fact that the framework was using continuations. So that when the user was finished updating the billing info the stack of the above code could be revived and resumed.

I thought it was so cool to be able to structure complex web interaction with that kind of procedural code. The closest thing I've seen at work is srping webflow but that is nowhere near as cool.

For years we have been able to inject a password prompt to a user when they request a secured resource. After the user logs in they can go to the secured page. What about something like a multipage color chooser? so that at any point in a web interaction the user can go into the color chooser sequence of screens and have the end result returned to wherever they were when it kicked off? And being able to stack these re-usable flows arbitrarily deep?

What I have seen in production is some kind of hack like a 'returnTo' http parameter that lets the other flow know where to send the user when they finish that part of the interaction. In some cases you see people attempt 2 levels by passing the parent and grandparent as a string or something like that. The thing is that there is no way I would dive into smalltalk to get features like this. For better or worse I am tied to Java on the server side.


At the end of the day, how do you implement scalable multi-threaded continuations? Yes the code has a better allure, but it's not exactly hard to add parameters to http requests.

Having used a few frameworks, I can tell you it's also easier to debug code that's closer to http requests. Being able to simply look at what's being passed in a simple way and understand everything instantaneously is a big advantage. Actually, this argument is more about the tools at hand, but there are definitively more and better tools to analyze http requests than anything else.


yea I hear you. The problem I have will passing the http parameters is that it only goes one level deep. If you want to nest it arbitrarily you would have to build up a comma separated list of values to refer to all the places you need to return to. At that point, if you think of this list of return places as a set of pointers it is as if you are implementing a stack. Having this kind of thing as a first class construct could maybe allow this to be checked by the compiler.

To be honest the details of implementing 'scalable multi-threaded continuations' is beyond my skill level.


Yes scaling continuations based web apps can be a big headache. I think this is why the Seaside developers have been scaling back continuations and making them optional in the framework: http://lists.squeakfoundation.org/pipermail/seaside/2007-Dec...

Coroutines are an interesting lighter alternative (though will still suffer from threading & session affinity issues).

See coro based libraries/frameworks influenced by Seaside like Continuity (http://continuity.tlt42.org/) & Nagare (http://www.nagare.org/) (which I think uses coros?).

Here is a fulling working Continuity example:

    use strict;
    use warnings;
    use Continuity;
    use HTML::AsSubs;

    Continuity->new->loop;

    sub main {
        my $r = shift;

        ###########################################    
        # helpers

        my $update_billing_info = sub {
            return 1 if eval { $r->param('updated') };
            return;
        };
    
        my $display_update_billing_info = sub {
            $r->print(
                form(
                    input( {type => 'checkbox', name => 'updated'}, 'updated?' ),
                    br,
                    input( {type => 'submit'} ),
                    p( "No. of tries thus far - $_[0]" ),
                )->as_HTML
            );
        };
    
        my $render_checkout_screen = sub {$r->print("Updated after $_[0] submits!")};
    
        ###########################################    
        # business logic

        my $count_tries;
        while (not $update_billing_info->()) {
            $display_update_billing_info->( $count_tries++ );
            $r->next;
        }
    
        $render_checkout_screen->( $count_tries );
    }


You should look into Lift (http://liftweb.net). It has a lot of what you describe. Here's a getting started slide deck I gave last year:

https://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz&...


Why are you tied to Java? Is there something about Smalltalk that makes you not want to learn it or are there other constraints?


Well it is the main language that I have worked in for many years now. I did some Perl early on and have done small one off projects in Python and Ruby. I really like how rock solid the jvm is and then there is always Scala and Groovy (mostly Groovy).

Another thing is that in my personal programming the server side isn't really where I hurt the most. Currently I'm more interested in client side stuff. I am learning Flex and ActionScript at the moment in order to convert some code I did in javascript/ajax to Flex.


Recently a team won the DevDerby (" were challenged to create as usable and fully functional a program as possible in only six hours")

http://www.lmcalpin.com/post/1109835129/dev-derby-2010

They did it using the Play Framework in pure Java. Incidentally the Play framework supports Scala, but this example goes on to show that Java is'nt quite out of the game yet.


Have you looked at webflows in Grails? I believe it's using spring's webflow stuff, but is more grails/groovy-oriented, which might be easier to deal with.


have you looked into lift? It takes quite a few features from seaside, among others. And scala is much better to work with than java...


I really love Seaside, and I am still as amazed by it today as the day I saw it. But I just can't justify being "isolated" inside of the Smalltalk VM. There's just too much wheel-reinventing required to build a major web app in Smalltalk. The libraries are a dealbreaker and that's really too bad, because programming in Smalltalk is amazing.


Just curious: what do you mean by 'wheel-reinventing' and 'libraries are a dealbreaker'?

Smalltalk contains a comprehensive set of classes, and Seaside has 'out-of-the-box' support for Scriptaculous and JQuery, and has numerous examples of web app components...

As for the 'isolation' within a Smalltalk VM: isn't a virtualised environment actually beneficial for scalability?


When you develop a web app in Rails and you hit a snag you can usually solve it by grabbing a Gem or a Rails plugin. Similarly, if you need to do something in Java there is most likely a good mature library out there already, and you can just drop a Jarfile in your project and go.

I'm talking about all the odd little things you end up doing in web apps, like drawing charts or parsing PDFs or talking to some obscure web service. You'd be left to solve these things on your own with Smalltalk (although solving them may be easier).


That's not really true because you can always shell out Linux and do that chunk of work in some other language. You're not trapped in Smalltalk. I've used ImageMagick and Markdown in a Seaside app without issue.


You do you feel "isolated" any more than you are in Java, Erlang, or any other VM language? Smalltalk has FFI. There are a lot of advantages for the "edit the exe while it's running" approach of the Smalltalk image.


It's not the VM, it's the platform/libraries. I don't want to deal with FFI. I want to grab a library and get on with my life.


dabbledb seems to be managing ok. Not sure if things will change now they've been acquired though




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: