[Catalyst] mapping application flow into a MVC framework (long)

Lance Braswell ltbraswell at yahoo.com
Mon Jul 11 17:42:27 CEST 2005


Thanks to everyone who has given Catalyst to us. I'm
pretty new to MVC frameworks as I suspect a lot of
Catalyst users might be.

In my application I have what amounts to a tree of
relationships that I would like users to be able to
navigate.

Customers have Servers.
Servers have Tasks.
Tasks have HTMLForms.

User logs in and sees a list of customers. Clicks on a
customer and sees a list of servers. Clicks on a
server and sees a list of tasks, etc.

My MyApp::C controllers look like this:

MyApp::C::Customer
MyApp::C::Server
MyApp::C::Task

So everything relating to each class is in what I
think is the right controller:

/customer/view/X -> show detail for customer X
/customer/listservers/X -> show servers for customer X

/server/view/Y -> show detail for server Y
/server/listtasks/Y -> show tasks for server Y

I can get all this going with Catalyst based on the
fine examples out there but I'm stuck on the
navigation. I want to be able to provide something
like breadcrumbs at the top to navigate around the
tree. But at each point of the user's location in the
tree, the breadcrumbs have a different points of
reference. For example using TT and CDBI, to get
access to the current customer's name I need to have
three different breadcrumb.tt templates with each one
being relative to where I am in the tree. Namely to
get to the customer name in the templates I would need
to use variously customer.name, server.customer.name,
and task.server.customer.name. I'm not sure if the is
the correct way to handle it because it seems like I
should be able to abstract the breadcrumbs out of the
whole process and have a single  breadcrumbs template
but then, presumably, the control logic of what to
output is in the template itself. This doesn't seem
right either.

All of the above has started to make me question
whether my Controller classes are even right. Maybe
they are too closely tied to the Model and I've
misunderstood what controllers should be used for.

A more general observation is that a web app is a
series of states. What gets output depends on what
state you are in. Or, perhaps, pieces of the view of a
web app are dependent on what context that piece of
the view is in. For example I might want to view a
list of servers in the context of belonging to a
specific customer. Or I might to view a list of
servers in the context of having searched for servers
in a certain location. The common thing here is
listing servers but which servers are listed depends
on how I got there. I'm not sure how to handle this
flow in a MVC way.

Sorry for this long and rambling posting. I was just
hoping that someone out there might be able to point
me in the direction of mapping web application flow
into a MVC framework.

regards,
Lance Braswell


		
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/



More information about the Catalyst mailing list