loading...

re: Do We Really Need to Separate the Model from the UI? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: So to me this is one of those things that seems unnecessary when an app is small and/or new but eventually you code yourself into a corner and real...
 

Thanks, Mike, for your detailed comment.

Everything you said is valid, but from my experience building a lot of small to medium single-page applications, the "model" in the frontend doesn't contain much business logic.

Since the backend is the source of truth, it has to implement all the business logic, and if there is some logic running in the frontend, it is probably backend logic that we duplicate to make our apps feel more reactive (i.e., optimistic updates).

In my case, since I use JavaScript for both the frontend and the backend, when I need to share some business logic, I implement it into a shared package.

So, in the end, my frontend models are mostly composed of views.

Of course, if my backends were not implemented in JavaScript, or if I was working for Google or Facebook, it would be a completely different story.

Code of Conduct Report abuse