tag:blogger.com,1999:blog-387961763848927340.post4360636226039987653..comments2023-05-19T05:40:25.250-07:00Comments on Syntactic Sirup: The Rise of the URL Fascist RegimeKasper Jeppesenhttp://www.blogger.com/profile/17092338545068078739noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-387961763848927340.post-81786247263532837282007-02-23T16:21:00.000-08:002007-02-23T16:21:00.000-08:00I'm with Zed on this. There is a distinction betwe...I'm with Zed on this. There is a distinction between a URL (which points to a resource) and the querystring (which passes the parameters to a query). The latter are transient, the former permanent.<BR/><BR/>As to overexposing the internal structure of your application - once someone has determined which bits of your path are actually querystring, they know just as much as before. The person you are baffling is the person who has to maintain the codebase afterwards...<BR/><BR/>In addition, you have closed off the ability to use certain subdirectory names, because they are identical to pseudo-querystring 'paths'.<BR/><BR/>Overall, an acceptable idea only where there are 'permanent' querystrings.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-387961763848927340.post-59206295932952092722007-02-23T12:53:00.000-08:002007-02-23T12:53:00.000-08:00Hey, you're right, some people go ape over the loo...Hey, you're right, some people go ape over the looks of a URL and don't know why you should use a URL vs. query parameters. It's a lot like people who just follow any religion without wondering how the rituals came about.<BR/><BR/>I'll give you a very simple explanation:<BR/><BR/>The URL specifies a resource, query parameters specify a question to that resource.<BR/><BR/>Now, the definition isn't crisp but if you divide things cleanly between stuff you serve and the queries made to that stuff then you get a very logical URL scheme. It's quite a bit like designing a well normalized databse schema, algorithm, or OOP architecture.<BR/><BR/>In your example, /profile/12345 is more like saying "I stored the thing named 12345 in the profile directory." Yet, /profile?id=12345 is more like saying "to get a profile, you ask the profile for the profile with a specific id". That's why it has ? mark on it, since you're asking /profile a question.<BR/><BR/>There's also an immediate practical application: caching. It's much easier to cache URLs than query parameters. URLs have a structure that matches most databases and file systems. Query parameters don't, so when you try to cache a link with a query, you don't know if that query is destructive, modifies things, returns the same results, etc. When you cache a URL it's assumed that it doesn't modify the resouce since it was a single resource acquired via GET.<BR/><BR/>However, like all these things the rules lawyers (who don't understand why the rules exist or when they don't apply) tend to go crazy and overly apply them. Whenever I come to a fuzzy part of this arbitrary distinction, I just side with whatever is simplest. Rules lawyers seem to just apply the rule all the time to be fashionable and "fit in" with other rules lawyers. They even go so far as to invent new rules and terms like calling HTTP request "methods" "verbs" instead.<BR/><BR/>The best way to combat these kinds of idiots is to find out why they insist on these rules, and then do a subversive version that follows the rules but doesn't follow them. For example, /profile/new/12345 should make them wonder for a while.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-387961763848927340.post-30824749532972955922007-02-23T10:29:00.000-08:002007-02-23T10:29:00.000-08:00Thats not what I am against... as I write in the p...Thats not what I am against... as I write in the post, I am all for the transition to paths that point to data instead of paths that point to code. What bothers me its the way people reject any use of query parameters at all.<BR/><BR/>As long as you keep the base path of your url as a path to the data that will resolve and provide a view of the data your are fine SEO wise, but that doesn't mean you can't use query parameters for things such as view modifications.Kasper Jeppesenhttps://www.blogger.com/profile/17092338545068078739noreply@blogger.comtag:blogger.com,1999:blog-387961763848927340.post-39267392082681669272007-02-23T10:09:00.000-08:002007-02-23T10:09:00.000-08:00"pretty" urls don't over-expose the interal struct..."pretty" urls don't over-expose the interal structure of your application and are also more portable, as in you can change that internal structure however you see fit, and not have you r site die from url incompatibilities. They're also better in terms of SEO, as they look "permanent" to search engines, whereas a ?parameter=laden&var=transient url literally tells search engines that they are not permanent, or at least session dependent.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-387961763848927340.post-40691053151397468932007-02-23T09:59:00.000-08:002007-02-23T09:59:00.000-08:00You should probably learn to overcome peer pressur...You should probably learn to overcome peer pressure. It's a whole lot easier than making superfluous changes that don't matter.Anonymousnoreply@blogger.com