ForumTechnical Corner ► Web Development!
Don't see any active threads on web development in this section so thought I'd start one myself. Would love to see your projects, tips, hot takes, etc.! :)

I'll start: I think that "frontend frameworks" and any other hipster garbage spawned from NodeJS are all made by people who essentially want to get a real developer's salary, without actually being a real developer.

The simplest way I can prove this is this bullshit.

One of the simplest fucking jobs ever in pretty much any programming language - literally just checking for a remainder - and these idiots need a whole goddamn library for it? I would just pass it off as something kind of funny if it weren't for the fact that this has ALMOST 500k WEEKLY DOWNLOADS!? Are they stupid?

The stars of the show here are frontend frameworks (eugh). Here are my issues with them:
  • A lot of them looove to overcomplicate and convolute themselves because it makes these "developers" feel like a #EPIC1337H4X0R! This also ends up affecting full stack devs, as they have to focus on all of this on top of their backend. Seriously, just take a look at React and you'll see what I mean.
  • They force you to download a couple more megabytes of JavaScript files just to load the page, which is pointless and bloaty.
  • They put all the trust in the client (the browser) to render out content. I thought one of the biggest rules when it comes to networking and such was to never put too much trust into the client, was it not?

These frameworks pretty much summarise a lot of my gripes with NodeJS/JavaScript, on top of the fact that the languages themselves can be very odd sometimes - look at DOM manipulation with JavaScript for example, or try this in your browser's console:

("ba"+NaN+"a").toLowerCase();


You are probably asking now, "how do I add reactivity & interactivity without a frontend framework" or "what am I supposed to use instead?".

For frontend interactivity, use HTMX and HyperScript. They make interactivity a breeze, no more Backend -> JSON -> Browser crap, just Backend -> Browser with HTMX, and no more ogrish functions and syntax just to handle simple events like changing the position of a container based off of mouse positioning with HyperScript. By the way, here's an example of how easy and concise that is:

on mousemove set #container's *top to ((body's clientHeight - (event's clientY * 2)) / 100)px
then set #container's *left to ((body's clientWidth - (event's clientX * 2)) / 100)px


Their syntax is amazing (especially HyperScript, it's almost like spoken English) and feels right at home with your HTML code.

For the backend, I use Go and Fiber with MySQL or MongoDB, as they're all concise and easy to use tools that pair up really well with eachother. And, obviously, Go was designed with web backends in mind, so it only makes sense to be using it for a backend.

I end off this rant with a quote from the troubled but great Terry Davis:
"An idiot admires complexity, a genius admires simplicity."
  
Just use preact and htm, it looks so much nicer

also, https://www.ravbug.com/npm-drinking-game/
  
I'm going to be contrary here:

Yeah, is-odd is a pretty silly package. However, it does safely handle non-integers, and negative and very large integers, which the naive implementation in javascript wouldn't.
I don't think that it's really worth the supply-chain risk, but it does do more than (return n%2==1).

And yeah, React is complicated. A lot of these very large javascript frameworks are built by Facebook et al, to solve the problems that come up when you're a giant company building a giant website. As the site grows and the team grows, the added structure brought by React help with refactoring, reusability, design changes, etc. The JS download sucks the first time, but in practice is cached for most visits.

"Not trusting the client" is about protecting your data, not about distrusting the client to render a UI. As long as you build a reasonable site, the trust concerns are pretty much exactly the same with a single-page-app as an old-fashioned server-rendered site.

HTMX (and to a lesser extent Hyperscript) looks cool, if you don't need the flexibility that the big JS frameworks bring you, which most people don't. And to be honest, if you are writing a small site, you probably don't need to use a fast language like Go either.
  
aprzn123 said:
Just use preact and htm, it looks so much nicer

Took a quick look at it, does seem to be a lot less fiddly than React. Will have to toy around with it later, but it definitely is interesting.
Fwip said:
"Not trusting the client" is about protecting your data, not about distrusting the client to render a UI.

I realise that misconception now, guess I shouldn't take things so so seriously all the time, xD
Fwip said:
And to be honest, if you are writing a small site, you probably don't need to use a fast language like Go either.

The main reason I like Go is because of how simple and easy it is to work with, most things in Go just make sense to me. Not sure how to describe it better, it's just personal preference really.
  
Realise I might have come across as hasty with that rant, truth be told is that I was kinda pissed off with something else at the time so I kinda just let it all out onto here. My bad.
  
Oh, no worries. :)
  
Forum > Technical Corner > Web Development!