|
|
|
|
|
by johnzabroski
4437 days ago
|
|
Let me rephrase my objection once more. In graphics programming, it is customary to have a Scene Graph which is a Model that represents the scene you need to Render. In Desktop/Web programming for business apps, this design pattern/abstraction step seems completely absent, and developers seem to continuously mush together view and model. What "composition" can't be achieved simply by having a Knockout Virtual Element, or Template Selector driven by a ViewModel property? |
|
React, as well as this library, are pretty much exactly like this, except you replace OpenGL with the DOM. They are purely about managing UI state; they provide the controller (C) and view (V) parts of MVC, and leave the model (M) aspect to the developer to work out using some other library. For example, it's entirely feasible to combine React with Backbone models. Unlike traditional MVC, however, the responsibilities of the controller are generally handled by the view itself.
The composition that they are talking about is about treating components as first-class objects. For example, in React, you can do this (via JSX, a preprocessor for JavaScript that allows you to embed HTML in JS):
Here, Button is not a real HTML element, but another component which is embedded in the parent component. By expressing this as a pseudo-element, it's possible to treat it as a black box that knows how to render itself.