[Catalyst] [OT] ASP.NET MVC

John Napiorkowski jjn1056 at yahoo.com
Tue Dec 11 15:59:48 GMT 2007


--- "Christopher H. Laco" <claco at chrislaco.com> wrote:

> Dear MS: Welcome to the party.
>
http://www.hanselman.com/blog/ASPNET35ExtensionsPlusMVCHowToScreencast.aspx
> 
> Interesting to see another take on MVC inside some
> bastion of ASP.NET.
> 
> -=Chris
>

Looks like they are using a routing system to connect
up the different pieces.  This seems to be the most
common way I've seen for mapping URIs to controllers,
Catalyst being the exception.  Catalyst's system does
allow additional levels of control and granularity,
since the Controller is namespaced and can inherit
functionality, while the actions it includes are also
namespaced and can inherit, via ActionClasses. 
However I have found that it's a potential point of
confusion for some new developers.  For example I have
been asked what's the best way to map the following
url:

/person/{personID}/posts/{postID}

There are a couple of ways, some of them not so good. 
For example you can create a 'Person' controller and
then use the regex action attribute, which is still
around but is sorta considered deprecated in favor of
chaining, which is probably better for the above
(since it's lets you more easily reuse info at the
chain base).

And with chaining you could create all the chained
actions in a single class, or use the Chain(.) feature
to spread this over a couple of controllers.  That's
what I usually do, but then you sometimes end up with
a mess of nearly empty controller classes.

Then we also have :Local, which is also considered
somewhat deprecated in favor of :Path, :Default which
is recommended only for things like capturing bad URLs
and directing to a not found page (or if you are
clever, so sort of soundex or spelling correction to
see if that would match a known url)

Another potential disadvantage of this, besides the
confusion, is that you end up which a Controller
namespace generally having to map to your URI
namespace, and if you need to change the URI namespace
you end up renaming and moving controllers, around.

What do the rest of you think?  What could be better
or more clear in terms of best practices?  Because I
think this is a place where a lot of newbies get lost,
and compared to the 'there's only a single way to do
it' method of using router classes, we can lose out. 
I know of at least two developers that gave up on
Catalyst for this reason.  Maybe we can start a list
of common URI namespaces and recommended ways to
handle it?  Or is it time to start warning on some of
the older action attributes, like :Local, etc., in
order to reduce the number of choices a bit and make
things more clear.

Also if we could work up an example that showed the
benefit of the Catalyst way that would also help us. 
Thoughts?

--john



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



More information about the Catalyst mailing list