Comment by Muromec
6 days ago
>Or there were more reasons to it?
Internet was slower in both latency and throughput is one reason. The other is general tendency to separate things into smaller pieces. Faster feedback to user is the third.
Consider a typical form with 10 fields in django. You define the schema on a backend, some validation here and there, a db lookup and form-level rules (if this field is entered, make the other field optional).
This works very welly in django, but you only get the result once you fill all the fields and press enter, at which point the whole thing gets sent through model-tempalte-controller thing and the resulting page is returned over a faulty slow connection. It also hits the database which is not great because SSD is not invented yet and you can't keep the whole thing in RAM or overprovision everything 100x. Containers, docker and devops are not invented yet as well.
So you try to add some javascript into the template and now you have two sets of validators written in two different languages (transpilers are not invented yet) and the frontend part is the ugly one because declarative frameworks like react dont exist, so you add ad-hoc stuff into the template. Eventually everyone gets annoyed by this and invents nice things, so you move the part that was template rendering+form completely to the FE and let two different teams maintain it and communicate through the corporate bureaucracy that tracks the source of truth for validation rules outside of the code.
At some point you notice that people name fields in the json schema in a way that is not consistent and forget the names, so you put even bigger boundary between them with a formal API contract and independent party to approve it (I kid you not, there are places where the API between FE and BE teams is reviewed by a fancy titled person that doesn't deal with either team outside of this occasion).
Eventually you figure out that running the frontend logic on the backend is easier (it's doing the same model-view-whatever patter anyway) than other way around and remove the fence making all the bureaucratic overhead disappear in one clap.
Then somebody finds an RCE in server components.
You are here.
Add: if you want to feel the WEB before SPA, here is a nice example: https://formulieren.amsterdam.nl/TriplEforms/DirectRegelen/f... (bonus points for opening two different forms from site:formulieren.amsterdam.nl in different tabs and clicking through them in parallel)
You still end up separating frontend and backend in full js codebases, but it's not as explicit and can lead to wacky/confusing/unpredictable behavior if you get it wrong. I've never found a perfect solution to the frontend/backend boundary but I've found a mix of declarative container type libraries (pydantic on backend, TypeBox on frontend) with some code generation is a good solution.
I work in a place where it's proper to wait for a month, get the openapi spec thrown over the fence from the backend team and generate my typescript RPC out of it. The upside is I don't get paged at 4 in the morning if the thing gets into a bad mood and starts doing increased 5xx at increased rate.
> Then somebody funds an RCE in server components.
I'd say they found it, but I love the conspiracy theory :D :D :D
Something happened to my brain lately and I started to make this kinds of typos in English, which I didn't before.
I'm 32, but I noticed I started making similar mistakes around 28 or so. Occasionally I write out words which are completely wrong, but sound similar.
It's as if one part of the brain is doing the thinking, and another one is "listening" to it and transcribing/typing it out, making mistakes.
For a little while I was a bit worried, but I then realized nothing else had changed, so I've just gotten used to it and like to jokingly say "I've become so fast at thinking that even I can't keep up!"
2 replies →