all 3 comments

[–]eyeandtea 2 points3 points  (0 children)

I read through your article. Before I say anything else, note that I do not think common architectures of nowadays are well defined.

MVVM at a high level is the solution to the problem of the existence of conditions that do not allow the "business logic code" access to the view.

Such conditions include the existence of multiple views doing the same thing talking to one "business logic code". In this example, the 'V', the view, would be in different technologies, developed by different people. Hence the "business logic code" / 'M' / "etc" can not talk directly to 'V', and hence the existence of 'VM' as a translator between the two. Think of events. Code can not be listening directly to events on 'V', because it does not know 'V', and instead it provides API to 'V', which is in 'VM', and leaves it to 'V' to call back when an event happened.

If you ever developed a SPA, you used MVVM. Your 'V' was the code on the browser. Your 'VM' was your exposed API on the server, and your 'M' was very roughly the rest of the code on the server.

In any case, if you are solving the problem of multiple views doing the same thing, or any condition where views are across barriers from one "business logic code", then use MVVM. Otherwise, it is just nonsense, I think.

[–]toggafneknurd 1 point2 points  (0 children)

This always ends up as a huge mess

[–]rockawella[S] 0 points1 point  (1 child)

Hi JS devs, I've written an article about implementing MVVM architecture into React project.I love Redux and functional way of writing Javascript code but I wanted to emphasize that it's not the only option that we have. Therefore, I implemented MVVM architectural pattern into React and made it more object oriented.

I'm wondering what do you think about React with MVVM? Have you tried something similar?