OK. With parallel examples, let's go through and compare and contrast them.
-
Which code knows how to draw the UI in each case?
Regular HTML: app server + CSS
The HTML document contains lots of presentation details for browser code.
The server must know about presentation details to serve it up.
The browser must know an immense amount about how to render any valid HTML document.
Semantic HTML: CSS
The HTML document contains no presentation detail—everything is in separate CSS files.
The server only needs to know how to arrange the data when making this document, and how to render links to related data and forms.
The document only includes the basic instructions for navigation and form submission.
hyper+JSON: client app
The server only needs to know how to arrange the data when making this document, and how to render links to related data and forms.
The document also includes the basic instructions for finding related data, and altering this data.
data as JSON: client app
The server only needs to know how to arrange the data when making this document.
-
Which code knows the URL for profile images?
Regular HTML: app server
The HTML document has <img>
tags, with URLs created by the server.
Semantic HTML: app server
The HTML document has <img>
tags, with URLs created by the server.
hyper+JSON: app server
The hyper document has src
properties, with URLs created by the server.
data as JSON: client app + app server to serve the image
Custom client app code must turn the author's id
into a URL.
-
Which code knows how to issue a like
command?
Regular HTML: app server
The HTML document has <form>
tags, with URLs and hidden
inputs created by the server.
Generic browser code knows how to turn form tags into a valid HTTP request (without having a clue what the request means) when the user triggers that action.
Semantic HTML: app server
The HTML document has <form>
tags, with URLs and hidden
inputs created by the server.
Ditto on the generic browser.
hyper+JSON: app server
The HTML document has action
objects, with URLs and hidden
inputs created by the server.
Generic hyper code knows how to turn action objects into a valid HTTP request (without having a clue what the request means) when the client app triggers that action.
Generic HTTP libraries properly encode the request as a application/x-www-form-urlencoded
document.
data as JSON: client app + app server to process the request
Custom client app code must issue a request to the correct URL, and include all the relevant hidden inputs when that action is triggered.
Generic HTTP libraries properly encode the request as a application/x-www-form-urlencoded
document.
-
Which code knows how to issue a comment
command? What's different from like
?
Regular HTML: app server + browser for comment text
The HTML document has <form>
tags, with URLs and hidden
inputs created by the server.
Generic browser code provides a user control, asking the user to provide the text. It knows to update the parameter of a form because its <input>
is nested within the <form>
.
Generic browser code knows how to turn form tags into a valid HTTP request (without having a clue what the request means) when the user triggers that action.
Semantic HTML: app server + browser for comment text
The HTML document has <form>
tags, with URLs and hidden
inputs created by the server.
Ditto on the browser.
hyper+JSON: app server + client app for comment text
The hyper document has action
objects, with URLs and hidden
inputs created by the server.
Custom client app code provides a user control, asking the user to provide the text. It knows to that control is bound to update the input
parameter inside the action
object.
Generic hyper code knows how to turn action objects into a valid HTTP request (without having a clue what the request means) when the client app triggers that action.
Generic HTTP libraries properly encode the request as a application/x-www-form-urlencoded
document.
data as JSON: client app + app server to process the request
Custom client app code provides a user control, asking the user to provide the text.
Custom client app code must issue a request to the correct URL, and include all the relevant hidden inputs, and place the user comment text in the right parameter when that action is triggered.
Generic HTTP libraries properly encode the request as a application/x-www-form-urlencoded
document.
In general, semantic HTML relies more on assumptions about UI, and hyper expects a custom UI nav to trigger data links.