DEV Community

Discussion on: Do We Really Need to Separate the Model from the UI?

Collapse
 
mvila profile image
Manuel Vila

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.