Re: URI Templates - optional variables?

On Oct 16, 2007, at 3:11 PM, DeWitt Clinton wrote:

> To jump in for a second (agreeing with at least half the people on  
> this thread):
>
> One of the big wins I think we got with the OpenSearch URL  
> templates was their readability, and write-ability, for humans  
> without tools.
>
> Consider this:
>
>   http://example.com/search?q={searchTerms}&num={count}
>
> Quick -- tell me what that template describes.  I bet you can.  And  
> I bet you could create one by hand.
>
> Granted Joe's proposed URL template specification is far more  
> general in its expressiveness.  But it is also already starting to  
> feel overly complex.  If it gets even more complex I'm afraid we'll  
> have lost most of the audience of real people who build the bulk of  
> the world's web applications.

I don't get it.  Here is your template

    http://example.com/search?q={searchTerms}&num={count}

and here is the same template in Joe's syntax

    http://example.com/search?q={searchTerms}&num={count}

Note that they are identical.  Most likely, however, the template is
wrong because the service also accepts

    http://example.com/search?q={searchTerms}
    http://example.com/search?num={count}
    http://example.com/search?

so the only template that is really going to describe your
service is (in Joe's syntax)

    http://example.com/search?{,&|q,num}

which is only less readable because the choice of parameter
names isn't readable.  If it instead said

    http://example.com/search?{,&|query,max_results}

then I argue that is, in fact, both more readable and more
accurate than the original template you gave above, in addition
to being shorter.  YMMV.

In any case, you can continue using your simpler template even
if the standard allows more complex forms to those who want them.

....Roy

Received on Tuesday, 16 October 2007 23:48:19 UTC