Hacker News new | ask | show | jobs
by jagged-chisel 15 days ago
What does the binding look like in source code?

Do we hand-code every UI field with the code that updates the local model and then transmits it to the backend?

Or is there a way to make the boilerplate as small as possible, relying on one bit of code to handle synchronization between UI, local model, and server?

“Using WebSockets” doesn’t bind an interface element to its source of truth; it’s just the chosen transport to move the data. I’ll be sticking with a RESTy interface. But that doesn’t matter because the question is how is the binding implemented so that fewer mistakes are made synchronizing the data?

Hand coding every field’s binding logic is going to be error-prone.

1 comments

You are so thinking about this only from a framework perspective, as if you have no imagination. You can answer all your questions yourself by simply writing the code without a framework. Its not that scary.

It is as simple as I am suggesting, but only if you have actually done it yourself more than once. Whether or not your application is error prone is entirely on how you execute regardless of the tools in your toolbox.

And you completely avoided answering the questions I asked. If you don’t know or understand, say so. Don’t act like an LLM that has to keep talking even when you don’t know.
It sounds like you would prefer if I just write some code for you instead of doing it yourself. I don't mine doing that. I am willing to advise you with a consultation fee.
So you have no idiom in vanilla JS for this. You just rewrite the boilerplate on every field. Any coder can do that. Do you have a proper abstraction for this or is it just "hurr write the code"?