5 ms·
Ask HN: What are the fundamental diffs between modern web vs. desktop UI models
Roughly once a week, HN will feature a link to a new web-based UI framework/toolkit. These seem to build upon a history that, briefly stated, seems to go: HTML -> HTML5 -> JS -> Node -> React -> [ a lot of stuff ]. Obviously there are things that branched off at various points along the way.
As a purely native desktop application developer, whenever I read about these frameworks, they seem to contain almost no trace of any of the programming models/designs/lessons that were learned between (say) 1980 and 2005 in the domain of native GUI toolkits (both platform-specific and cross-platform). There's almost no trace of any of the vocabulary, but also very little sign of any of the fundamental concepts (widgets, "classic" MVC, etc.)
So I'm asking without (much) predjudice: what's so different about UI/UX in web-dev that justifies throwing away all these design lessons? Or are they really still in modern web frameworks and I'm just not seeing them?
- hoofhearted 5y agoYou don’t throw those design lessons away! They are still very much in use and the standard for writing the modern web. Everything is based off the Gang of Four, and MVC has evolved to MVC-P, Model-View-Controller on the backend, with a Presentation layer on the front end. ReactJS for the presentation layer in your case. All the above, still based on the 23 Gang of Four design patterns.
- PaulDavisThe1st 5y agoI just opened my copy of Gang of Four. Almost none of the patterns there are exclusively GUI focused ... I might even go so far as to say that none of them are, but that's probably a little too strong of a claim to make. I was really asking about the design patterns used in native/desktop GUI applications like widgets (including a wide range of widgets almost none of which seem to be offered by any/most web frameworks), anonymous callbacks/closures, explicit event loops etc. Also, last time MVC "evolved" in a native context was, to the best of my knowledge, Microsoft's introduction of M-VM-VC where "VM" is "View Model", a slimmed down GUI-centric version of the "real" model. This way you're describing a "presentation layer" ... I don't see where the distinction between that and a traditional "View" is (or "Controller" for that matter, since in most GUI contexts, the View and Controller are frequently occupying the same pixels on a display. My guess would be that the "View" in the design you're referring to is some particular aspect of the fundamental model, rather than an actual mechanism of making the model visible to the user.
- hoofhearted 5y agoThe Flux design pattern created by Facebook, and used by Redux and nearly every ReactJS app, is by definition a State Design Pattern as described in Gang of Four lol.
- PaulDavisThe1st 5y agoFrom the book: "Allow an object to alter its behavior when its internal state changes. The object will appear to change its class". You think that's somehow primarily a GUI-related pattern? Let's see what the authors say about "Motivation" "Consider a class TCPConnection that represents a network connection. ..." Oh, right. It has nothing to do specifically with GUI programming, but is, like more or less all the other 22 patterns, a general pattern for writing good object oriented code. Everyone should know these patterns. It's great if ReactJS pushes people towards using this one. It doesn't have much to do with UI/UX implementation in either web or native contexts, IMO.
- hoofhearted 5y agoOops my bad Paul, I think you are correct! I didn’t bother to look at the username before I started commenting. But to further the convo, State isn’t a GUI related pattern. It’s the dominant design pattern used by modern JS frameworks for persisting data across the GUI. “Consider a Redux class ProductState that represents an Axios network connection. …”
- rektide 5y agothere's no ideas in native dev that arent well covered in various webdev frameworks. none. zilch. but popular web frameworks have their own more webful lexicon/definitions. imo few native frameworks really use the old lexicon heavily either. even in legendarily ancient realms like objective-c, there's persistient ideas, but the classic ui construction paradigms dont rule, arent the guiding star; there are still different & newer patterns & systems & words for using the available standard libraries.
- PaulDavisThe1st 5y ago> there's no ideas in native dev that arent well covered in various webdev frameworks. none. zilch. So, I want to present a classic expanding-node treeview. In GTK, I'd use GtkTreeView, populate a data model, connect it to the treeview, and I'm basically done. A minor change of widget names, and that process covers almost any native GUI toolkit. What's the generic equivalent of that in any web framework? Your final para feels like a restatement of my point, and I was really hoping for a justification instead.
- rektide 5y agosencha framework had all of this. a decade plus ago. tree compnents onnthe web were ultra hil, rhere were hundreds of them. this is doable modernly today too; none of it is unavailable. it's just not as popular. i dont think any pretense that computing has very specific enduring ideas is at all ok. does iOS have any parallel constructs to you ask? i genuinely dont know but even if it does it's just not the mode.
- PaulDavisThe1st 5y agoiOS' native GUI is extremely similar to the one on macOS and is packed full of the same Cocoa-ish concepts. They had to add multi-touch and they had to deal small screens (and reorientation), but the basic GUI concepts are essentially the same as in macOS.
- acemarke 5y agoThe first issue here is that _nothing like `GtkTreeView` is built into JavaScript or the browser_. Your typical classical desktop framework (Swing, Qt, wxWidgets, WinForms, Gtk) all have a huge available list of widgets with built-in behavior. That simply does not exist in a browser. You get a set of moderately capable and partially customizable form input elements, inconsistently implemented across browsers, and made worse by having a wide range of available browser versions actually in use. Beyond that, you end up having to build your own functionality out of a language that was "designed to make the monkey dance when you mouse over it", and a layout system that was originally designed to show _document_ content. There's also been a steady shift from building "web _sites_ with a bit of interactivity", into full-blown _applications_ that just happen to live in a browser, all while dealing with a unique set of constraints. JS had no built-in module system, the standard library is beyond minimal, every page is downloaded in full and so you have to minimize bundle size, and the language is quirky. They also deal with updating a stateful persistent data model that's already built into the browser: the DOM. So, every app is trying to simultaneously fill in a bunch of missing functionality, work across a wide variety of browsers, come up with some sort of themed appearance from scratch, and deliver all the functionality in the smallest possible byte size over the wire. Because of all this, web apps have followed a very different evolutionary path than desktop apps. I've covered some of this background in some slides and articles [0] [1] [2]. As for the design of the frameworks themselves: there certainly were some "classical" OOP-style widget-class-hierarchical frameworks that were out there around 2008-2010. For that matter, the GWT framework let you compile Java to JS, and had both its own built-in widget system and third-party libs like SmartGWt that provided a full desktop-like widget hierarchy. So, it's not that that's never been tried. Those got replaced by the first wave of what were, at the time, known as "JS MVC frameworks": AngularJS, Ember, and Backbone, each of which took very different approaches to structuring data and updating the UI. React took over from those three because it was easier to work with than AngularJS or Ember, solved the UI composition and event trigger problems of Backbone, and was far more structured than trying to update complex UI than jQuery. React itself was strongly inspired by some PHP-based patterns at Facebook. So, it's really a very different problem space with a very different set of constraints, following a completely different evolutionary path. [0] https://blog.isquaredsoftware.com/2016/10/presentation-modern-web-dev-overview/ https://blog.isquaredsoftware.com/2016/10/presentation-moder... [1] https://blog.isquaredsoftware.com/2019/05/presentation-js-for-java-devs/ https://blog.isquaredsoftware.com/2019/05/presentation-js-fo... [2] https://blog.isquaredsoftware.com/series/how-web-apps-work https://blog.isquaredsoftware.com/series/how-web-apps-work
- iostream23 5y agoSo, HTTP servers serve up strings, parsing of the many layers of which the kernel is a webpage. The whole thing was just supposed to be a glorified network file browser with optional index pages to explain or introduce the resources there. The main issue seems to be folks trying to avoid the page reloading. HTTP is stateless itself, so your form submission will need to engage server code blocks that then spit back an appropriate response, “hey that username exists already” amd HTTP could care less about the content of the response, let alone it’s meaning, it’s just a string. It’s no problem if the code that responds to the form submission can render a templated response as a string and the browser gets a page and parses and displays it. There is a no standardized means of maintaining a stateful webpage across page reloads, or even at all. It’s execution context is a remote client that is making HTTP requests and you have to wait for one and the only ways of even knowing the identity of the requester across requests, stateless protocol on purpose designed for scalability, are hacks of some kind, assuming IP addresses remain constant, or embedding à browser cookie that the browser then attaches to a future requests etc. Remember, the payload is a string, it has to get parsed into html elements that you could call the intended widgets of the web world. The web widget creation committee (paraphrasing) effectively never got off the ground so we never got more browser native elements. So, then you basically have everything being implemented ad hoc with Javascript and CSS, since then. React and its ilk are just ways of using JavaScript to create and append and remove elements to the tree, the DOM, dynamically without a page load. The whole thing works fine out of the box if you let the server update the state of a browsers view as was intended, but then you get a page reload, which is less than groovy if you are adjusting a virtual dial, for example. The web being cross platform only 24-7-365, it’s been particularly vulnerable to the politics of the tech industries in a way that low level code is not. If WPF is missing a crucial widget, you can code one and build it into your product. This is a good juncture point to bring up the incredible waste of electricity and computing power trying to create what behave like GUI applications on top of these massive virtual machines that only a handful of money pits can afford to try to build and maintain. I would say that trust is the primary obstacle to making a truly efficient binary remote blob deployment and activation infrastructure to replace the web, even if it still just piggybacks on port 80. IMO, the essence of the endless complication in the field of web development lies in the difference between what the web was architected to be and what we want to use it for. I do not think it’s wise to build a universal app platform on strings. Castle made of sand.
- ngrilly 5y agoThe big change is a shift towards declarative UI where the UI is a pure function of the state, avoiding mutations. That’s how React, Vue, Svelte and Flutter works for example. Very different from MFC on Windows or Gtk.