[Seaside] Better protocol conformity

Nevin Pratt nevin@smalltalkpro.com
Wed, 24 Apr 2002 12:01:54 -0600


Tim Rowledge wrote:

>Nevin Pratt <nevin@smalltalkpro.com> is claimed by the authorities to have written:
>
>
>>For example, let's say your code wants to read the host from the 
>>request.  You can get the host from an HttpRequest via
>>
>>     request header at: 'host'
>>
>>However, to do the same with an "IARequest" instance, you do this:
>>
>>     request headerAt: 'host'
>>           or possibly this...
>>     request headers at: 'host'
>>
>I don't have any opinion on making HttpRequest & IARequest closer, but
>I'll certainly proclaim that #headerAt: is better than 'header at:'
>since it hides the implemetnation of how the header stuff is done. I
>really, really dislike seeing chains of trivial accessor messages - it's
>nothing more than a poor way of expressing foo.bar.blather C-like
>nonsense.
>
>Use request hostHeader, implemented as headerAt: #host', in turn
>implemented as headers at: name. It makes it much easier to refactor
>later, and you know you're going to need to refactor later; unless
>of course the last customer is dead.
>
>tim
>

Yes.  That's essentially what HttpRequest does.  It implements #host, 
which in turn is implemented as #propertyAt:, and if there is no such 
property, does 'self header at: '.

I'm inclined to recommend that #host be added to IARequest in a similar 
manner, and possibly also #contentLength, #contentType, and #referer.

But like I just mentioned (my last response), I'm going to refrain from 
making any specific recommendations for awhile longer.  Perhaps I can 
get by just fine just the way it is now.

Nevin