Ray Zimmerman writes:
> (1) What are you using to display the nice syntax-colored Perl source 
> at http://petshop.bivio.biz/ ?

We fix up the output from perl2html with our SourceCode widget:

http://petshop.bivio.biz/src?s=Bivio::UI::HTML::Widget::SourceCode

The pod looks better when formatted as "#" comments.  (Yes, we know
there is a but with the first #.  :-)  We also add links to other
classes and views, since perl2html doesn't do this for you.

> (2) Are you using the term Facade in the same sense as in Design 
> Patterns p. 185?

No, a Facade is the front face of the web site which includes colors,
text, URLs, etc.  All the other MVC components talk to the currently
selected Facade when they need these values.

We map Facades in the front-end, e.g. petshop.bivio.biz and
www.bivio.biz are two Facades in the same server:

<VirtualHost *>
    ServerName www.bivio.biz
    <Location />
        SetHandler perl-script
        PerlHandler Bivio::Agent::HTTP::Dispatcher
    </Location>
</VirtualHost>
<VirtualHost *>
    ServerName petshop.bivio.biz
    RewriteRule ^(.*) /*petshop$1 [L,PT]
    <Location />
        SetHandler perl-script
        PerlHandler Bivio::Agent::HTTP::Dispatcher
    </Location>
</VirtualHost>

The controller calls Bivio::UI::Task->parse_uri, which strips the
"*<facade>" from the URL (if there) and sets the facade before parsing
the rest of the URL.  The default Facade is www.bivio.biz, which is
why we don't need a rewrite.

> It seems that some of it 
> is data that is used strictly by the View (colors, fonts) and other 
> parts (URL mapping) are used by the View (for generating links) and 
> Controller (for calling the View or doing a redirect).

The links are generated by the Facade component Bivio::UI::Task.
Redirects are issued by the controller or sometimes the models.  In
all cases, we identify Tasks, not URLs.  This allows the Facade to
pick its own URLs.  It means an URL can be anything, and you don't
have to have ".tt", ".asp", etc. suffixes or put then in a particular
directory, e.g. "cgi-bin" or WebObjects+Foo+Bar.  URLs are part of
your user interface, not your controller.

Typically, you might put all icons in a special directory, i.e. we use
/i/, and then have a special mapping on your front-end servers that
avoids hitting your mod_perl servers.

One comment on Perrin's statement:
> In an MVC system, you would definitely need to edit the controller any 
> time you change the input side of the user interface.  You may or may 
> not need to change the model and view as well.

We rarely change the controller except to add new function.  Query and
form values are parsed by the Models after they are translated to
key/value format by the controller.  Only when HTTP changes do we need
to change the controller.

We've also abstracted the concept of paging and drill down in our
ListModel and Table classes.  We haven't had a need to change that
abstraction for some time.  There are only so many user input patterns
you need for even the most complex applications.

Rob


Reply via email to