Re: [AS2] Deprecate "url" in favor of "id" and "self" link relations

> James M Snell <mailto:jasnell@gmail.com>
> 21 August 2014 21:36
> On Thu, Aug 21, 2014 at 1:15 PM, Owen Shepherd<owen.shepherd@e43.eu>  wrote:
> [snip]
>>> Can you please give some concrete examples? I'll see if I can explain
>>> the rationale for the changes using those examples.
>>>
>> I hope you will understand if I say this will take a bit of extra time to
>> put together. I'll try to do so soonish :-)
>>
>
> +1
>
>> One simple example, a video object in AS1 looks like
>>
>>   {
>>      "objectType": "video",
>>      "displayName": "Cute little kittens",
>>      "embedCode": "<video width='320' height='240'
>> controls='controls'>...</video>",
>>      "stream": {
>>        "url": "http://example.org/my_video.mpg"
>>      },
>>      "image": { "url": "http://example.com/my_video.mpg.jpg"},
>> }
>>
>>
>>
>> Per your AS2 examples, this image would go from being a Media Link to an
>> Object. Therefore, it would "decompose" into a separate object, and would
>> require fetching from the database by processors.
>
> How I would represent this in AS2 would be:
>
> {
>    "objectType": "video",
>    "displayName": "Cute little kittens",
>    "content": "<video width='320' height='240'>  controls='controls'>...</video>",
>    "id": "http://example.org/my_video.mpg",
>    "image": "http://example.com/my_video.jpg"
> }
>
> "image" is defined as a Link Value, which means it can be either an
> IRI or an Object. The object form is only required if you wish to
> define additional properties about the referenced resource.

How do I find the video link when its' not the post's ID? What about if 
I want to publish multiple alternate versions of the video (analogous to 
HTML5's <source> element)?

How do I know this IRI corresponds to the actual media, and not an 
object I have to dereference to find the actual media?

Removing the media link from the spec may make the specification 
simpler, but it seems to make using it a hell of a lot harder.

Aside: Why is there a video element in the content? This is certainly 
different from AS1, where content corresponds to just the 
"textual"/"html" content (for a video, it would be "the description", 
for example).
>> This object is not meaningful. It has no purpose on it's own, and no
>> identifier. In other words, it is pointless it being an object; hence why I
>> like the distinction between media links and objects, because they avoid
>> such meaningless objects.
>
> Unless you're specifying additional properties for the linked
> resource, it shouldn't need to be expressed as a JSON object at all
> (as in my example above).
>
> - James
>
Quite often (for purposes of speeding up page layout, for example), it 
is preferable to include information like the image's width and height 
(thereby allowing the browser to precompute the page layout before it 
has the image). I can think of other reasons one would want metadata.

You still haven't given me the algorithm to get the information I asked 
for before. Why? Is that difficult to do? Would it take more than a line 
of pseudo-code to explain?

I reiterate, given that somebody has handed me arbitrary ActivityStreams 
2 JSON, how do I, without fail,

  * Find the URI I can ask for an updated version of this AS2 JSON (if
    such an URI exists)
  * Find the URI I can send the user's web browser to in order to
    display this object (if such a URI exists), noting that such a
    display is not necessarily a text/html URI (as one random example,
    it might be application/xhtml+xml, if the webmaster is bizzare)
  * Find the URI for the embedded content (image, video, audio,
    whatever) in order for me to display it in my user interface (if
    such content is present in the post)

I gave you the pseudo-code for AS1:

  *

    obj["links"]["self"]["href"] || obj["id"]

  *

    obj["url"] *(unless it's a collection, in which case you're screwed - SPECBUG!)

  *

    obj[*type*]["url"]

You will note that they each are both a single line, and trivial to 
explain. Now, I'd expect some extra complexity for features like the 
ability to express multiple media tracks (this is OK - this is a very 
useful feature), but right now I have no idea how I'm supposed to do any 
of them. And that's important, because those are some of the most basic 
bits of information anybody wants from an ActivityStreams object!

For AS2, I'd really love to simplify this to

  * obj["self"] || obj["id"]
  * obj["url"] || obj["id"]
  * Returning a list of "Media link"/ "Source" objects:
    if(obj[type] is an URI) -> [{"src": obj["type"]}]
    else if(obj[type] is an object) -> [obj["type"]]
    else if(obj[type] is an array) -> obj["type"]

Maybe this makes the spec slightly bigger, but it pus the information 
that I - as an implementor - need right there in front of me.

And that's really important. Conceptual simplicity has never won out 
over actual simplicity in the real world.

Received on Friday, 22 August 2014 19:58:18 UTC