My Querystring Argument Neurosis

By Deane Barker

I get irrationally stressed out about querystring arguments. Here’s why.

I have a serious web development neurosis: I hate querystring arguments. You know the garbage after the page name in a URL? Like this: page.php?thisArgument=thisValue&andThisArgument=thisValue I hate them. I think they’re ugly, unwieldy, and expose too much of your application to the world. This is…

The author expresses a strong dislike for querystring arguments in web development, finding them unattractive and unwieldy. They note that many apps now run all requests through a single page, parsing the URL themselves, and using techniques like a RewriteRule, an aliasmatch rule, and the AcceptPathInfo directive. The author also mentions their preference for the colon-shard syntax over the &'s and ='s in traditional querystring arguments.

Generated by Azure AI on June 24, 2024

I have a serious web development neurosis: I hate querystring arguments. You know the garbage after the page name in a URL? Like this:

page.php?thisArgument=thisValue&andThisArgument=thisValue

I hate them. I think they’re ugly, unwieldy, and expose too much of your application to the world. This is an utterly irrational thing, I know, because querystring arguments work perfectly well. I just need to get over myself.

But is the querystring argument falling out of fashion? A lot of apps now run all requests through a single page, and they grab and parse the URL themselves. For instance:

/products/hunting_gear/1

This would show page 1 of products in the hunting gear category. There is no “products” or “hunting_gear” folder or file named simply “1.” Instead, this URL is mapped to an actual block of code. You can do this with a RewriteRule pretty easily (you could do it with a PHP auto-prepend file too).

In my PHP apps, I use an AliasMatch rule to route everything to a single page and I have a mapper like this:

/product/[0-9]+/edit = edit_product.php

This uses a regular expression to map a URL pattern to a file. If the first “directory” is “product,” the second is a number of some kind, and the third is “edit,” then send them to the page to edit a product. That page will grab the number out of the URL and use it to load an object.

J2EE does this too, to map URL strings to servlets. I have no doubt that .NET has the same functionality in there somewhere. I think Rails does this too, from what Joe tells me.

Using the AcceptPathInfo directive for Apache, you can do things like this:

index.php/this/is/some/extra/info

But that just looks sloppy to me. I don’t know why. eZ publish does this by default, and it bugs me to no end.

Finally, today I found this, and it’s what prompted me to write this little diatribe:

/messages.cfm/forumid:4/threadid:39092

So they’re using AcceptPathInfo, but each “directory stop” along the way is a key-value pair. I like this. It speaks to the aesthetic in me, or to the neurotic, depending on how you look at it.

This last example perhaps proves that it’s just the syntax I don’t like – all those &'s and ='s floating around are like fingernails on a blackboard to me. This example is key-value just like traditional querystring arguments, so the function is the same, just the syntax is different. The colon-slash syntax just looks cleaner to me.

Am I the only one with this problem? Does anyone else hate querystring arguments as much as me?

This is item #294 in a sequence of 357 items.

You can use your left/right arrow keys to navigate