by fb03 · 4y ago · 0 comments
I am deeply saddened by the current state of affairs in the web today. in Javascript right now there are so many layers upon layers upon layers of DSLs and mannerisms on top of questionable language features which 'must be used' because the former language features are not cool anymore since a few days ago. The whole ecosystem is turning into a meme of itself.
In a few months someone will reinvent another part of the big clusterfuck again and publish it in a shiny new website and we'll have another 3 month old Javascript framework being touted as the next earth-shattering thing that will revolutionize all things. And again. And again.
We have nice things. We have nice abstractions already. We should be working on toning down and optimizing the good stuff, the good bits that get stuff done, not ramping up on new shiny buttons for each and every edge case out there just because we need to stay on the loop (whatever this loop is).
If you look at what we actually do with the web, it's the same thing we were doing 20 years ago. Click on links, look at pictures of cats, chat with your friends on message boards and instant messenger, send e-mail, buy the occasional thing online, read the news, play games. If you changed none of the software, the result would be the same, but we would have saved a couple trillion dollars (or, alternately, not caused people to fork out a couple trillion dollars).
The only functional change today is much more streaming video, and instead of writing blogs, everyone's recording podcasts (which we had back then as "streaming audio" using IceCast).
JS is the most accessible and distributable code someone can write. It is accompanied for free by a portable, OS-independent UI library with application-tier capabilities that requires no user friction to download.
OF COURSE this construct comes with a ton of bullshit and noob reinventions.
But you, as a software engineer, should have the skillset to pick some strong set of libraries and stand behind it. For me, I use React, React-Router-Dom v5, MobX, TypeScript, and roll my own for everything else. It works well, my code from 2017 that runs without updates is easy to port if I want to because it uses the same underlying libraries, and the browser platform is fairly stable overall.
How does it upset you that you can also do some things in a lower friction way capitalizing on new language features? The old ones didn't go anywhere. The old libraries didn't stop working. Nothing fundamentally changed, some idiots just bolted on some new stuff and some geniuses carefully architected some other new stuff. Why is velocity something to rail against in and of itself? It impacts you exactly how much you let it.
Not that most their languages are inherently better but some have a way of mitigating the problem slightly, like e.g. python's extensive std lib collection.
I had this moment where I thought "well, I need Typescript, because I want nicely typed interfaces and contracts, and I need React". Turns out it's not easy like that. To cobble everything together you need a proper template for webpack. and there's Babel and that also needs to be caressed in the right React-y way. You can't just "hop in". You have to use cookiecutter-styled tools to bootstrap because the whole thing just got so complex so that even a Hello World styled project needs a mindboggling amount of tools all orchestrated and plugged into each other in the right way or it all blows up in your face. Also, there are more than one cookiecutter-styled tools and you have to choose the right one. "But don't fret you can always run eject to see the whole machinery inside".
It's saddening and tiring.
I would tell the exact same story if I was to decide to use Python as backend, just with different technologies. Maybe you just tried to do too much too quick. I can build a Python script, just like you can probably build a JS script, it doesn't means that I can just jump into Django head first like it was nothing. You can't just "hop in", you need to learn each step, and that's fine. The number of times I thought it was as simple as a "pip install"... lost quite a bit of time in various CTF while trying to use some Python scripts. You also can stop at any steps, and that's fine too. I know that HN is good at "THIS IS THE ONLY RIGHT WAY", even this thread if filled with people arguing that "web0" is the "right way", but you know what, the right way is the one that works for you, even if it means that some page will take more time to load, or takes more data transfer, or is missing interactivity, or has a less optimal UX, or can be done faster in another way, or any other downside.
Manually setting up React (with or without TS) isn't all that hard, either.
Manually setting up React isn't all that hard, but it's extra friction you don't need when learning to code React (and probably 999 out of 1000 times using it in anger, either.)
So, yeah, using CRA or another template is generally a good idea.
> Also, there are more than one cookiecutter-styled tools and you have to choose the right one
No, you really don't.
Your first mistake is trying to add typing on a dynamic language that works just fine without types. You won’t really learn the underlying language that well that way, and you therefore won’t have a good understanding of it.
TypeScript makes sense in large projects, with many developers where you need to catch a class of problems that compile time type checking can catch. It doesn’t offer a lot or add much in the way of actually learning the fundamentals of frontend development and is a distraction when viewed through that lens.
Are you sure you weren’t actually avoiding the scary unknowns of actual learning and doing a bunch of busy work to bring familiarity into an otherwise unfamiliar space? I catch myself doing that a lot, especially if I need to learn a completely new language to learn something. I wasted a lot of time trying to make OpenCV work with native JavaScript when I should have just learned enough C++ to get by.
This is honestly a very easy set of questions to answer today.
[0] remix.run
React-Query[0]: You don't need to manage state, let your server manage state just like you do in typical non-js heavy apps.
I recently built a dashboard/reporting site for Neo4j that's completely config driven (delivered from the backend), which can refetch the config (with a gmail style "Settings have changed - Refresh" notification) and have only changed parts of the site update. It has tables with resizeable columns, filtering, search, ordering, virtualization, server side fetch, etc. It has progress charts, bar charts, counts, markdown rendering, json schema rendering. It has inputs that autocomplete, with single or multi-select. It's fully responsive, and works perfectly on desktops, tablets and phones.
If I would have tried to build this three years ago, I wouldn't have been able to do a fraction of these things. So, rant away, but the frontend community is amazing and they deserve way more credit than they get.
Or do you mean that you have to suffer like when you visit websites, like cnn.com: https://i.imgur.com/VAZMUx8.png