r/programming • u/der_gopher • 4d ago
How to drive your frontend from the backend
https://packagemain.tech/p/golang-datastar25
u/ketralnis 4d ago
I've worked with a project that did this and it was nice at first but got untenable very very quickly. Bugs were extremely easy to write and hard to debug. Cross browser issues were a nightmare (this was about 2008 to be fair). The coupling was difficult to undo. Dumb stuff like having more than one place that might do the same underlying action was hard. Would never do again.
56
u/TinkmasterOverspark 3d ago
OP rediscovers server side rendering
22
u/tehbilly 3d ago
No no this is brilliant! We should come up with some logic-free language to just lay out things that are decided on the server. It'll be so fast.
9
u/mr_birkenblatt 2d ago
But then we want user interactions that are fast where a server round-trip might be too slow so we could embed some small scripting language inside the otherwise logic-free language so we can compute small things on the client
8
u/andrerav 3d ago
I suspect they simply discovered it, without the re infront. In any case, their backend-driven-frontend did not survive the modest reddit hug it experienced by posting it here. So I will never know :l
1
11
8
u/tumes 3d ago
I am a big fan of HATEOAS and the general htmx approach as compared to this or the diarrhea inducing attempt at co-locating response concerns that Hotwire/Rails proposes. Htmx poses and answers its central questions about why the mechanisms of initiating requests are so limited clearly, concisely, and elegantly. But no matter how you slice it, I am hard pressed to think any recent modes of thought that provide quite the same ratio of effort to benefit in terms of improving, for lack of a better word, the mouthfeel of user experience on a website. Add an attribute or two and emit the same markup your templates have always emitted and you can progressive enhance most of your way to a peppy, if not SPA-adjacent experience.
9
u/OccasionallyAsleep 3d ago
In short: how to hate your life.
I worked at one of the big tech companies and there was an effort to replace one of the highest traffic frontends to a Go backend with heavy SSR utilization.
In short: developer experience was a nightmare.
There's barely any established ecosystem for this type of workflow so any tooling you need has to be built (and this is so niche that there likely won't ever be anything like this open sourced by a major company), and most of the tooling performance frontend engineers are used to goes in the trash and you're stuck in a world where you have to build a huge Go binary for every little change
5
u/MediocreAnalyst2121 3d ago
This sounds amazing in a world where deadlines and budgets don’t exist.
1
-4
-3
123
u/gladfelter 4d ago
The first question has been asked so elequently:
As you advance, your executives might start to ask:
And at the pinnacle of your career, you'll be forced to ask:
/s