dalgard / meteor-viewmodel

Minimalist VM for Meteor
24 stars 2 forks source link

What is a Viewmodel? #8

Closed dillongreen closed 8 years ago

dillongreen commented 8 years ago

I think what's still missing is a sketch and a few lines Intro about what a Viewmodel actually is and how it differs from Meteor's standard way of doing things.

One sketch I found that might be elgible for that http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/1thedifferencebetweenmodelviewviewmodela_EC9E/image_5.png

dalgard commented 8 years ago

Good point. I've had the same thought, in passing, but didn't want to fill up the docs needlessly.

I'll look into writing a short intro, though, with the situations where a viewmodel might come in handy – and maybe the situations where it doesn't help at all ;) Thanks for the link.

dillongreen commented 8 years ago

Great! Imo it's a concept still unknown to many many people and a few lines at the top will keep a novice to viewmodels interested and he'll read on rather than leaving after 10sec or so simple because he has no idea of the potential/usefulness.

dalgard commented 8 years ago

Could you give me your feedback on this intro section that I've added to the docs? https://github.com/dalgard/meteor-viewmodel#intro

I'd like to have kept it shorter, but it's not easy :) A diagram is always nice, but most of them become quite abstract and compare the pattern to other patterns, and I don't think anything is gained by that.

dillongreen commented 8 years ago

This is a great and concise explanation, you even laid out your motivation behind the project which I think is also really good as it shows your train of thought.

However, I think, and please forgive my honesty: this is an explanation and it is excellent as it is. It should stay, stay as is. The thing before it, one abstraction layer higher, the intro for the total novice, 3 or so lines plus one sketch is something I'd still add. I am totally not saying the sketch I found is the right one, I think one that's just showing the classical MVC side by side with viewmodel is what we need.

Let me explain why I make this distinction: Few days ago I showed our CIO the possible viewmodel packages in the meteor world... he totally didn't understand what we were talking about. He's quite a technical guy, last programmed over 15 years ago, no chance, he didn't understand. Only after I showed him a sketch... all of a sudden: "A sure, I know..." MVC he knew, something he had seen in his past. Because of that he could roughly understand the difference. Long story short, he greenlighted the switch to viewmodel. The sketch made the difference. Humans are graphical beasts after all :)

Summary: let's do a s/Intro/Explanation and add a Intro at the top with 2-4 lines and one sketch of MVC vs ViewModel.

dalgard commented 8 years ago

I appreciate your help :+1:

It's only that I'm still not sure what to actually write for such an intro – could you maybe give me, like, any two sentences that would point me in the direction of what you mean?

The problem with comparing MVC and MVVM is, in my view, that it's not clear at all for any novice how Meteor is MVC – as illustrated by this thread in the forums:

https://forums.meteor.com/t/help-me-understand-mvc-implementation-in-a-nutshell-for-meteor/9448/

dillongreen commented 8 years ago

Sure, from https://msdn.microsoft.com/en-us/magazine/dn463786.aspx I'd take those two sketches:

https://i-msdn.sec.s-msft.com/dynimg/IC690874.png https://i-msdn.sec.s-msft.com/dynimg/IC690873.png

Then I'd say:

The MVC pattern that's currently standard in Meteor has

Viemodel, a so-called MVVM pattern, is a more recent variant of MVC

Aside the great benefit of two-way binding there are more benefits MVVC has over MVC: https://www.meteorcasts.net/ep/6

dalgard commented 8 years ago

I understand what you mean. The MeteorCast is nice, I might include that one. I like the figures, too, but I have a lot of doubts as to how many people they would benefit.

They certainly wouldn't help complete novices in programming that are trying out Meteor as their first framework – rather, they might serve to confuse that group.

For the group of developers that actually totally get the pattern, the figures might make things more complicated than necessary and, as a result, impart some concern in people.

There may exist a large middle group, but I think that only a small minority of Meteor developers have actually thought enough about how Meteor is MVC to understand the explanation.

You may have noticed that I don't mention MVVM anywhere in the docs, because dalgard:viewmodel is in fact not an MVVM framework, it's a simple viewmodel library – the rest is still up to Meteor.

I do appreciate that the diagrams helped you and your boss, it's worth taking into consideration. But I wonder whether other developers wouldn't be better helped with the intuitive approach brought about by reading the examples.

I'll leave this issue open and give it some thought...

dalgard commented 8 years ago

I'm going to wait until I've had more experience with people's understanding of the library, slash, lack of understanding. Or until the perfect diagram comes along.