4 ms·
ceteris is rarely paribus: JSON-based APIs have to make a choice between being general purpose, in which case a web app written against them may end up chatty w
by recursivedoubts 2y ago
ceteris is rarely paribus: JSON-based APIs have to make a choice between being general purpose, in which case a web app written against them may end up chatty with multiple requests per page, or they end up application specific, in which case they can be churney and a bad general purpose API.
I wrote an essay about this here:
https://htmx.org/essays/splitting-your-apis/ https://htmx.org/essays/splitting-your-apis/
Also, producing JSON often involves reflection and can be more CPU intensive than straight templating (w/ fixed properly lookups) depending on your technology. Finally, the size delta between JSON and hypermedia is lower than most people think, particularly with compression:
https://github.com/1cg/html-json-size-comparison https://github.com/1cg/html-json-size-comparison
in most real world systems i expect data store access to be the dominant latency issue
some people have had good success w/htmx from a performance perspective (2x+ speed, 1/2 memory consumption):
https://htmx.org/essays/a-real-world-react-to-htmx-port/ https://htmx.org/essays/a-real-world-react-to-htmx-port/
but of course it depends on your use case.
I think htmx would be excellent for an e-commerce site, which is mostly text and images and relatively simple, coarse-grained user interactions.
- jakubmazanec 2y agoAs I said, using HTMX isn't "minimal to no JS". I agree that HTMX can be fast - but that's not what we're talking about. Even in the video of converting a React app to HTMX you linked the presenter literally says - "no JavaScript, just HTMX" - but HTMX is written in guess what? Very dishonest.
- recursivedoubts 2y agoi think it's reasonable to call htmx "minimal JS" in that it is relatively small, dependency free, can be used without a typical javascript build chain (npm, etc.) and frees the end user of writing javascript in many cases the speaker is referring to them not needing to write javascript for a specific feature, which is true, but they do use scripting for some aspects of the application, which is perfectly acceptable in hypermedia-driven applications: https://htmx.org/essays/hypermedia-friendly-scripting/ https://htmx.org/essays/hypermedia-friendly-scripting/ regardless, the wins are obvious
- jakubmazanec 2y ago> call htmx "minimal JS" "Minimal", maybe, "small to no", nay :D
- troad 2y ago> "Minimal", maybe, "small to no", nay :D Considering the original phrase was 'minimal or no', I am glad that you now agree. > you linked the presenter literally says - "no JavaScript, just HTMX" - but HTMX is written in guess what? Very dishonest. It's difficult to take this seriously. Just wait until you find out most of Python is written in C! Very dishonest!
- jakubmazanec 2y agoOn the contrary, you are still wrong. HTMX is simply using JavaScript and looking at it, it isn't minimal (it's still 15 kB min+gzip). > It's difficult to take this seriously. Just wait until you find out most of Python is written in C! Very dishonest! Now I understand, you're just obtuse.
- troad 2y ago> Now I understand, you're just obtuse. This seems like an exceedingly mean-spirited and unconstructive type of response to have to people who have been giving up their time trying to explain a different point of view to you. I would also gently point out the HN guidelines at this point. I note you haven't responded to my more substantive reply here,[0] so I am unsure you saw it. I would encourage you to read it with less of a zero-sum 'I-win-you-lose' mentality. I won't be engaging with you further though. [0] https://news.ycombinator.com/item?id=42386090 https://news.ycombinator.com/item?id=42386090