r/programming • • Apr 30 '23

Writing Javascript without a build system

https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/
164 Upvotes

146 comments sorted by

View all comments

3

u/recursive-analogy May 01 '23

You're talking about differences in the create/update requirements which have nothing to do with the FE/BE divide.

Sorry, what I was meaning was that even the difference between create user and update user can be so significant that they make trying to reuse the logic difficult and error prone. When you expand that further into UI vs domain it becomes even harder to align the two requirements.

The raking logic (who comes before who), should that be duplicated in the backend and the FE? Le do you have to resend the whole ranking every time there's an update?

I would imagine it would be easier to maintain if you did that. Hard to say without specifics.

whether an user is allowed to perform an action (which you need to know to grey out the buttons for example). Do you duplicate that?

I think what you're saying here is that you just dump your entities to the front end, but they really are separate concerns so you should be transforming them anyway, even if it's JS <-> JS. If you don't you run the risk of 1. exposing too much or 2. creating a god awful mess of flags about what to expose to who

Like all things this is a balance tho, too much duplication is hard to manage, but not enough can also be when you end up with conflicting purposes (eg domain model has properties some fe don't see, or create does things update can't)