Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your note says, "A Server Driven UI is when the API tells the client which components to display and with which content." Your description of server-informed UI is, "Render concrete boxes, sections, paragraphs, lists. Render the visual page structure." What's the difference?

More concretely, in your example:

    {
      "section1": {
        "topBoxTitle": "Foo",
        "leftBoxTitle": "Bar",
        "linkToClose": "https://…"
      },
      "section2": {
        …
      }
    }
I was thinking these keys are special and a different page would also have "section1" with "topBoxTitle," but maybe I misunderstood. If these keys aren't special and the frontend dev is just humanly interpreting this differently on each page then defining the actual layout to display it, that's probably fine. But I wouldn't describe this as rendering the visual page structure in the backend.


It may totally be my bad for not making this part clearer in the article, but these structures are never meant to be fed into something that can automatically produce a UI. They are not meant to be consistent.

The way I've been describing this lately — the json structure should come from you squinting at the page and seeing approximately what needs to be on it, and creating as-flat-as-possible way of sending it over, that makes it clear enough what each field is for, but not so granular as to be automatable.

If you have a designer in your company, I've been increasingly preferring to use their terminology to name fields. If page has "cards", "navigations", "banners" whatever designer calls them, call them the same way in JSON. This is a good middle ground. It makes sure that back-end passes what front-end needs, while at the same time making sure that front-end doesn't get the wrong idea that their framework can dictate and accept this json structure directly.

So if a full JSON-based language would allow you to customize every page element in any way you like, this approach only lets you to send over decisions about this page, using a json payload specifically for this page and the ways it can change, no more no less. You cannot add an arbitrary box or an arbitrary section in json, and expect it to appear.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: