Live data from Hacker News

What dif­fer­enti­ates front-end frame­works

themer.dev

231–240 of 256 posts

Re: What dif­fer­enti­ates front-end frame­works

#231
post #182

Earlier quoted context omitted.

Having worked extensively with the major frameworks in multiple orgs, I have largely found that templates synced with state via change detection (like Angular) result in more readable/maintainable projects. While I personally like React, it's pretty tricky to use in reality. I have found that its idiosyncrasies make it less resilient to suboptimal contributions from engineers that are still early in their careers. Br…

Have you tried the model view update pattern? If you haven't I recommend having a look. If found it amazing for maintainability. You have to be carful to structure everything well. If not you blow up the number of messages in one file. But once you get past that it's really amazing.

Yeah I have, personally I like it but the issue I have found was that I am not the only one who works on projects.

> You have to be carful to structure everything well.

This essentially sums it up. I can be careful, but it's impractical to review code to ensure it's also structured correctly when working on a team with lots of contributors with varying experience levels.

In my experience, It's also more difficult to teach MVU than it is to teach templating with automatic reactivity.

Re: What dif­fer­enti­ates front-end frame­works

#232
post #182

Earlier quoted context omitted.

Have you tried the model view update pattern? If you haven't I recommend having a look. If found it amazing for maintainability. You have to be carful to structure everything well. If not you blow up the number of messages in one file. But once you get past that it's really amazing.

Yeah I have, personally I like it but the issue I have found was that I am not the only one who works on projects. > You have to be carful to structure everything well. This essentially sums it up. I can be careful, but it's impractical to review code to ensure it's also structured correctly when working on a team with lots of contributors with varying experience levels. In my experience, It's also more difficult to…

Sadly, I have to agree with everything that you've written there.

For simple use cases templating is much better as well. It's only in complex state management that I find MVU is worth it.

Re: What dif­fer­enti­ates front-end frame­works

#233
post #61

Earlier quoted context omitted.

I don't see it that way. The main need for change detection in my opinion is to remove the need to update parts of the DOM in an imperative manner. It is fine to do that for smaller projects but when a project gets large, it becomes difficult to reason about the myriad of changes happening without a system to handle that. I find any one of the examples in the linked post way more easy to reason about than manual DOM…

Having worked extensively with the major frameworks in multiple orgs, I have largely found that templates synced with state via change detection (like Angular) result in more readable/maintainable projects. While I personally like React, it's pretty tricky to use in reality. I have found that its idiosyncrasies make it less resilient to suboptimal contributions from engineers that are still early in their careers. Br…

I’ve only ever touched React as a “so and so needs a hand on this bug” or “we want this feature added to legacy while the React team works on the new version”, so I was already going into a codebase that had long been abandoned in all but usage.

That said, it was a nightmare. I think we had state managed by vuex, and I just needed to add a new data point to the component and display it. But the data needed to be added to state…so I think I touched 6-7 files, adding mutators and updating definitions etc.

The experience put me off of React, though I do imagine a lot of that comes down to how the code is initially structured and maintained. It’s clear that whatever they were doing was more “make it work now” and it so much worrying about the future.

Re: What dif­fer­enti­ates front-end frame­works

#234

Earlier quoted context omitted.

> One view triggers an update to a model, I think it should be only the Controller which changes the Model. That can cause views which are dependent on the "aspect" of the model that was changed to update themselves. But a view updating itself should NOT cause the model to change and thus not cause a cascade of other views causing other views to change.

That's still a problem, because a view can trigger multiple controller updates (perhaps across controllers!), which need to be batched so that the application data remains in a consistent state.

I don't think that's the case in proper MVC design. Perhaps in some web version of it. In proper MVC AFAIK view never triggers any changes to anything, it just displays things and updates only itself, not others.

Re: What dif­fer­enti­ates front-end frame­works

#235

Earlier quoted context omitted.

Thanks for the kind words! > Maybe I'm missing something or doing things wrong? To be fair, I have many annoyances with Qt Quick. I think many of the components don't look and work native out of the box, requiring significant customization that is time-consuming compared to what you get out of the box by using many libraries alongside React. And there are these other annoyances that we already talked about. But in my…

I'm the author of rust binding for QML (the qmetaobject crate). The idea is that this is "safe" because your Rust code is safe, and QML is also supposedly safe. The implementation of QtCore/QtQuick is not your code to maintain. So hope that other people made it safe. See it as an abstraction is just like the Rust standard library that uses lots of unsafe. But anyway, I'm also making Slint [0], a toolkit developed in…

> is not your code to maintain

Exactly, that's what I meant, if I trust QtCore/QtQuick, writing the UI QML and logic in Rust is a pretty good idea. Although I must say that the latest Qt versions Qt 6.5.0-6.5.1 came with two serious bugs for me causing me to revert to Qt 6.4.3. So even that comes with a grain of salt.

I have been keeping my eye on Slint! I must admit, the use cases shown on your website don't look attractive. First, the apps don't seem useful (some random analytic panel, printer demo, and widget gallery) and they don't look good. If I may suggest, put there a simple TODO app that everyone is been taguht these day how to develop one in all the new frameworks. Maybe another app similar to that. It's going to be much more practical and people can have a sense of what is possible to do in Slint. In any case, I have been coming to check Slint every few weeks to check the progress so it's very cool to speak with the author. I wish you the best with it! If you need more feedback on the website's UX or anything don't hestiate to reach out: ruby . mamistvalove at gmail . com

Re: What dif­fer­enti­ates front-end frame­works

#236

Earlier quoted context omitted.

Thanks for the kind words! > Maybe I'm missing something or doing things wrong? To be fair, I have many annoyances with Qt Quick. I think many of the components don't look and work native out of the box, requiring significant customization that is time-consuming compared to what you get out of the box by using many libraries alongside React. And there are these other annoyances that we already talked about. But in my…

> But in my view, the QML paradigm is extremely consistent, even migrating from Qt5 to Qt6 was quite straightforward. I just updated my website to a new NextJS version and so many things broke in React there were serious paradigm changes if I remember correctly. Totally fair points here. Though slight nitpicks, these breaking changes were probably entirely NextJS changes and not React changes. NextJS solves a much mo…

> Though slight nitpicks, these breaking changes were probably entirely NextJS changes and not React changes.

Yes, you're right that's probably the case.

> I read the article and I'm skeptical that most QML code is compiled to C++.

Well, all the core Qt Quick components are written in C++[1]. Other components either reuses them in C++ or QML. So they're mostly C++ underneath.

> QML doesn't even allow you to type your list or object properties! How much of your QML code doesn't touch lists or objects?

What do you mean? JS object (like JSON?)? I'm quite sure QML supports object property. And JS list? There's this[2].

> QML is unsafe because it's a dynamically typed languages.

I get your point. Although there is qmllint that warns you of many such things before compilation even[3]. It's great. It's a shame they don't easily integrate it into Qt Creator by default. It saved me many errors. In your first example, I wonder why it does its behavior where it concatenates an int like a string. That's weird.

> The facts are that your users would run into much less runtime errors with TypeScript code than C++/QMLScript code. Also, TypeScript provides much more immediate feedback while developing.

I think that's a good take. And maybe something Qt should consider adding on top of QML.

> wonder how much of this is actually React and how much is using dynamic JavaScript.

I just remember handling state changes wasn't that natural to me (maybe it's the use of Hooks?). TypeScript does sound interesting, but I'm a QML convert for now.

> I'm curious about what you think QML really excels at

First - using Qt Quick - native performance. But talking about the language itself - I can't get over how amazing property bindings and signal and slots are for state changes. Just these alone would make me quit any web framework. They are so simple yet incredibly versatile and powerful. It just makes sense to work with them than any Hooks or whatever in React. Then the Model/View paradigm of Qt fits so well into QML is just awesome.

> What all did the prototype include?

Well, you can easily grab a binary from our GitHub Actions and try it out[4] or compile it from source. The basics for the Kanban were to 1. Process the markdown tasks in TextEdit 2. Beautiful interface 3. Beautiful drag and drop like `react-beautiful-dnd` 4. Markdown inside of tasks. 5. Rendering fast with even thousands of tasks.

> I'm constantly looking for the best way to build UIs, and right now Svelte seems like the best.

Me too. But I'm reluctant to non-native performance anymore. I had enough of Electron apps. That's why I was trying React Native (I had a good experience with it but I still prefer QML) and Tauri. I really can't remember why I disliked tauri (maybe i tried to create a custom window decoration but couldn't?). If you ever give it a shot let me know what you think about it. But then again, I'm sold on the flexibility of Qt C++ together with QML.

> I imagine OS native web views might be better at rendering certain UIs than Qt's rendering.

Why is that? Qt is using the underline accelerated graphics APIs to render its content[5]. Even if a component isn't native we say it's native-like because it still uses the native graphic API just not the native component.

> It's super interesting hearing all your thoughts, and would love to hear more.

Thanks! I learned a lot from what you're saying. I have plans to create an ecosystem of open-source cross-platform apps, so I've been deliberating for the longest time on which framework to choose. For now, I've settled on Qt/QML. It has its cons. But that's why I like talking about it with other people so I can document these, file the right reports and maybe improve it as time goes by. After releasing the next version of my note-taking app I plan to migrate the UI completely to QML and create an adaptable/responsive app that will share the same source for desktop and mobile, taking inspiration from MAUI apps[6] that our based on MAUIKit[7].

[1]https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/...

[2] https://doc.qt.io/qt-6/qml-list.html

[3] https://doc.qt.io/qt-6/qtquick-tool-qmllint.html

[4]https://github.com/nuttyartist/notes/actions/runs/5565887776

[5] https://doc.qt.io/qt-6/topics-graphics.html

[6] https://mauikit.org/apps/

[7] https://mauikit.org

Re: What dif­fer­enti­ates front-end frame­works

#237
post #205

Earlier quoted context omitted.

> You can declaratively pass objects between web components in every web components library out there like Lit or Stencil. This makes it a non-standard library-specific method of passing things. I have no idea what you're arguing against. There's literally no way to pass objects as attributes to web components. Web components had a great opportunity to get rid of attributes/properties dichotomy, but they doubled down…

> Of course there's nothing standardised, and nothing interoperable. This is so very much not true. On what basis do you even claim this? Web components are JavaScript objects that extend from HTMLElement. They all share a common interface of attributes, children, events and properties. You can get a reference to any web components any set a property on it: document.querySelector('my-element').someProp = {}; This wor…

> This is so very much not true. On what basis do you even claim this?

I worte the basis, and you completely ignored it.

> And who cares?

Ah yes. The mantra of all web-component zealots. "Who cares".

How it started [1]: "we have too much Javascript, we rely on too much Javascript for all our functionality, empty body tag is the bane of web sites" etc.

How it's going: Who cares? Dozens of new JS APIs! More JS APIs coming every month. Why would you want to do anything with web components outside of Javascript? Declarative? Oh, in any of the Javascript libraries. Javascript Javascript Javascript Javascript Javascript.

> Attributes are string-valued, why would you want to pass an object to them?

That is not what anyone wrote. Literally not a single person.

Anyway, this is hopeless. Web Component zealots are absolutely deaf and blind to anything outside of their world where goals shift faster than grains of sand in a hurricane.

[1] The original pitch for Web Components: https://fronteers.nl/congres/2011/sessions/web-components-an...

Re: What dif­fer­enti­ates front-end frame­works

#238

Earlier quoted context omitted.

The flexbox does not seem to match the power of QML. For instance, I can have a two-pane view as simple as: Text { anchors.top : parent.top anchors.bottom : parent.bottom anchors.left : parent.horizontalCenter anchors.right : parent.right anchors.topMargin : 10 text : "Hello World" } which does not reference any dimensions of the objects. It is easy to reference an anchor of a sibling and other parent elements when n…

Thanks for the nice response! > The flexbox does not seem to match the power of QML. For instance, I can have a two-pane view as simple as: I'm a bit confused by this example. When you make the other pane wouldn't you need to define all of its anchors too? It seems like the more standard QML approach to a two-pane is using RowLayout[1]. RowLayout { anchors.fill: parent Rectangle { Layout.fillWidth: true Text { text:…

> Do you have examples of UI layouts you feel QML solves intuitively that flexbox can't solve intuitively?

I think your example on the flexbox use for two pane view illustrates that well. Although I have no experience of using it I get that the gist of it is the same of a RowLayout. It’s a good abstraction for listing many items of the same kind which need to respond dynamically with the change of window dimensions. But when I really need to place two panes 10px appart or put elements on top of it in the bottome left corner, bottom right corner and align margins of the content within the pane anchoring elements manually is so much easier. I remember when I started to learn QML my first instinct was to find where can I make a table and align elements within it where instead I just needed to use anchors.

The beauty of QML is that I can treat RowLayout and Row as elements written in QML itself. If I recall accurately it is possible to loop through child elements and assign properties to them such as anchors with respect to sibiling elements. The abstraction thus is more fundamental.

> Svelte and other modern UI frameworks prefer composition over inheritance

Inheritance is the right abstraction for the UI elements. For instance I don’t need to predict all properties in advance for my custom bottom implemntion when used in the code. Assuming that all of them are available is quite powerful and allows to experiment in place. This work exceptionally well in QML but not in OOP languages in general. Nevertheless, can you come up with `footguns of inheritance` to which QML is susceptible to?

> Svelte uses file based components as well. Each file is its own module in TypeScript/JavaScript.

This sounds interesting. I will give it a try on someday when I will need to make an UI in HTML.

Re: What dif­fer­enti­ates front-end frame­works

#239

Earlier quoted context omitted.

That's still a problem, because a view can trigger multiple controller updates (perhaps across controllers!), which need to be batched so that the application data remains in a consistent state.

I don't think that's the case in proper MVC design. Perhaps in some web version of it. In proper MVC AFAIK view never triggers any changes to anything, it just displays things and updates only itself, not others.

How can you build anything interactive if your views never trigger updates to state? Here's a simple example: I have a reusable filter component. It lets you enter text and choose an option. Sure, it can manage that state internally, but at some point it needs to communicate out the chosen option to its parent component, which needs to update its own state to reflect the filter value and handle the filtering. In MVC, you need the controller to maintain state, and the views need to be able to hook into it.

Re: What dif­fer­enti­ates front-end frame­works

#240

Earlier quoted context omitted.

For example, there's the way it's still impossible to pass data between native Web Components without stringifying it first.

This is an absolutely stunningly false and ignorant statement. I can't believe it's still being repeated. Web components are objects and they have properties that can be set. The entire web components community - which includes the developers of apps like Photoshop, Reddit, Chrome, Firefox, and a lot more - passes properties down through trees of web components _all the time_.

You started by saying it's false, then proceeded to write something unrelated.

If you start with such a statement, it would be best to follow up with proof instead of something unrelated.

Post reply on HN