From Content to Frontend

From Content to Frontend

What Lurks …
Beneath the View?

From Content to Frontend

What Lurks …
Beneath the View?

// TODO: add Vincent Price meme

What Lurks Beneath the View?

  1. Why we love paradigms
  2. The trouble with MVC
  3. A Post-View Manifesto

1/3

Why we love paradigms

Chris Coiyer: The Great Divide, 2019

“When companies post job openings for ‘Front-End Developer’, what are they really asking for? Assuming they actually know (lolz), the title front-end developer alone isn't doing enough.”

Heydon Pickering: Reluctant Gatekeeping, 2018

“By assuming the role of the Full Stack Developer (which is, in practice, a computer scientist who also writes HTML and CSS), one takes responsibility for all the code, in spite of its radical variance in syntax and purpose”

Turns out websites are considered software now

Turns out websites are considered software now

Webdesign adopts the language of so-called real developers

Who is a real developer anyway?

Who is a real developer?

  1. Webdesign has become a bit abstract
  2. People have a hard time measuring proficiency

Who is a real developer?

  1. Webdesign has become a bit abstract
  2. People have a hard time measuring proficiency
  3. Ergo: Sticking to methods is more reassuring than quoting one's gut feeling.

We're bound to overvalue methodology

We're bound to overvalue methodology

Because

  1. We need to integrate academic IT concepts
  2. Following a method is considered a safer approach

2/3

The Trouble with MVC

GUI w/ MVC: Xerox Alto, 1974 (info)

MVC was pioneered by GUIs and revolves around constant transparent interaction with a data model (e.g. window management).

It has since been adapted for other systems and is on of the most widespread paradigms for interfaces.

How it works (source)

The Screen-scraping drag

“Dev – So, this screen has data element x,y,z… could you please create an API with the response format {x: , y:, z: }“

The Screen-scraping drag

“Dev – So, this screen has data element x,y,z… could you please create an API with the response format {x: , y:, z: }

Me – Ok“

The Screen-scraping drag

“Dev – So, this screen has data element x,y,z… could you please create an API with the response format {x: , y:, z: }

Me – Ok

I don’t even argue anymore”

— Jean-Jacques Dubray: Why I No Longer Use MVC Frameworks, 2016

Views for models? Or models for views?

A typical MVC explanation from the API viewpoint goes: For a single data model, we can produce multiple view variants, as in “skinning”.

Views for models? Or models for views?

A typical MVC explanation from the API viewpoint goes: For a single data model, we can produce multiple view variants, as in “skinning”.

From a UI perspective, more often than not, the same template/component is applied on multiple models – think Wordpress post types with different data but a identical layout.

Controllers are overrated

While things like data-binding are surely hard problems, they don't make up great parts of most web applications.

Tellingly, a lot of examples for applications teaching the MVC model revolve around controller-heavy interfaces like todo lists and form dashboards, while even complex apps usually don't feature heavy two-way-communication.

Controllers are overrated

Their mere existence holds suggestive power that can lead to imaginary problems and overcomplication of systems.

The Trouble with MVC

Dealing with troubles

Dealing with troubles: Defensive coding

fetchUser(id).then(user => {
  // Got my user!
  if(!user || !user.name)
    throw new Error('wat')
  }
})
//Later
if(user && user.name){
  render(user.name)
}

— Nicholas Kariniemi: Fear, trust and JavaScript, 2018

Dealing with troubles: Backends For Frontends

“The BFF is tightly coupled to a specific user experience, and will typically be maintained by the same team as the user interface, thereby making it easier to define and adapt the API as the UI requires […].”

— Sam Newman: Backends For Frontends, 2015

Actually Dealing with troubles

Actually Dealing with troubles

“We have a site that's moving to a component-based architecture, and when the Drupal devs pointed out that we still have a lot of fields & content types to define, much head-scratching ensued. ‘But isn't it all just components?’ ”

— Katherine Senzee, 2019

Actually Dealing with troubles

“Structured content isn't about ‘put things in fields and use widgets instead of HTML’ — that's just one means to the end of capturing meaning rather than simply presentation.”

— Jeff Eaton, 2019

Actually Dealing with troubles

“The view model […] has a binder, which automates communication between the view and its bound properties in the view model. The view model has been described as a state of the data in the model.”

— Model–view–viewmodel (John Gossmann, 2005)

Actually Dealing with troubles

“We need to revisit the separation of concerns principle. […] It’s good that we conceptualize designs […] now, but that can be a mental model without being a technology-specific land-grab.”

— Heydon Pickering: Reluctant Gatekeeping: The Problem With Full Stack, 2018

The Artisanal Gap

The trouble with MVC: The Artisanal Gap

This being a living standard can produce blurry specs.

But the trouble with MVC lies not in the concept but the overly broad and unreflected application across domains of different crafts.

There is not only a semantic gap but an artisanal one – see the frontend divide pretext.

Reflecting on one's own needs

While sounding a bit grumpy, the that MVC-critique article inspired me to question my setup more confidently.

And make up an architecture that fits my domain better – my “small stack”.

My favourite component system

  • no unnecessary semantics or frameworks
  • logicless template components …
  • … with a data schema class
  • data examples and variants
  • a component styleguide maintained on the same system with little effort

3/3

A Post-View Manifesto

A Post-View Manifesto

1. MVC is my CMS

1. MVC is my CMS

Using the MVC pattern, concept and backend can deliver a wireframe that answers these questions:

  1. what data gets presented in which facets/application states?
  2. how is the data called? – content semantic
  3. how is the data managed?

MVC semantics fit the editor experience: The model is supposed to be fully transparent on backend views which make use of controller logic.

A Post-View Manifesto

2. 2 systems, 2 schemes

2 systems, 2 schemes

Acknowledging the differences between systems stops sabotaging two otherwise elegant concepts with deep interoperability needs.

2 systems, 2 schemes

Acknowledging the differences between systems stops sabotaging two otherwise elegant concepts with deep interoperability needs.

Yeah, this sounds a lot like decoupling.
But we're not talking routers on the UI side.

Component data schema

slides:
  - img:
      750: /promo/slides/cta-welcome-square.jpg
      1440: /promo/slides/cta-welcome.jpg
  - img:
      750: /promo/…/promo-foobar-BF20190318-square.jpg
      1440: /promo/slides/2/promo-foobar-wide.jpg
tiles:
  - img: /promo/tiles/1/tour.jpg
  - img: /promo/tiles/2/promo-foo.jpg
  - img: /promo/tiles/default.jpg

Model query schema

    'id' => 'foobar',
    'slot' => 'tile_3',
    'img' => [
        {
            'path' => 'public:/tiles/test.jpg',…
        },…
    ],
    'filters' => [
        {
            'id' => 'to',
            'value' => 1552392082,…
        },…
    ]

A Post-View Manifesto

3. UI bridges the artisanal gap

Fellow frontenders, sit your ass down:

A Post-View Manifesto

3. UI bridges the artisanal gap

Fellow frontenders, sit your ass down:
create your –own– API and map data yourself.

You have the “stack” knowledge to design your own systems.

Accompagny every component class with a mapper that speaks to backend.

Fill in missing UI content (copy, labels, legends …) yourself.

A Post-View Manifesto

3. UI bridges the artisanal gap

You have the “stack” knowledge to design your own systems.

Actually, even duct-tape-spaghetti-code will do – you're bothering nobody but yourself.

Wordpress post types

post-people.php

echo component('tiles', $people);

post-events.php

switch ($view) {
    case 'grid':
        echo component('tiles', $events); break;
    default:
        echo component('list', $events);
}

A Post-View Manifesto

  1. MVC is my CMS
  2. 2 systems, 2 schemes
  3. UI bridges the artisanal gap

Everybody wins:

  • you can integrate your full styleguide w/ realistic datasets
  • both domains can work along each other
  • everybody can run better tests and transparently fail on type/class checks

Everybody wins:

Approach the bright future of a post-view world!

Everybody wins:

Approach the bright future of a post-view world!

Closing words by Mister Price

Thank you!

Slides:
stolzenhain.net/slides/post-view

Opinions:
feedback@stolzenhain.net

—

ⓒ 2019, Florian Stolzenhain