News for hackers. Stuff that matters.
Re:HTML First – Six principles for building simple, maintain... by zelda-mazzy on Sunday November 12, 2023 @02:20PM (#38243261)
In theory these principles are really good concepts from an education standpoint. Where I teach, we teach students vanilla javascript and HTML as much as possible before moving on to frameworks that make things easier.

Some of these points I'm a bit confused on... is the point behind "Where possible, maintain the right-click-view-source affordance" supposed to be to make the learning barrier lower? While I understand the sentiment behind this, tools like React or Angular have significantly lowered the barrier to entry in their own ways.

Re:HTML First – Six principles for building simple, maintain... by max_ on Sunday November 12, 2023 @02:27PM (#38243304)
Have you used HTMX?

I am yet to find a reason for using frameworks like React instead of HTMX.

Re:HTML First – Six principles for building simple, maintain... by silentguy on Sunday November 12, 2023 @02:57PM (#38243554)
I have used HTMX with Flask and Jinja. It makes the process much simpler to do the frontend development as a backend developer. But I can see its limitations. It's not suitable for anything bigger than a hobby project. Also, it doesn't help with keeping the frontend and the api totally separate. You have to return the html object from API which has its own set of problems.
Re:HTML First – Six principles for building simple, maintain... by recursivedoubts on Sunday November 12, 2023 @03:19PM (#38243726)
> It's not suitable for anything bigger than a hobby project.

This is patently false. It is being used in multiple significant production systems:

https://www.commspace.co.za/

https://zorro.management/

https://www.contexte.com/

https://turboscribe.ai/

and many more. There are times where htmx isn't the right choice, but the idea that its not useful for anything more than a hobby project is simply false.

Re:HTML First – Six principles for building simple, maintain... by ativzzz on Sunday November 12, 2023 @04:40PM (#38244353)
The middle 2 links are by solo developers - I wouldn't call those significant production systems. Generally tools like React are helpful for managing complexity across large systems where nobody understands the whole app and layers of of features, bug fixes and optimizations have been baked in over the years and nobody understands the whole app anymore
Re:HTML First – Six principles for building simple, maintain... by max_ on Sunday November 12, 2023 @04:43PM (#38244374)
The reason "nobody understands the app anymore" is due to the complexity of React and not the application.

HTMX tries to reduce the complexity.

Re:HTML First – Six principles for building simple, maintain... by ativzzz on Sunday November 12, 2023 @04:50PM (#38244443)
No, nobody understands the app because it is simply impossible to hold in your head 5-10 years worth of development by 100+ people across a complex product with complicated use cases and customer need (unless you were there the whole time and you are a very hard worker)

By the time you create the correct abstractions, customer needs and the market will have changed and thus your abstractions are now incorrect

Re:HTML First – Six principles for building simple, maintain... by Xeamek on Sunday November 12, 2023 @06:49PM (#38245370)
It's both.

Sure, if you have project like facebook then you problably won't get away from complexity, and you NEED a tool to help you manage that.

But at the same time, if you assume you need such tool from the beginning, chances are you will over-complicate your solution and it will become a self fulfilling prophecy of trying to tackle complexity by adding more complexity

Re:HTML First – Six principles for building simple, maintain... by recursivedoubts on Sunday November 12, 2023 @04:50PM (#38244446)
contexte is a (small & now full stack, after using react) team:

https://htmx.org/essays/a-real-world-react-to-htmx-port/

Re:HTML First – Six principles for building simple, maintain... by David-Guillot on Sunday November 12, 2023 @05:02PM (#38244549)
To be accurate in the past year we went from 3 to 7 in that team, and I think everyone has been using htmx at least once, and 4 of us are using it on a regular basis.
Re:HTML First – Six principles for building simple, maintain... by max_ on Sunday November 12, 2023 @03:08PM (#38243645)
I would like to know more about these limitations. I haven't used HTMX on more than a hobby project myself.

>You have to return the html object from API which has its own set of problems.

If you mean that HTMX can't consume JSON. Can't you just create a separate end point for JSON responses?

Re:HTML First – Six principles for building simple, maintain... by gitaarik on Monday November 13, 2023 @12:03AM (#38247119)
Of course that is possible, but wouldn't that make the project more complex again?
Re:HTML First – Six principles for building simple, maintain... by robertoandred on Sunday November 12, 2023 @03:36PM (#38243853)
What's the reason to use a framework like HTMX instead of React?
Re:HTML First – Six principles for building simple, maintain... by David-Guillot on Sunday November 12, 2023 @04:28PM (#38244247)
Cost.

React will require you to hire a React dev to handle all the complexity.

htmx will be mastered by your "back-end" devs (who actually are web devs) less than a week.

Re:HTML First – Six principles for building simple, maintain... by mostlylurks on Sunday November 12, 2023 @05:00PM (#38244534)
React is so simple to use that you definitely don't need to hire a "react dev" to "handle all the complexity". Like >95% of the effort is just understanding the basics of standard front end technologies (HTML, JS, and CSS), something that "back-end" devs (especially ones that label themselves as such) are by no means guaranteed to understand, which is an issue, since you'll have to understand these things even when working with htmx.
Re:HTML First – Six principles for building simple, maintain... by David-Guillot on Monday November 13, 2023 @11:02AM (#38251709)
My feeling as an old-time "web developer" who has been bullied into becoming a "back-end dev" is: thank you, I think I know quite well the basics of standard front-end technologies, but suddenly some people started yelling at me "you're a grandpa, now you can't send HTML from the server anymore, it's lame, you have to send to the browser a JS app that will manipulate the DOM live instead". This new (in 2015) approach has flooded our brains with a deluge of libs, frameworks, tools, concepts, problems, etc. which are a lot more than 5% of the effort of bootstrapping a React app, let alone optimizing it and maintaining it. I know people who's main job is creating React apps and who are overwhelmed with the complexity of the stack. If you don't hire someone dedicated, the rest of your product (domain rules, database optimization, infrastructure, devops, etc.) will suffer.
Re:HTML First – Six principles for building simple, maintain... by robertoandred on Sunday November 12, 2023 @05:35PM (#38244809)
What kind of web dev can't handle React? Meanwhile, htmx uses clunky, non-standard attributes that rely on logic and templates that are split up in a million different places. Plus it requires a context switch to do anything client side.
Re:HTML First – Six principles for building simple, maintain... by _heimdall on Monday November 13, 2023 @07:17AM (#38249365)
Don't underestimate the learning commitment it takes to learn react. Learning the basics of react and its component architecture is one thing, learning all the tricks and gotchas related to hooks, accidental re-renders, accidental no-renders, etc takes time.

Throw in the usual pile of libraries used with any larger react app and it can easily take months to really get moving.

Re:HTML First – Six principles for building simple, maintain... by robertoandred on Monday November 13, 2023 @12:30PM (#38252738)
Everything has tricks and gotchas, even htmx.
Re:HTML First – Six principles for building simple, maintain... by David-Guillot on Monday November 13, 2023 @09:23AM (#38250397)
I know so-called "senior frontend engineers" whose speciality is React, and who can't handle React. So all others...

This thing (and others like Vue, let me be clear) adds many layers of complexity over the web platform (client-side routing, data fetching, state management, rendering, etc.) and many third-party JS libs that you have to constantly update. You just can't say that it's standard/base web development.

Re:HTML First – Six principles for building simple, maintain... by max_ on Sunday November 12, 2023 @04:40PM (#38244346)
It reduces development complexity.

- No complex build set-up (just link the script & use it)

- Less congitive load when reading the code. Especially if it's not yours.

- Very decent learning curve.

Re:HTML First – Six principles for building simple, maintain... by robertoandred on Sunday November 12, 2023 @05:36PM (#38244822)
But all it is is fancier fetch()s. It can't remotely approach the functionality of React, so it just shifts any complexity to different places.
Re:HTML First – Six principles for building simple, maintain... by Xeamek on Sunday November 12, 2023 @06:56PM (#38245418)
Yes, it shifts complexity to the backend. Which will already have it anyway (because it has to), has better tools to manage it, you can use literally anything you want instead of being forced to use javascript, has (relatively) instant access to the authoritative source of truth, and isn't resource constrained (at least not the same way that the client is).

so "just shifts it somewhere else" might be underselling it a little

Re:HTML First – Six principles for building simple, maintain... by robertoandred on Sunday November 12, 2023 @10:27PM (#38246536)
And waiting much longer than an instant for a million server requests every time a template changes on a page is not a good use of those resources.
Re:HTML First – Six principles for building simple, maintain... by mostlylurks on Sunday November 12, 2023 @04:56PM (#38244493)
React makes it fairly easy to implement your app in a way that makes it easily portable to different platforms. With things like HTMX, you'll more or less have to rewrite everything if you ever end up in a situation where you'd like to release the application on mobile, or as a desktop app, especially if you want it to work when you can't rely on the user having a stable internet connection.
Re:HTML First – Six principles for building simple, maintain... by chrisweekly on Monday November 13, 2023 @12:25AM (#38247262)
When it comes to teaching web dev fundamentals, the sequence HTML -> CSS -> JS makes the most sense to me. They're 3 legs of a stool. CSS is an underappreciated but absolutely essential facet of accessible, standards-based web development. https://every-layout.dev and https://www.joshwcomeau.com/tutorials/css/ are great resources.