Hi,
I haven't read anywhere that : Local is deprecated, and I use it very often.
Why is it deprecated? I found it works very well, and it is the most simple
solution.
I was also curious about chaining, but I couldn't find a tutorial that
explains in which cases I could need to use chaining, and how to use it.
I think that it could be helpful to have a POD document that lists all the
types of mapping an URL to a method, and explain:
- for which cases can the current type be used;
- if the current type is the recommended, or best considered way for a
certain case;
- which could be the disadvantages of the current explained type;
- explain how to use the current type, and how to get the PATH_INFO
parameters.
By the word "case" I understand the different types of URLS that could be
used, for example:
/bla/blu/bli
/bla=1/blu=2/bli=3
/bla/1/blu/2/bli/3
...
Octavian
----- Original Message -----
From: "John Napiorkowski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "The elegant MVC web framework"
<[email protected]>
Sent: Tuesday, December 11, 2007 5:59 PM
Subject: Re: [Catalyst] [OT] ASP.NET MVC
--- "Christopher H. Laco" <[EMAIL PROTECTED]> 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
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/