David,

Aren't I declaring the methods my snippet supports by including them
as public methods of the snippet itself?

I think that requiring every StatefulSnippet to also be a
DispatchSnippet is at odds with the code-by-convention and don't-
repeat-yourself principles.  If all my dispatch PF does is map each
method name to the corresponding method (as in my example), then all
I've done is re-implement the default behavior in order to satisfy the
compiler.  I would prefer that DispatchSnippet and StatefulSnippet
were unrelated, allowing the application developer to make the
dispatch vs. reflection and stateless vs. stateful choices
independently.  Is there a technical reason why this would be
impossible?

I appreciate that you might think it presumptuous of me to show up in
this group, having only a few days' experience with Lift and Scala,
and opine about the design of the framework.  Nevertheless I hope
you'll consider my point of view.  I like Lift precisely because it
isn't rigid and structured.  It's powerful but doesn't prescribe a
particular web application architecture like "every URL invokes a
controller" or "everything is a component."  Even the view-first
principle is simply the default strategy and can be changed.  That's
why the StatefulSnippets-DispatchSnippet coupling stands out for me.

W


On May 18, 10:36 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> It's better practice to use DispatchSnippets.  Snippets by convention are
> the easy toe in the water, but once you're dealing with state, etc., you
> should be graduating to declaring the methods that your snippets support,
> thus enforcing the DispatchSnippet being the base class of StatefulSnippet.
>
> On Mon, May 18, 2009 at 6:04 PM, Willis Blackburn <
>
>
>
> willis.blackb...@gmail.com> wrote:
>
> > I'm back with another question.
>
> > I see that StatefulSnippet extends DispatchSnippet.  I understand what
> > DispatchSnippet is about.  But what is the reason that a
> > StatefulSnippet must also be a DispatchSnippet?  Aren't these concepts
> > (stateful vs. stateless, dispatch vs. reflection) unrelated?
>
> > Most of the StatefulSnippet examples that I've seen look like this:
>
> > class MySnippet extends StatefulSnippet {
> >    def dispatch = {
> >        case "add" => add _
> >        case "edit" => edit _
> >        case "foo" => foo _
> >    }
> >    def add(xhtml : NodeSeq) : ...
> >    ...
> > }
>
> > The dispatch definition doesn't seem to provide much value here.
>
> > W
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to