Page 2 of 3

Re: Resultset total count - simple question

Posted: Thu Sep 16, 2010 1:14 pm
by VladSun
josh wrote:What framework do you guys use?
CodeIgniter together with ExtJS.
josh wrote:Also just a friendly request, please try to post less "fluff". ("I agree"), on some forums they have rules against that. It makes the thread impossible to read when you quote a paragraph of text just to add, "indeed", and nothing more.
I had to agree with you in order to clear myself.

Re: Resultset total count - simple question

Posted: Thu Sep 16, 2010 2:45 pm
by alex.barylski
Yeah almost any literature I've read about MVC, the view observes the model. That way when the model decides to update itself (maybe in a multi-threaded environment, some other process has a reference to our model and updates it) - the view should update too. This is unnecessary in web but I still think the dependencies should be the same.
That is exactly what causes so much confusion. Passive View is not MVC but a derivative, yet most people call what they are doing MVC when in reality it's often Passive View. I'm guilty of that myself, Passive View does not have the same buzz as MVC. :P

In most instances passive view works well for web applications, except when you start building complex layouts/composite views, or reusable controls/components like pagers, etc.
on some forums they have rules against that. It makes the thread impossible to read when you quote a paragraph of text just to add, "indeed", and nothing more.
I admit I find it irritating myself, but forums are one half technical discussion and one half social network. I like VladSun, he's been very helpful to me and never distasteful in reply. He's sort of like a buddy I have never met. :P Quoting totally out of context only to say "agreed" or "indeed" is my (and most social people) way of saying, "I hear ya bro" just friendly banter with a fellow developer I respect.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Fri Sep 17, 2010 8:43 am
by josh
PCSpectra wrote: Passive View is not MVC but a derivative,
Why is passive MVC 'less MVC' than active MVC? Why would you say MVC only works well until you need to paginate? That made no sense to me...

Re: Resultset total count - simple question

Posted: Sat Sep 18, 2010 2:28 pm
by alex.barylski
I had a long reply explaining my paging statement and browser choked on me. :banghead:

Anyways, I don't believe I said passive view is 'less MVC'. Passivie View or classical MVC are both MVC, the seperation of concerns are the same (Model-View-Controller) but the dependencies and interaction between each component in the triad is what differentiates both patterns.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Sat Sep 18, 2010 3:48 pm
by josh
I think the distinction is stupid. The pattern says "the controller takes user input, manipulates the model, and causes the view to update appropriately" [POEAA].

Having the views "observe" the model was an extension to classical MVC, thus in my opinion "passive view" *is* the original MVC.

Re: Resultset total count - simple question

Posted: Sat Sep 18, 2010 4:16 pm
by alex.barylski
Having the views "observe" the model was an extension to classical MVC, thus in my opinion "passive view" *is* the original MVC
I don't think so, but I guess were at odds. Classical MVC was documented years before and the interactions between components is complex, or at least more than passive view.

Passive view was discovered years later, as a derivative to classical MVC due to the simplicity of web applications and the environment (request/response). Web applications until recently, were usually implemented as actions with a single model/view per HTTP request. Compared to desktop applications, that consist of complex views, or perhaps more appropriately layouts.

Passive view didnt' need the dependency interaction that classical MVC did, simply because the end user interaction isn't real time, or event based. The the popularity of AJAX this is changing the rules yet again, but most web apps generate a single view and changing the model requires another HTTP request and page refresh. So it makes sense to have the controller query the model, take the results and pass that to the view for rendering and echo'ed.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Sat Sep 18, 2010 4:34 pm
by Eran
Passive View is not MVC
Passive-view MVC or whatever you want to call it, is still MVC. Notice Alex, that you specifically declared it as not MVC - which is misleading. It is also not a derivative, since MVC is a pattern and you are talking about differences in implementation. The pattern does not enforce either way of doing things.

Re: Resultset total count - simple question

Posted: Sat Sep 18, 2010 5:04 pm
by josh
PCSpectra wrote:Passive view didnt' need the dependency interaction that classical MVC did, simply because the end user interaction isn't real time, or event based.
1) "dependency interaction" The important dependency is the model not depending on the view. Passive vs Active has absolutely nothing to do with that
2) the reason they introduced the concept of views observing the model, was more than one view needing to be updated, and views needing to be updated between user actions. In classic MVC the user clicked a button, and a controller "responds" to their action by updating a model and/or updating a view directly. Adding the 'observer' pattern is usually done so that more than one view can be updated when the model changes (between user actions).

Re: Resultset total count - simple question

Posted: Sun Sep 19, 2010 2:39 pm
by alex.barylski
Passive-view MVC or whatever you want to call it, is still MVC. Notice Alex, that you specifically declared it as not MVC - which is misleading. It is also not a derivative, since MVC is a pattern and you are talking about differences in implementation. The pattern does not enforce either way of doing things.
I agree it's misleading, and I believe I tried to clarify later by stating it's the seperation of concerns (model-view-controller) that are important (thus lumping passivie view/classical MVC into a single generic pattern with differing dependencies/interaction). However, I think, calling passivie view, MVC is like calling a Ford a Toyota, when really the similarities stop at "car". That is the reason I tried to disambiguate the two by refering to one as classical MVC and passivie view.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Sun Sep 19, 2010 4:24 pm
by josh
If you're still going to keep claiming they are distinct patterns could you at least highlight the differences that you see? Like I said the important dependency in almost any definition of MVC is the model should not depend on the presentation. (not so much as an important dependency, but a forbidden dependency).

I don't see how letting a view be an 'observer' of the model changes anything or breaks the definition of the original 'MVC' pattern. Maybe you could explain to us why you choose to interpret the patterns in this way (which contradicts with lots of literature I've read)

You are implying you can list lots of differences, can you do so for us? (stating that passive uses observer pattern and "classic" does not is a given, and is the only difference we will probably agree on)

Re: Resultset total count - simple question

Posted: Mon Sep 20, 2010 10:39 am
by alex.barylski
Passive-view MVC or whatever you want to call it, is still MVC. Notice Alex, that you specifically declared it as not MVC - which is misleading. It is also not a derivative, since MVC is a pattern and you are talking about differences in implementation. The pattern does not enforce either way of doing things.
http://martinfowler.com/eaaDev/PassiveScreen.html

pytrin: I have to disagree with you about that one sentance. MVC is the commmon buzzword and everyone uses it. Passive view is a variation or derivative considering it's not identical to MVC in terms of interaction (only in SoC), just as MVP is slightly different but they should not be called MVC -- otherwise wide spread confusion will continue to propagate). I'm also not talking about difference in implementation, I am talking about the interactions of each component in the MVC triad.
If you're still going to keep claiming they are distinct patterns could you at least highlight the differences that you see?
The difference are the dependencies and their interactions, I have stated this several times:

Classical MVC:

Image

Passive View:

Image
Like I said the important dependency in almost any definition of MVC is the model should not depend on the presentation. (not so much as an important dependency, but a

forbidden dependency).
In passive view, the model and view have no dependency on each other, or the controller. The controller creates the model, queries it, and creates the view and initializes it with the data required for display. The if the view used the model directly, would there not be a solid/dotted line indicating a indirect/direct association just as the classical MVC diagram clearly shows?
I don't see how letting a view be an 'observer' of the model changes anything or breaks the definition of the original 'MVC' pattern.


Where did I say it breaks the original MVC pattern? It does however introduce an observer to the mix, which passive view doesn't have.
Maybe you could explain to us why you choose to interpret the patterns in this way (which contradicts with lots of literature I've read)
Maybe it is your interpretation of the literature that is incorrect?

Passive view has three components (Model-View-Controller) just as MVC but as the diagrams above should clearly

demonstrate, the interaction between components (and thus dependencies, etc) are slightly different, and by different I mean minimized, as both classical MVC and passive view the

controller have direct knowledge of the model and view, that is where passive view stops and classical MVC continues with additional direct and indirect associations via observers.

To call them both MVC would clearly cause confusion (look at this discussion), additionally why would Fowler introduce the term passive view and just call it MVC?
You are implying you can list lots of differences, can you do so for us? (stating that passive uses observer pattern and "classic" does not is a given, and is the only

difference we will probably agree on
)
Oddly you use the term "can you do so for us" and "we will probably agree on". Hardly anyone else has participated in this discussion, where is all your support coming from exactly?

Also I never stated "passive view uses observer pattern and 'classic' does not is a given". Actually, that is the complete opposite of the truth, so I hope no one agrees with. Classical MVC uses observers Passive View doesn't need too.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Mon Sep 20, 2010 11:07 am
by alex.barylski
In short (pytrin) I think how I interpret each, is as follows:

Both are properly called MVC, simply because of the seperation of concerns, each has the same triad of components, each with the same responsibilities, however, how those components interact is (IMO) clearly documented by the pattern diagrams and therefore should not similarly be called MVC as it results in a lot of confusion and endless discussion.

Passive view is a simpler implementation (in terms of interaction) than classical MVC. If this is what you initially meant by implementaion earlier, I misunderstood you and you are indeed correct. I thought you meant implementaiton details of the model (ie: Whether a TDG was used over a web service).

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Mon Sep 20, 2010 12:05 pm
by Eran
Passive view is a simpler implementation (in terms of interaction) than classical MVC. If this is what you initially meant by implementaion earlier, I misunderstood you and you are indeed correct. I thought you meant implementaiton details of the model (ie: Whether a TDG was used over a web service).
Yes, this is what I meant. It is an implementation of the MVC pattern, which differs in some ways from other MVC implementations.

Re: Resultset total count - simple question

Posted: Mon Sep 20, 2010 12:59 pm
by alex.barylski
Yes, this is what I meant. It is an implementation of the MVC pattern, which differs in some ways from other MVC implementations.
OK but do you not feel, that refering to both as MVC is something of a misnomer, as the interactions, are dictated by the pattern(s) themselves, at least in the diagrams I have seen. What it doesn't dictate, perhaps, is that the controller in classical MVC *must* use a service locator to instantiate the model, or that the view creates the model and exposes to the controller via a getModel() method. Or that the molde should be injected into the Model, to me those are the implementation details.

I interpret those lines as interaction details, and I guess I see interaction as I do interface, so not heavily in favor of calling them implementation details, even though, I can understand the perspective of others, that might consider them implementation details. Technically speaking, in the context of programming, they are indeed implementation details. I prefer to see interaction details as a hybrid of implementation and interface, as confusing as that may be to some.

It's clear to me, that passive view does not have or need the same interaction between components of the MVC triad, as does classical MVC. Hence my arguing they are two different patterns, although very much alike, MVC is classical MVC in all but a few articles, books I have read. Passive view on the other hand, is almost always touted as MVC, because that is how the author interpreted it. MVC in this sense is a misnomer, as it applies to two distinct patterns. Distinct in the sense, to say they are identical would be incorrect. The share a common ancestry, MVC, in fact passive view stems from MVC but with some of the interactions dropped in favor of a simpler setup.

Cheers,
Alex

Re: Resultset total count - simple question

Posted: Mon Sep 20, 2010 8:13 pm
by josh
Alex, you linked us to passive MVP, not passive MVC. According to that article, passive MVP doesn't even use observers. Of course that pattern is not MVC. I thought we were talking about "MVC with observers", not MVP.

http://en.wikipedia.org/wiki/Model-view-presenter
PCSpectra wrote:Both are properly called MVC,
Nope, MVP is a derivative of MVC. I don't know much about these patterns but its pretty apparent all of us are talking about different things. In addition, that article you linked is labeled a "work in progress". Perhaps you shouldn't be referencing it yet. The terms are still ambiguous.

The confusion comes because people make a distinction between "active" & "passive" MVC. "passive view" makes it sound like we are talking about MVC, not MVP. I would say Martin Fowler is in the wrong for naming the patterns that way, but in all fairness, he did put the disclaimer that its a work in development.

I can affirmatively say, passive and active MVC would both have the little dotted line from the view to the model. Thats because there's really no such thing as "passive" and "active" MVC, they're both implementing the MVC pattern. The MVC pattern gives you the choice to use observers, or not.

Thanks for helping us get to the bottom of the misunderstanding. It improves all of our understandings.