News for hackers. Stuff that matters.
Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @09:37AM (#38952714)
So what's the problem with a bundler/transpiler etc? You set it up once. It takes a few hours, maybe a day. Then your platform _is_ TypeScript + React. This abstraction basically never leaks. I never need to look at the transpiled files to find an error.

Nobody argues that a C compiler is worse than assembly or that drivers or an operating system are bad.

Re:Is htmx Just Another JavaScript Framework? by hellcow on Thursday January 11, 2024 @09:49AM (#38952876)
> You set it up once. It takes a few hours, maybe a day.

Until you need to update a dependency on a large codebase, which takes weeks because dependency A doesn't work with dependency B version X, and updating dependency B means that it no longer works with dependency C version Y, and so on. And nobody uses dependency C anymore -- it's unmaintained, so you need to rewrite everything to use dependency D.

Then you need to repeat this every few months because there's nonstop vulnerabilities flagged and APIs broken.

Nah, I'm good.

Re:Is htmx Just Another JavaScript Framework? by donatj on Thursday January 11, 2024 @10:18AM (#38953336)
This is exactly what we’re dealing with right now trying to upgrade TypeScript. We’re stuck on an early version of 4.X because of some dependency triangle I haven’t had time to work out.
Re:Is htmx Just Another JavaScript Framework? by marius-sw on Thursday January 11, 2024 @11:17AM (#38954237)
Hello, I have nearly 10 years of experience dealing with this. Do you need help?

I am sure I could fix it in a few hours - either I fix it within 5 hours or you don't pay anything. My hourly rate is 150 EUR and my email is in my profile.

Re:Is htmx Just Another JavaScript Framework? by donatj on Thursday January 11, 2024 @12:23PM (#38955374)
No disrespect but frankly I don't think you could, I don't think anyone could. It's a giant tangle of grunt and require and special custom build systems.
Re:Is htmx Just Another JavaScript Framework? by mortallywounded on Thursday January 11, 2024 @01:47PM (#38956807)
Ouch, if you're using gulp/grunt/browserify or anything that wasn't invented six months ago then you're doomed anyway :)
Re:Is htmx Just Another JavaScript Framework? by alexpetros on Thursday January 11, 2024 @12:28PM (#38955456)
I am always perplexed by how many people deny the reality of this. Upgrading TypeScript major versions for any package of non-trivial size and dependencies is often (not always, but often) quite difficult! I wrote about that in my last htmx essay.[0]

[0] https://htmx.org/essays/no-build-step/

Re:Is htmx Just Another JavaScript Framework? by iterateoften on Thursday January 11, 2024 @10:19AM (#38953348)
Seems a bit of an over reaction. Never experienced anything like you say since working with typescript after working on multiple billion+ $ SaaS apps. It’s basically the same as any other language.
Re:Is htmx Just Another JavaScript Framework? by infamia on Thursday January 11, 2024 @12:08PM (#38955095)
Did you not deal with the debacle of js changing imports how imports work? That was absolutely miserable and js libraries have a very short half life indeed. JavaScript's culture of small, relatively short lived libraries makes maintaining a JS app particularly miserable for many (see the comments affirming this misery). It is not anything close to the same.
Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @10:00AM (#38953028)
Dependency management is an unrelated issue and it exists for any platform. Unless you copy paste code or unless you just avoid dependencies. Which is easy to do in TypeScript as well. Nobody says you need to install hundreds of packages.
Re:Is htmx Just Another JavaScript Framework? by jacobyoder on Thursday January 11, 2024 @10:12AM (#38953222)
> Nobody says you need to install hundreds of packages.

If I need one, I have to get that package's dependencies. People don't choose to say "Damn, I'd really love to have 1800 dependencies!" But if you have 4-5, you automatically get dozens or hundreds out of your control.

Yes, could you build everything yourself by hand? Sure. That's a hard sell to many depts/projects. "This will take 3 weeks to build" vs "This will take 4 minutes to npm install". That 4 minutes is introducing a lot of potential risk and headache and time later, but it's providing immediate relief.

FWIW, "dependency management" is a problem in every platform, but I have nowhere near the same number of issues in the composer/php world (nor previously in the maven/java world) as I do in the npm/js world.

Re:Is htmx Just Another JavaScript Framework? by cryptonym on Friday January 12, 2024 @02:51AM (#38965277)
Publishing & importing 3rd party code is so easy with npm that everyone is blindly importing code that wouldn't pass their own peer reviews.
Re:Is htmx Just Another JavaScript Framework? by stiiv on Thursday January 11, 2024 @10:48AM (#38953829)
Agreed! For this reason, we use very few third-party dependencies in our big TS monorepo. NPM is a jungle, and for an experienced team of TS developers, a new dependency just isn't worth the risk -- we'd rather just code things ourselves.

But it is worth emphasizing that NPM really does stand out as a hazard compared to package repositories for other dev ecosystems. I believe that dangers are more common, and unpleasant outcomes can be more severe.

Re:Is htmx Just Another JavaScript Framework? by kugelblitz on Thursday January 11, 2024 @11:25AM (#38954379)
Yeah, as a full-stack / backend developer using PHP / Symfony (and Twig), I only occasionally need to update the frontend. But then all these problems keep popping up.

Oh, that's the wrong yarn version. Oh, I thought v3 is the newest? But we still use v1? I used v3 in another project. So I need to install different versions? Ah, then I also need different versions of node? Ah, better to use nvm? Because only later versions have corepack, the experimental but recommended tool?

Or do we change back to npm? And why does an install process change a .lock file?

Re:Is htmx Just Another JavaScript Framework? by mortallywounded on Thursday January 11, 2024 @01:45PM (#38956786)
This is such a common issue with npm and bundler it was an inside joke/meme at every company I worked at.

Person A: "Hey, so I ran bundle update and it's not working."

Person B: "You updated the dependencies? WHY WOULD YOU DO THAT!"

Re:Is htmx Just Another JavaScript Framework? by danielvaughn on Thursday January 11, 2024 @09:49AM (#38952872)
I don't know how build systems work at lower levels, but things move so fast in the web development world that it renders your codebase inoperable if you don't maintain it.

I've had a codebase that sat for as little as 6 months without me touching it. When I tried to run it again, I ran into so many compatibility issues that I had to tediously copy out all of my code into a new project and then fix the remaining issues with my code itself.

Web dev build systems are dependencies on top of dependencies on top of dependencies, and they're all introducing breaking changes every other week it seems.

Re:Is htmx Just Another JavaScript Framework? by palmfacehn on Thursday January 11, 2024 @10:07AM (#38953144)
Inevitably someone will respond claiming that if you don't like the current ball of duct tape, it is because, "you haven't wrapped this weeks hottest flavor of duct tape as yet another layer on top"

There's something seriously wrong with modern front end tooling when the norm is downloading hundreds of dependencies to display semi-interactive text in a browser.

Re:Is htmx Just Another JavaScript Framework? by yoyohello13 on Thursday January 11, 2024 @10:11AM (#38953199)
> downloading hundreds of dependencies to display semi-interactive text in a browser.

I think you mean thousands.

Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @10:01AM (#38953058)
That‘s why there is a lock file. The package manager and node version can likewise be locked.
Re:Is htmx Just Another JavaScript Framework? by gkbrk on Thursday January 11, 2024 @12:26PM (#38955426)
Yeah, just lock your versions without updating in the JS ecosystem with typical projects having thousands of dependencies, and watch your CVE count go up every day you don't update.
Re:Is htmx Just Another JavaScript Framework? by ahmedfromtunis on Thursday January 11, 2024 @10:19AM (#38953347)
Does the lock file render the need to update dependencies obsolete?

Of course not. It just avoids that the build system *automatically* updates X to 1.2.3 and *accidentally* breaks your code. But when it's time to bump the version up a notch, that very fragile equilibrium may suddenly crumble.

Lock files are not a substitute for sane dependency management.

Re:Is htmx Just Another JavaScript Framework? by zdragnar on Thursday January 11, 2024 @11:36AM (#38954542)
There's no reason that you absolutely have to update every dependency after 6 months. Not updating anything at all is perfectly fine.

Nobody in their right mind thinks you can change major versions without some elbow grease in any other language.

Re:Is htmx Just Another JavaScript Framework? by ahmedfromtunis on Thursday January 11, 2024 @04:16PM (#38959190)
> Nobody in their right mind thinks you can change major versions without some elbow grease in any other language.

I have an old project that I didn't touch in more than 5 years. Last week, I decided to give it another spin, and booked the entire afternoon to deal with any issues that may arise from the update process.

It went from Python 3.6 to 3.11, and from Django 2.2 to 4.2. Postgres jumped from 11 to 16! There were 10 other libraries (PIL, ...) that I had to update too.

The only special procedure that I had to do was dumping data from the old database and restoring it from the new one, as recommended by PG when doing major-point updates. (And adding a single line to Django's `settings.py` for the new `CSRF_TRUSTED_ORIGINS`.)

When I typed `docker compose up` on my terminal, the app just run smoothly without as single problem. I even had to check that I didn't invoke the old configuration by mistake.

All in all, the process took me less than 15 minutes.

Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @11:28AM (#38954419)
I responded to someone who claimed that it broke by itself after 6 months. Lock files prevent this.
Re:Is htmx Just Another JavaScript Framework? by satvikpendem on Thursday January 11, 2024 @11:29AM (#38954443)
This is the same in any language then.
Re:Is htmx Just Another JavaScript Framework? by ahmedfromtunis on Thursday January 11, 2024 @04:19PM (#38959225)
Some stacks are just more finicky than others: https://news.ycombinator.com/item?id=38959190
Re:Is htmx Just Another JavaScript Framework? by jollyllama on Thursday January 11, 2024 @09:41AM (#38952766)
Once you're in the NPM ecosystem, there is a maintenance overhead.

See:

https://htmx.org/essays/no-build-step/

https://dubroy.com/blog/cold-blooded-software/

Re:Is htmx Just Another JavaScript Framework? by wmfiv on Thursday January 11, 2024 @10:08AM (#38953155)
One challenge a bundler and transpiler introduce is they enable an unconstrained set of solutions.

If a particular application has 10 patterns that support all the applications UI interactions, then a simple, constrained solution like htmx that supports those 10 patterns is preferable (to me) than an unconstrained solution like Typescript + React where each developer will likely use their creativity and experience to design slightly or wildly bespoke solutions for each feature.

Re:Is htmx Just Another JavaScript Framework? by gofreddygo on Thursday January 11, 2024 @10:24AM (#38953425)
> what's the problem with a bundler/transpiler

Problem is why do we even need one? All I'm trying to do is for my client code to update a part of the page and not the entire page. Why do I need to even introduce concepts of bundling and transpiling for this pig-headed simple task ?

Further, react has a steep learning curve that a backend person need not be subjected to. And it evolves, so that search-copy-paste phase just never ends.

And then dependencies update. Another comment here details why that is a nightmare.

If you want to feel the pain, search for any react project from 2 years ago on github or even some showhn projects here. Literally none of them even start !

So you see htmx does address a group just like react does. Its a tool and it's great at what it does.

Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @11:37AM (#38954562)
They don‘t start if they use complex frameworks, many dependencies, don‘t use lock files, don‘t lock their package manager and don‘t lock nodeJS and don‘t use Docker.

If they use plain TypeScript and plain React, have a lock file, lock their package manager version and lock their nodeJS version and optionally ship a sane Docker setup they will certainly run.

It is true that it would be nice to have a single tool that combines a bundler, typescript, linter, prettier, package manager and runtime and have it all configured with reasonable defaults from a single file and not 5 configs. And people have tried this lately, with approaches like deno and bun. But it‘s difficult to get these adopted.

Still, it would be better for someone to take all these tools and freeze them in place or even fork them and then freeze them with only bug fixes coming, rather than throwing out 10 years of progress and going back to something that just doesn‘t work.

Re:Is htmx Just Another JavaScript Framework? by gofreddygo on Thursday January 11, 2024 @12:00PM (#38954942)
Lockfiles aren't a magic bullet. They point to an a specific old version of all internal dependencies. That still requires the maintainer of each of my dependencies to have published a patch to an OLD version when vulns show up.

And the alternative of typscript + react + nodejs + npm + docker for a damn web based UI is just terrible ! Sorry, no bueno.

I don't want to be at the mercy of all the maintainers of my dependencies. So clearly, I need to cut down on my dependencies. htmx is a great middle ground. Clearly, you can now at least see the appeal of htmx + a backend service for a robust though not fully optimized web based app.

And I can't see the JS ecosystem's last 10 years as outright "progress", but rather a series of experiments, that work for some and don't for others.

Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @12:07PM (#38955081)
Many of these libraries cannot have meaningful vulnerabilities. What‘s a possible vulnerability in lodash that can be exploited without already being able to inject code?

Furthermore, any vulnerability in a dependency could also exist in code written by myself or a team member. And then never get fixed or even found.

Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @11:33AM (#38954504)
TypeScript is simply a much more robust type-safe language and the compiler abstracts away subtle differences between browsers. Likewise React abstracts away subtle differences between browsers.

And most applications are far more complex than just needing to update a small part of the page.

Re:Is htmx Just Another JavaScript Framework? by jabradoodle on Thursday January 11, 2024 @10:15AM (#38953275)
For one thing I may have very simple requirements that I don't want to buy into maybe a day long setup for, nor hand write js when html could support it.
Re:Is htmx Just Another JavaScript Framework? by exabrial on Thursday January 11, 2024 @10:52AM (#38953889)
> This abstraction basically never leaks

I actually did laugh out loud.

Re:Is htmx Just Another JavaScript Framework? by deliriumchn on Thursday January 11, 2024 @11:06AM (#38954078)
> It takes a few hours, maybe a day.

Even then, most of the times it doesn't take even an hour because majority of people will grab default config or use something that allows no-config (parcel, vite, etc)... Some are fine with default CRA for a long time until they really need something custom, for example.

Re:Is htmx Just Another JavaScript Framework? by intrasight on Thursday January 11, 2024 @09:44AM (#38952811)
The problem is that it's no longer an "interpreted" language.
Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @10:02AM (#38953068)
How is that a problem?
Re:Is htmx Just Another JavaScript Framework? by intrasight on Thursday January 11, 2024 @01:17PM (#38956273)
People like to interact with interpreted languages
Re:Is htmx Just Another JavaScript Framework? by quonn on Thursday January 11, 2024 @04:23PM (#38959294)
But in the browser the browser interacts with it anyway. It‘s not like the app would run in a repl and now doesn‘t. There is no meaningful difference in this case, even less so if hot reloading is used.
Re:Is htmx Just Another JavaScript Framework? by modmodmod on Thursday January 11, 2024 @10:20AM (#38953375)
best joke heard all day
Re:Is htmx Just Another JavaScript Framework? by mythz on Thursday January 11, 2024 @10:17AM (#38953317)
Reasons why I no longer prefer SPA's:

  - Build tools are complex
  - Large FX's have 100's of npm dependencies
  - Every SPA I've created has suffered from bitrot overtime, including:
  - Often breaking changes on upgrade, incompatibility between package versions
  - Dependencies/tools/fxs often abandoned, rewritten, replaced, etc
  - Constantly wasting time working around issues
  - Doesn't scale, the larger the App, the slower initial load and slower the FCP
  - Heavy client state and need to manage client routing
I now prefer using #NoBuild [1] ESM builds of progressive JS FX's for adding behavior to static rendered content where each page only loads the JS it needs, which ends up being much simpler [2] and resolves these issues I used to have with SPAs. Blazor with static rendering and Enhanced Navigation is even nicer which gives SPA-like navigation responsiveness without SPA-like complexity [3].

[1] https://world.hey.com/dhh/you-can-t-get-faster-than-no-build...

[2] https://servicestack.net/posts/javascript

[3] https://servicestack.net/posts/net8-best-blazor