Radar: A PSR-7 Action-Domain-Responder Framework

The net result though is changes to MODEL STATE are immediately reflected on the view. And this simply isn't possible over HTTP (well, you could achieve it with websockets I guess). The view, at best, has a snapshot of the model at the point in time it was rendered.

  • GUI: HID event -> controller -> updated model -> updated view

  • HTTP: HTTP request -> controller -> updated view data -> updated view

The lag and granularity of updates caused by HTTP as a transport layer are not material to the pattern TBH. The pipeline above applies to both plain-old-HTTP-form submissions and AJAX, and is the same with sockets (s/request/socket message/), and the three together can provide three levels of granularity for view updates as needed.

Of course with a GUI the event updating a model may not come from the user, it may come from a timer, which hits the controller, which updates the model, which updates the view. In HTTP the event can only come from the user, in the form of user interaction, or AJAX polling for non-user initiated model changes (like said timer).

But those limitations of the medium (speed, event source) are not defining to the architecture. It's still the same architecture.

My level (observer/observee confusion not withstanding) is fairly well in tune with what the vast majority of commentators on the subject have thought for quite some time.

Oh, I know that. The community always lags behind the best understanding of any given topic, and give it a few years, we'll probably figure it out. But this is why we should never measure ourselves only by the lowest common denominator. Try to better understanding.

There was a time when messing with ActiveRecord instances in one's controllers was very popular understanding of good architecture in the community. My insistence on a service layer back then was met with the same misunderstanding and confusion, but wait long enough... and the world moves towards the better idea.

/r/PHP Thread Parent Link - paul-m-jones.com