Oh, and also there is code in ActionController to pull the params out
of the request object and into the controller, which is why you can do
params[:value] in the controller.
They’re usually created with XML, but I think this still qualifies.
It’s taking an established standard and extending its functionality
through convention.
Not by any definition of that term that I’m familiar with. It’s just a
hash.
(For reference, the term “microformat” has only one meaning – see Microformat - Wikipedia – and that wasn’t it. Using
standard terminology helps to reduce misunderstandings.)
They’re usually created with XML, but I think this still qualifies.
It’s taking an established standard and extending its functionality
through convention.
…which is not what Rails is doing here. No similarity IMHO.
is there a better term for what this is?
Isn’t it just a fairly standard use of Ruby hashes?
The parameter is a String, which is parsed into a Hash by way of a
convention.
There is no convention, really – it’s too trivial to call it that. The
HTTP parameters are already a list of name-value pairs, which is exactly
what a hash is.
That convention is what I’m referring to as a microformat.
Then you’re using the term idiosyncratically at best and inaccurately at
worst.
I welcome an alternative term if that would be less confusing, but the
fact is this convention exists and it’s not a part of any
specification.
I chose microformat as a description because it’s a conventional
extension of an existing standard, HTTP parameters, to carry extra
information e.g. nesting relationships. This is exactly the sort of
thing microformats do with XHTML. So what if we’re embedding semantics
into a key/value string rather than XML? To me that’s just an
implementation detail.
So I’m curious where this convention came from, and what precisely are
the rules involved? Is there documentation for it?
I welcome an alternative term if that would be less confusing, but the
fact is this convention exists and it’s not a part of any
specification.
What convention? What do you think goes beyond the HTTP spec here?
I chose microformat as a description because it’s a conventional
extension of an existing standard, HTTP parameters, to carry extra
information e.g. nesting relationships. This is exactly the sort of
thing microformats do with XHTML. So what if we’re embedding semantics
into a key/value string rather than XML? To me that’s just an
implementation detail.
Maybe, but the word “microformat” only refers to specific ways of
abusing HTML/XML markup to add semantics. That’s not an “implementation
detail” – it’s a completely separate part of the problem domain.
Anyway, the HTML microformat technique is not even remotely related to
what we’re doing here. We are not “embedding semantics into a key/value
string”. You’re overthinking here – it really is just the parameters
as passed from the HTTP request. That’s all there is to it, I think.
If you don’t think that explains everything, please state what you don’t
understand and I’ll try to help.
So I’m curious where this convention came from, and what precisely are
the rules involved? Is there documentation for it?
What part don’t you understand? What do you think needs to be
documented? What are you really trying to find out here?
I think I can see what the OP is getting at here, and do have some
sympathy with his point of view. The rails convention is that, for
example, an input field with the name
person[address][street_address]
is used to indicate that a hash of the form
{ :person => { :address => { :street_address => “” } } }
should be posted and can hence be used by the controller to build the
appropriate data. That is not part of the HTTP spec,
I suppose it isn’t. But it’s such a trivial extension that it hardly
bears a second glance. (I seem to recall that PHP does the same thing.)
it is an
overlying convention using field names to indicate the type and
structure of the data.
In a sense, that’s always what field names do.
In that sense it is akin to the microformat
concept.
That I do not agree with at all. I’m trying to see the similarity, and
– past the most trivial level – I do not.
On 25 August 2010 13:00, Marnen Laibow-Koser [email protected]
wrote:
That I do not agree with at all. Â I’m trying to see the similarity, and
– past the most trivial level – I do not.
From http://en.wikipedia.org/wiki/Microformat:
‘A microformat (sometimes abbreviated μF) is a web-based approach to
semantic markup which seeks to re-use existing HTML/XHTML tags to
convey metadata[1] and other attributes in web pages and other
contexts that support (X)HTML, such as RSS.’
From http://en.wikipedia.org/wiki/Semantic:
‘Semantics is the study of meaning. It typically focuses on the
relation between signifiers, such as words, phrases, signs and
symbols, and what they stand for.’
So I interpret ‘semantic markup’ to be markup that indicates in some
sense the meaning of the data.
From http://en.wikipedia.org/wiki/Metadata:
‘Metadata is loosely defined as data about data. Metadata is a concept
that applies mainly to electronically archived or presented data and
is used to describe the a) definition, b) structure and c)
administration of data files with all contents in context to ease the
use of the captured and archived data for further use.’
So the example where a field name of person[address][street_address]
indicates that field content is the street address part of an address
for a person seems to me could arguably fall into the definition of
microformat as it is markup that provides some information about both
the meaning and the structure of the data.
Using “person[address][street_address]” to denote a nested Hash
structure is semantic, and it is not part of the spec. you might think
it trivial, but not all frameworks behave in this way. So it is useful
to note that this convention exists and explain its rules. Agreed?
That’s all I’m asking after here.
I’m sorry if my choice of the word “microformat” offends you so badly
in this context, but then you have yet to offer an alternative. And
other people on this list have understood what I meant. So maybe it’s
not worth arguing about.
On 25 August 2010 05:16, Marnen Laibow-Koser [email protected]
wrote:
Adam Lassek wrote:
I welcome an alternative term if that would be less confusing, but the
fact is this convention exists and it’s not a part of any
specification.
What convention? What do you think goes beyond the HTTP spec here?
I think I can see what the OP is getting at here, and do have some
sympathy with his point of view. The rails convention is that, for
example, an input field with the name
person[address][street_address]
is used to indicate that a hash of the form
{ :person => { :address => { :street_address => “” } } }
should be posted and can hence be used by the controller to build the
appropriate data. That is not part of the HTTP spec, it is an
overlying convention using field names to indicate the type and
structure of the data. In that sense it is akin to the microformat
concept.
Using “person[address][street_address]” to denote a nested Hash
structure is semantic,
In what respect? It’s abusing a particular form of HTTP parameter name,
true, but that’s about it.
Rails’ reservation of HTTP parameter names “controller” and “action”
might be considered semantic, but I don’t think the brackets are.
and it is not part of the spec. you might think
it trivial, but not all frameworks behave in this way. So it is useful
to note that this convention exists and explain its rules. Agreed?
That’s all I’m asking after here.
Very simple. The brackets act like hash subscripts. Hashes are
constructed so to make this possible. That’s all there is to it AFAIK.
I’m sorry if my choice of the word “microformat” offends you so badly
in this context,
It doesn’t offend me – it’s just inaccurate.
but then you have yet to offer an alternative.
I don’t think there is a useful word other than “mapping” or something
like that.
And
other people on this list have understood what I meant. So maybe it’s
not worth arguing about.