News for hackers. Stuff that matters.
Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @02:12PM (#33134565)
>I’ve hit a point where it just doesn’t seem like the end justifies the means in the vast majority of cases anymore

I agree, but the only path forward is to change the specifications for HTML/CSS/JavaScript.

As an industry we need to accept that these technologies get used to build web pages as well as software and adjust. This will remove a ton of the tooling. I think there are 3 basic things we could do to solve this:

1. Add dynamic interpolation to the HTML spec. This stops every framework from having to invent it's own version of it. 2. Update the DOM api to allow data binding/state and improve the Web APIs around routing/history to make SPAs even easier. 3. Update the HTML spec to allow for semantically describing user interface elements of software applications.

But it's going to be a hard sell. I am slowly writing a blog post about this, but I'm not sure I will be able to get anybody to listen. I feel like now, when we're in a browser monoculture where the browser vendor is actually competent is the perfect time to push this stuff through.

Re:Ask HN: Getting tired of complexity in web development by dtx1 on Saturday October 08, 2022 @02:42PM (#33134811)
Finally someone is saying it openly. The Web is amazing, the softwarestack powering is horrible.

Just imagine for a second we were to start from scratch. Imagine an HTML/CSS Spec thats easy enough to implement so that we have multiple independent vendors with competing, correct implementations. Imagine something like web assembly as the basis for scripting those HTML/CSS Engines. Imagine the amount of energy, developer time and bugs we could save with a sane, modern standard that implements all the lessons learned from what came before...

One can dream...

Re:Ask HN: Getting tired of complexity in web development by akrymski on Saturday October 08, 2022 @02:57PM (#33134939)
I think what we need is a new spec that compiles down to whatever HTML/CSS/JS/WASM is supported by browsers over time. Waiting for browser vendors to agree on a new spec takes far too long.

The same thing happens in all of comp-sci: we create a new programming language that compiles to an old language (C to Assembly) because changing the old one takes longer than inventing a new one.

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @03:54PM (#33135446)
Ultimately, that's what all these different frameworks actually are though. Look at how many different languages over the years have compiled down to JS? CoffeeScript, TypeScript, Elm. And all the frameworks that have smoothed over the native DOM API: React, Angular, JQuery, too many to list.

They all implement these concepts in Javascript. But if we don't standardize and allow browser vendors to implement at a lower level, we will always be taking a speed hit and on the framework treadmill. We need to take what we know works and do it.

Re:Ask HN: Getting tired of complexity in web development by akrymski on Saturday October 08, 2022 @04:18PM (#33135637)
Sort of, but React is not a language. It's a runtime lib. JSX is not really helpful - still writing HTML and CSS.

TypeScript has been very useful and successful but it hasn't touched the UI stuff.

We need a better alternative to HTML and CSS. With WASM any language can now be compiled to run in the browser, and it's a matter of time until WASM integrates with the DOM as well.

This isn't web specific. Desktop UI APIs change frequently too. UI is hard, and only higher level of abstractions can simplify things.

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @04:28PM (#33135710)
>Sort of, but React is not a language. It's a runtime lib. JSX is not really helpful - still writing HTML and CSS. TypeScript has been very useful and successful but it hasn't touched the UI stuff.

That's my point. The main thing that JSX does is address that you can't do conditional rendering or interpolation with HTML. It's the same with literally all of these other templating languages. Blade, Jade, Handlebars, Mustache, the list goes on and on. Typescript literally exists to address a deficiency in JS.

I don't think reinventing the wheel is the answer - it should taking these clear improvements and adding them to the core product. A big part of why technologies become popular is because of how accessible they are to newer or less knowledgable developers. I don't think some new idea would work, we should work with what's already there. I don't think there's any fundamental flaw in HTML, CSS or JS that necessitates a complete replacement. Just adjustments.

HTML's purpose is to semantically describe content. I don't see how that is at odds with describing the user interface for software vs. a web page.

CSS can lay things out great. It used to be a pain, but flexbox/grids have made it easy now.

JS is the most popular language in the world. If we added a "types" mode that just adds the typescript syntax and lets you set a flag for it, it'd be even better. We don't need a new programming language for people to learn.

See, that's where we differ. I think HTML and CSS are great. They just need to be improved.

>This isn't web specific. Desktop UI APIs change frequently too. UI is hard, and only higher level of abstractions can simplify things.

Yeah, and if you look at the popularity of electron apps it's pretty clear that people prefer doing this stuff in HTML/CSS/JS, even with all the hacks than trying to learn platform specific stuff. I'm arguing with tweaks, we could do it AND have it be performant and not a pain in the ass.

Re:Ask HN: Getting tired of complexity in web development by akrymski on Saturday October 08, 2022 @05:40PM (#33136262)
HTML and CSS were not designed for building software. There's a reason it's nearly impossible to implement a web browser from scratch these days. The spec is an ancient monster. Adding more layout options to CSS doesn't simplify things, but only complicates. How many ways are there to layout stuff these days? Try explaining flexbox to a newbie.

HTML was meant for hyperlinked documents. It may be ok for that, but it's inappropriate for apps. Who cares about semantic meanings of DOM nodes in an app?

I don't think people prefer web dev to desktop dev, but really there's no choice if you need to support multiple OSes. Swift UI is a much more consistent development experience for example. Visual Basic was that for Windows. But cross platform? The only real target there is Skia.

Re:Ask HN: Getting tired of complexity in web development by tonightstoast on Saturday October 08, 2022 @03:03PM (#33135001)
Please write the blog post. It may be a hard sell but think of it more as a creative conversation with the future of web dev. While you may not get the final answer “correct”, your post will help the community progress a much needed discussion.
Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @03:30PM (#33135258)
Thanks, and I will. It's at about 3000 words and I have been sitting on it, but I think I am going to just finish it up and release it and see what discussion it generates.
Re:Ask HN: Getting tired of complexity in web development by jelan on Saturday October 08, 2022 @06:27PM (#33136637)
Please share it when you are done!
Re:Ask HN: Getting tired of complexity in web development by robin_reala on Saturday October 08, 2022 @05:01PM (#33135967)
Number 3 is the ARIA spec right? You should be using that already if you’re writing accessible applications.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @05:12PM (#33136060)
Here's what I don't understand about the ARIA spec - and maybe you can help clarify it for me. Why are we using attributes instead of element names?

Like take this for example: https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...

Did we just give up on using semantic elements? People barely know how to write regular HTML anymore, and the ARIA spec is confusing. I'm glad it exists, but to me it fits into the same category as "Web components" - a bad idea that isn't widely adopted because it sucks.

Re:Ask HN: Getting tired of complexity in web development by an1sotropy on Saturday October 08, 2022 @05:48PM (#33136336)
Can you say more about why "it sucks"? Are there some specific changes you can think of that would have made it a less bad idea?
Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @06:07PM (#33136489)
1. It's confusing. The fact that there's a "role" attribute that is implicit sometimes and needs to be declared other times and a "aria-XYZ" set of attributes is stupid. The purist HTML take was always "Markup should describe content" - now we're describing content with attributes?

2. It's positioned specifically as being for accessibility. This is bad for several reasons. First, it's not necessary. The entire goal of semantic markup in the first place was to make it so that the content of documents can be read by machines (both screen readers and other systems) - tacking on a special system just for accessibility is basically them giving up on this entirely. Secondly, a lot of people don't care about accessibility. Like I said, in our current system people barely know how to write HTML. Or they write some bastardized version of it in JSX or w/e. You think they're going to learn the intricacies of ARIA? No.

The goal should be for HTML to be a language that when written properly is accessible by default. Not just "hey everybody it's cool if you use divs for everything, just make sure screen readers know what it's supposed to be."

Re:Ask HN: Getting tired of complexity in web development by naasking on Saturday October 08, 2022 @05:08PM (#33136025)
> Add dynamic interpolation to the HTML spec. This stops every framework from having to invent it's own version of it.

Not sure what this means exactly

> 2. Update the DOM api to allow data binding/state and improve the Web APIs around routing/history to make SPAs even easier.

Something like AlpineJS built-in?

> 3. Update the HTML spec to allow for semantically describing user interface elements of software applications.

ARIA roles kind of already do this.

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @05:18PM (#33136110)
My post will expand on all of this in detail, including addressing ARIA.
Re:Ask HN: Getting tired of complexity in web development by sundarurfriend on Saturday October 08, 2022 @05:53PM (#33136375)
In practice, any attempt to change these basic specs would be diverted to be to the benefit of Google and its ilk, with the power they have to steer conversations and decisions. It's an accident of history that we ended up with these fairly open and hackable systems as the basis for the Web, and it's at a delicate point where a lot of companies are annoyed that they can't silo and close down more of it.

So the unfortunate reality is that any well-intentioned attempt to reform them would be used instead to reshape them for corporate interests, with no guarantee that we even end up with better specs from a developer point of view. The incentives lay in the direction of guaranteeing corporate interests, with users losing more of their freedom to choose how they access and use the Web; the developer concerns will at best be used as a PR front for the press headlines.

Re:Ask HN: Getting tired of complexity in web development by crabmusket on Saturday October 08, 2022 @07:31PM (#33137037)
Which of the current JS frontend framework paradigms do you think should be standardised and shipped in browsers? Would you choose a React-like model, or maybe something more Svelte-like? Or something different from either of those two that I'm not aware of?

And the follow up question, which is pointed, is: if your proposed solution would look similar to current JS solution X, why would it be better than X? Is the goal removing the build process? Increasing uniformity across the ecosystem?

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @07:53PM (#33137140)
Great questions!

>Which of the current JS frontend framework paradigms do you think should be standardised and shipped in browsers?

The basic concept of "binding" data to a DOM element and having the DOM element update when you update the data instead of having to manually update it. That's something every modern frontend framework does.

I think under the hood, the people who actually write the DOM apis would know how to do that in the most performant way possible. I know any native approach would certainly be faster than a Javascript framework. To me the more important part is getting the API surface right.

That's the big problem with a lot of these standards updates. They kind of half assedly add a feature that's inconvenient and then nobody uses it. They need to think more like "How can we incentivize people to drop X framework and do it natively?"

>if your proposed solution would look similar to current JS solution X, why would it be better than X?

It'd almost certainly be faster being built into the native code, but yes the goal is to remove the build process and tooling. But also to bring things back into balance. Right now, most web apps are a big bundle of JavaScript. But with these changes, it'd be several HTML files, JS files, CSS files. In balance again. Each technology has its own place. I think the average skillset of front-end developers would improve massively if they didn't have to do stuff like chase down NPM problems or debug Webpack.

Re:Ask HN: Getting tired of complexity in web development by Chris_Newton on Saturday October 08, 2022 @08:35PM (#33137347)
I appreciate the ambition to reduce the complexity and tooling overheads. Unfortunately, I doubt we could define a sufficiently general API for the kind of functionality you’re talking about. There is too much variety in the applications we now build with web technologies.

Maybe we could do it for simple CRUD application UIs that are built using lightly styled forms and tables. To be fair, that might already be a substantial proportion of all web UI development.

But the kind of data binding you’re talking about wouldn’t help at all with implementing a word processor, an FPS game or a data-heavy app built around interactive visualisations. A foundation where UIs are built from simple pieces of DOM derived directly from corresponding variables in JS would severely restrict what we could build on top.

Re:Ask HN: Getting tired of complexity in web development by dimmke on Saturday October 08, 2022 @11:07PM (#33137948)
In my scenario, it's not like I'm saying JavaScript frameworks can't or shouldn't exist. My point is they have become the default and I don't think they should be.

We will always need JS frameworks. It's where some of our best ideas have come from. I just think it's time that some of the most successful ideas make it into the standards.

Re:Ask HN: Getting tired of complexity in web development by crabmusket on Saturday October 08, 2022 @11:48PM (#33138115)
> Maybe we could do it for simple CRUD application UIs that are built using lightly styled forms and tables.

That would be a very admirable and IMO sufficient goal. Being able to do "modern forms" with "native" capabilities seems fairly reasonable.

The word processor, fps, data heavy requirements are IMO being taken care of by WebAssembly, which is a more appropriate technology for those sorts of things than the DOM is anyway.

Re:Ask HN: Getting tired of complexity in web development by crabmusket on Saturday October 08, 2022 @11:53PM (#33138138)
I look forward to the post coming into my RSS reader :)

> they didn't have to do stuff like chase down NPM problems or debug Webpack.

The ship has well and truly sailed on that one. Building a reactivity framework into the browser isn't going to solve dependency management or transpiling.

But I wonder if ESM is going to change this game a bit. Now that dependencies are statically analysable in the page source, a CloudFlare or similar could sit between the "source" and the browser and do intelligent caching and bundling transparently.

Re:Ask HN: Getting tired of complexity in web development by throwaway0asd on Sunday October 09, 2022 @05:40AM (#33139429)
State has nothing to do with the DOM. State is a data feature of your application which is not the DOM. It sounds like you are stuck in some inescapable framework mindset. If you can escape framework insanity state is an easily solved problem and the DOM stops being scary.