4 ms·
I get that XML is not cool anymore but JSON is really a terrible language to define user interfaces. This smells like using JSON for the sake of using JSON. Th
by felixfbecker 3y ago
I get that XML is not cool anymore but JSON is really a terrible language to define user interfaces. This smells like using JSON for the sake of using JSON.
There's a reason why JSX (basically XML in JS) is so popular and not some JSON definition of HTML.
Even Windows apps have XAML so the UI doesn't have to be defined in C# objects.
- itslennysfault 3y agoI think Flutter does a great job of doing UI using objects with zero xml. I also can't stand JSX. It feels like inverted PHP to me (which I suppose makes sense since it's Facebook)... but I guess it's all just a matter of taste.
- dleeftink 3y agoCould you share an example as to why you think JSX feels like inverted PHP? I think it is an interesting perspective.
- CognitiveLens 3y agoI think the parent is referring to how you write PHP templates, which are HTML at the top level, but escape to raw PHP code inside particular delimiters (<?php>), whereas for JSX you write JS at the top level and 'escape' (kinda) to HTML in your returned element. Not exactly an inversion, but I can see the connection.
- itslennysfault 3y agoReally just the weird mix of xml and code PHP is sticking code (php) in html JSX is sticking xml (html-ish) in code (JavaScript)
- blackoil 3y agoFlutter does some job, definitely not great.
- vineyardmike 3y agoIf I recall, Alexa Presentation Language, the way to define UI for Alexa skills, is also some unholy JSON nightmare. JSON is great for programmatic manipulation, but horrible to read as a programmer.
- incrudible 3y agoJSX is not XML, it is Javascript. The point of XAML (and this JSON thing) is to build declarative UI that can be authored and displayed without evaluating something like Javascript. For that use case, I do not believe JSON is any worse than XML for authoring, but really you want some sort of GUI for it. Programmers, especially those living in terminals, tend to hate such stuff, of course.