HNHacker News
TopNewBestAskShowJobs

hasanhaja

138 karma · joined February 21, 2021

Software Engineer @ Cancer Research UK • Passionate about the web • All views are my own.

Mastodon: @hasanhaja@fosstodon.org GitHub: https://github.com/hasanhaja/ Website: https://www.hasanhaja.com/

submissionscomments
hasanhaja··on If not React, then what?
> is just a nice templating lib

Are these templates only used on the server-side to generate the HTML upfront? Or is it being generated on the client?

> experience when you inevitably have to add some interactivity is going to be 100x better than vanilla JS

I don't believe this can quantified. How are you measuring DX improvements? Are you also able to continue to measure these improvements as your application/codebase scales?

hasanhaja··on Svelte 5 Released
What do you hate about 11ty?
hasanhaja··on Web components are okay
What do you mean specifically when you say?

> DOM be a function of the state

I understand the benefits of the mental model, but the tooling that delivers that generally have a lot of complexity that isn't trivial to parse and understand. I think the benefit of being able to parse and understand your abstractions (ones you build yourselves or buy off the shelf like a framework) is there are always gaps in the constraints under which they had originally been designed; so you'll always need to understand how it works under the hood.

React's class-based components were simpler because the lifecycle methods were explicit, but the hook-based model is "easier"; however, the component lifecycle is still present. The demo code does look really clean, but in real life you quickly start to face the underlying complexity of the abstractions (e.g., useEffect, memoization, realizing how fine-grained your reactivity is is based on how you've drawn those component boundaries). You can write these optimizations yourself, or wait for the new auto-memoizing React compiler to land, but in all cases, the overall complexity remains the same (or is higher). And this isn't unique to React or other frameworks, and you'll always need to delve a little deeper.

I agree that the DOM APIs could be more declarative (e.g., declarative custom elements proposal [1], declarative shadow DOM, `@scope` CSS as another way to scope styles), and there is activity in that space, both in the W3 Web Components Community Group and the Open UI Community Group. I'm trying to get more involved in those discussions and I'd recommend everyone who cares about the web and how we build for it to participate.

I think the process of standardization for new features (through the proposals phases to finally landing in browsers) is the effort to raise the floor for all to build on top of. I remember when Promises were landing everywhere and feeling a little overwhelmed by what it meant to me because I was using Bluebird. Then the feeling of "maybe I can simplify what I'm doing and lean more on the platform" set in. Frameworks are a testbed for new ideas, and we can go further by trying to see what pieces we can pull out and standardize around (e.g., Signals proposal [2]), so we can go back to testing new ideas on top of that.

[1] https://github.com/WICG/webcomponents/blob/gh-pages/proposal... [2] https://github.com/tc39/proposal-signals

hasanhaja··on The Fennel Programming Language
They offer a higher level abstraction that might make interacting with the underlying APIs a little more egonomic. For example, Python being used a scripting language for AI and other data science things.

The performant APIs that the Python wrappers call are powerful but it might be a little cumbersome to use. A library I used a lot in university was the OpenCV through the native C++ APIs, the Java API and the Python API; the Python version felt a lot easier to work with.

hasanhaja··on Dutch DPA fines Uber €290M because of transfers of drivers’ data to the US
I'm currently reading a book called "Technofeudalism" by Yanis Varoufakis that investigates things along the lines you've said. My main takeaway so far is "Capitalism" hasn't always been one thing and it has evolved over the years. Capitalism of today isn't the same as the capitalism we had before the oligopolies and cloud giants, and that makes me thing differently about the statement "capitalism isn't great either, but I do think it's the best system we have."

I would highly recommend the book!

hasanhaja··on Dutch DPA fines Uber €290M because of transfers of drivers’ data to the US
The following example isn't a tech product, but it demonstrates the outrageous anticompetitive practices some of these monopolies engage in to suffocate people who are just building their own shit:

Chokepoint Capitalism with Cory Doctorow - FACTUALLY Podcast: https://youtu.be/vluAOGJPPoM?si=zuezwnlUHhuoQFNt&t=2668

hasanhaja··on Dutch DPA fines Uber €290M because of transfers of drivers’ data to the US
I urge you to read "Technofeudalism" by Yanis Varoufakis or "The Internet Con" by Cory Doctorow to appreciate why this is extremely difficult for consumers and entrepreneurs, and not just an inconvenience.
hasanhaja··on Dutch DPA fines Uber €290M because of transfers of drivers’ data to the US
> Even though the rules are great, I'm just not sure if it will be good or bad long term for EU.

We can speculate this all we want, but I think it's fair to say with confidence that leaving companies unregulated (or poorly regulated) is bad for everyone in the long term. A slightly different example is the poor enforcement of antitrust laws being one of the reasons we have the tech oligopoly we have today with Apple, Google, Amazon and Meta.

hasanhaja··on iOS404
I think this has a lot to do with your points.

> Typically, cutting edge features are deployed by browser makers in their own engines first, then, using real world feedback over several years, eventual standards are created. No feature starts out as a web standard. – Walled Gardens Report, Open Web Advocacy [1]

Apple dragging it's feet will impact this, but Apple outright banning competing browser engines kills all progress. Having competing browsers on the platform will allow the market to decide what features are useful and what are not, and the standards can follow suit. I agree there are privacy concerns with some of the proposals (especially some of the ones by Google), but not having the choice of browsers is much worse for the open web.

At the moment, we just have to trust Apple has our best intentions by supporting/not supporting certain features and standards. However, we know from the work the Open Web Advocacy has done that this isn't true. The primary driver for both stifling progress on Safari and keeping browser competition out is the profits from the App Store [2].

[1] https://open-web-advocacy.org/walled-gardens-report/#mandati... [2] https://changelog.com/jsparty/316#t=00:25:59.26

hasanhaja··on iOS404
The closed aspect directly speaks to how much diversity you can have on the platform. The features (like WebUSB) aren't the drivers for a more open platform, but they highlight what the impact of having no competition does. Opening up the platform will fuel competition and the market can decide what works and what doesn't. At the moment, we just have to trust Apple has our best intentions by supporting/not supporting certain features and standards. However, we know from the work the Open Web Advocacy has done that this isn't true. The primary driver for both stifling progress on Safari and keeping browser competition out is the profits from the App Store [2].

Chrome becoming the dominant browser is also concerning, and they will have to be held to a much higher scrutiny by us and policy makers to ensure they have users best interest at heart [3].

> shifting the cost of compatibility into userland

What do you mean by this?

> struggling to pay for their last-minute plane ticket at the gate but being greeted with "Sorry, our checkout page doesn't work on your browser/device". This is not the way.

I agree! This is exactly why we can't depend on one organization to dictate what's allowed and disallowed on that platform. On iOS, think about how long it took Apple enabled Apple Pay support for non-safari browsers even though they all had to be WebKit-based.

[3] https://open-web-advocacy.org/walled-gardens-report/#the-chr...

hasanhaja··on iOS404
I'd highly recommend this document to establish the scale of impact these different vendors have: https://open-web-advocacy.org/walled-gardens-report/

Google is definitely not in the clear, but Apple's anti-competitive practices is much more damaging to the open web.

hasanhaja··on iOS404
> That doesn’t mean that we should just adopt any nonsense that Google comes up with.

That's a fair statement. Conversely, why should we put up with Apple stifling the web platform? Especially when there's strong evidence to show this is motivated primarily by profit rather than the user experience [1][2].

[1] https://open-web-advocacy.org/walled-gardens-report/ [2] https://changelog.com/jsparty/316#t=00:25:59.26

hasanhaja··on iOS404
The desktop might be quite diverse, but the diversity on closed, proprietary ecosystems like iOS is controlled by one party. Either, we open up iOS so anyone can distribute apps without Apple being the ultimate authority (like on MacOS), or we enrich a much more mature platform (the web) that we already have to be more capable so we can deliver very similar experiences through the web that we currently build native apps for. Compared to iOS, the web platform is more secure with better privacy controls [1][2], and that feels like a better place to invest our energy.

[1] https://open-web-advocacy.org/walled-gardens-report/ [2] https://changelog.com/jsparty/316#t=00:25:59.26

hasanhaja··on HTML Web Components
Here's a pre-built one that I found that even lets you customize the debounce amount: https://ionicframework.com/docs/api/searchbar#debounce

The Stackblitz example is quite good too.

I'll give it shot to build a super simple one with just vanilla JS without helper libraries like Lit or Stencil. I think I'd take the same approach as I would with React, and I think the biggest difference would be where the fetch gets executed. In React you'd expose a prop like "submitHandler", but here I would emit an event from the component (after whatever debounce amount) and expect the caller to attach an event listener to my custom event to perform the fetch.

hasanhaja··on HTML Web Components
This is a better and more concrete example of the point made in the article: - https://www.zachleat.com/web/details-utils

The `details-utils` component enhances the behavior of the built-in HTML `detail` component. If for any reason you have JavaScript disabled, then using a web component like this would be just fine because the `detail` component would continue to behave like it always does. If you have JS enabled (or it's finished downloading) then you have an enhanced version of it that has features like collapsing when you click outside of it, etc. That's the part that's reusable when used like this.

That web component from the creator of 11ty is what made the point made in the article click for me. When I first started looking at web components I was like, "this still requires JavaScript and doesn't work without it," and that was the same point Rich Harris made in this article: https://dev.to/richharris/why-i-don-t-use-web-components-2ci...

hasanhaja··on HTML Web Components
I think this is a little gatekeep-y. Building static sites is real engineering. When you're building a site that scales in content (for e.g. one that contains thousands of pages that are updated regularly) you need to really know what you're doing. A CMS can help you manage your content, but you need to decide how to build your pages from it. There are things in the React space that can handle a lot of the complexity (for e.g. Next.js on Vercel with ISR), but you need an engineer to make the right trade offs.
hasanhaja··on HTML Web Components
What would a non-trivial example look like to you?

I'm working on building exactly this resource alongside a series of posts on web components.

hasanhaja··on HTML Web Components
How does the React part of your page work without JavaScript enabled? Are you using a static site generator (or another server side rendering tool) like Next.js?
hasanhaja··on Things you forgot (or never knew) because of React
Honestly, if that's what the research shows I think that needs to be considered. It'd be healthy to challenge those claims, and engage with how and why your revision control tool is hurting UX.
hasanhaja··on Things you forgot (or never knew) because of React
That's a fair point. I didn't consider that
hasanhaja··on Things you forgot (or never knew) because of React
I don't feel it's fair to brand "web components" as a technology that was in direct competition with React. I think the nuance matters.

They may have been solving similar problems then, and they may be optimized for different things now. But Web components are a web standard, and React is not. Pushing for web standard technologies is inherently unbiased because that's just betting on the platform. This results in pushing for platform improvements (like declarative shadow dom so it plays well with SSR, etc), and then everyone benefits.

IMO it'd only be a bias take if web components were branded as having no issues whatsoever, or that they are the most optimal solution for everything. I think it's okay to say, "web components currently don't solve my problems and that's why I'm looking to use something else like React or Solid". However, I've not seen this sentiment shared when it's the other way around with React. It's always "no one got fired for picking React" instead of actually evaluating what will deliver the most value to your users.

hasanhaja··on Things you forgot (or never knew) because of React
What do you mean by:

> Quoting Alex Russel suggests you are more interested in heat than light

I know he's said a lot of harsh things about frameworks like React, Css-in-js, etc, but I've read all of them from the perspective of "these things are hurting the UX a lot more than you think".

hasanhaja··on Things you forgot (or never knew) because of React
+1

Have you been exploring any other technologies since React?

hasanhaja··on Things you forgot (or never knew) because of React
Why would a business want to prioritize the experience of its developers over its users?
hasanhaja··on Things you forgot (or never knew) because of React
Solid as a React alternative, and Astro as a Next.js alternative. SolidStart is pretty cool, but I like the flexibility of Astro
← PreviousPage 3 of 3