Search code examples
url-routing

When to set up URL re-writing / routing?


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?


Solution

  • 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.