Reputation: 66455
Do you prefer...
1- Write the whole application, then set up routing/url rewriting
2- Set up routing as you go
3- Write most of the application, set up routing then maintain the routing
4- Set up the routing then write the application
5- Write the main routes first, then maintain them as development goes
I see advantages / drawbacks in all of these approach. I tend to write a big part of the application and then set up routing once I'm sure that the structure will not evolve and I really know what will happen next, feature wise.
Since I try to be as agile as possible it's hard to have all the features when I start, so (4) is not really possible.
What do you usually do? What's the general best practice?
Upvotes: 0
Views: 145
Reputation: 89222
Without routing, how do you link from page to page? I find that I need routing to get anything going at all. I tend to think a little up front about what my resources are that will be the basis of urls -- but after that little bit, I do routing right before I implement the feature (route -> view -> template -> enough model to support the view).
I work in Django, BTW.
Upvotes: 1
Reputation: 63126
I personally would start with it early on, as adding it in later is a bit problematic, as you don't want to have to change any of your links on actual pages from myPage.aspx?mykey=myvalue to /mykey/myvalue/myPage.aspx, as it isn't an automatic or easy process.
Additionally re-writing/routing is something that if done later, would require a full regression run of a site, just to validate that you did catch all of those examples. Therefore doing it as you go, will keep it much more simple.
Upvotes: 2
Reputation: 57907
In the apps I've developed in ASP.NET MVC, I've set up routing after I've implemented the section of code that it deals with.
The reason for this is once I see how the query strings deal with the GET
, I can see what and how I'd like to rewrite (or route) the URL.
Upvotes: 1