Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
The more I read about MVC, MVP, MVVM, etc., the more I think that no-one really knows what any of these patterns are.
I think I use MVCVM. -
duckWit56165yModel is the data, View is the UI displaying the model, and the ViewModel is the brains of business logic that facilitates between the two just like a controller but with a different name.
-
inaba45895y@duckWit Actually it's quite different than a controller. A viewmodel dictates how the view behaves which can be done through, amongs other things, binding data and displaying that and doing shit with methods that can be called with buttons, and stuff. Take this additionator for a MVVM (without the model) example https://jsfiddle.net/aug7k9rw/. Here the viewmodel binds a, b, and c in order to do something with them (the calculate method).
A controller on the other hand makes sure that data gets send to the view so that the view can display it according to its rules. Here you would supply the controller with a and b which it would then use to calculate c and then send a model containing a, b, and c to the view for it to render.
Or put simpler, in MVVM the view is already rendered but you change the data whereas in MVC you render the view with the new data. -
inaba45895y@platypus In second semester (like a year ago) we were taught about PCMEF. PCMEF is something that, when you google the first result is the Czech wikipedia page
-
duckWit56165y@inaba I understand your point. To a degree I feel we might be splitting hairs. I should have said "similar to" a controller. They do share some of the same responsibilities. In old AngularJS as an example, their definition and purpose of a controller is almost identical to that of a ViewModel. Even if we're talking about an API controller, I still say a lot of the responsibilities are similar.
-
inaba45895y@duckWit I had no idea what a controller was in old angular so I just looked it up and it looks like it's just what they call their viewmodel. It's definitely not a controller in the MVC sense
@rant1ng It is because you use a viemodel (the class returned in <script>) in order to give functionality to the view (the <template>)
Related Rants
If you could explain mvvm to me in what sentence. How would you explain it?
question
programming
design patterns
c#