Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. History of MVVM

History of MVVM

Scheduled Pinned Locked Moved WPF
wpfcsharparchitecturequestion
11 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I have heard it said WPF was designed with MVVM in mind. Anyone know if this is true? Any documentation to support this? Thanks

    Everything makes sense in someone's mind

    P A 2 Replies Last reply
    0
    • K Kevin Marois

      I have heard it said WPF was designed with MVVM in mind. Anyone know if this is true? Any documentation to support this? Thanks

      Everything makes sense in someone's mind

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      That's not quite right. MVVM was invented by John Gossman to support WPF development, because WPF provided far superior binding capabilities to its predecessors. It's often said that WPF was designed with MVVM in mind, but that is not the case - in fact, John had been working on Avalon for three years before he publicly coined the term Model View ViewModel[^].

      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      C 1 Reply Last reply
      0
      • K Kevin Marois

        I have heard it said WPF was designed with MVVM in mind. Anyone know if this is true? Any documentation to support this? Thanks

        Everything makes sense in someone's mind

        A Offline
        A Offline
        Abhinav S
        wrote on last edited by
        #3

        No this is not true (as per wiki[^]). "MVVM was designed to make use of specific functions in WPF to better facilitate the separation of View layer development from the rest of the pattern by removing virtually all “code-behind” from the View layer."

        1 Reply Last reply
        0
        • P Pete OHanlon

          That's not quite right. MVVM was invented by John Gossman to support WPF development, because WPF provided far superior binding capabilities to its predecessors. It's often said that WPF was designed with MVVM in mind, but that is not the case - in fact, John had been working on Avalon for three years before he publicly coined the term Model View ViewModel[^].

          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

          C Offline
          C Offline
          Colin Eberhardt
          wrote on last edited by
          #4

          Although, the answer does very much depend on what you understand MVVM to mean. The underlying 'essence' of the pattern is rooted in the Presentation Model pattern which Martin Fowler described before the WPF framework was developed. http://martinfowler.com/eaaDev/PresentationModel.html[^] This is something that Gossman openly acknowledges. In my opinion, MVVM is a WPF / Silverlight specific implementation of the Presentation Model, in that the general understanding is that you set your view-model as the DataContext of the view, minimise code-behind and promote design-time data and unit testing. WPF was designed with these concepts very much in mind.

          Colin Eberhardt Twitter | Blog | LinkedIn

          P 1 Reply Last reply
          0
          • C Colin Eberhardt

            Although, the answer does very much depend on what you understand MVVM to mean. The underlying 'essence' of the pattern is rooted in the Presentation Model pattern which Martin Fowler described before the WPF framework was developed. http://martinfowler.com/eaaDev/PresentationModel.html[^] This is something that Gossman openly acknowledges. In my opinion, MVVM is a WPF / Silverlight specific implementation of the Presentation Model, in that the general understanding is that you set your view-model as the DataContext of the view, minimise code-behind and promote design-time data and unit testing. WPF was designed with these concepts very much in mind.

            Colin Eberhardt Twitter | Blog | LinkedIn

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Ahh, time for the Disciples to go forth bringing knowledge to the masses. :-D Indeed, MVVM derives from the Model View Presenter, but it is closely tied to Model View Passive Presenter which Fowler came up with at roughly the same time as John. It was a logical extension of MVP, so there's no real suspicion about the relatively simultaneous independent creation of logically related concepts.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

            C 1 Reply Last reply
            0
            • P Pete OHanlon

              Ahh, time for the Disciples to go forth bringing knowledge to the masses. :-D Indeed, MVVM derives from the Model View Presenter, but it is closely tied to Model View Passive Presenter which Fowler came up with at roughly the same time as John. It was a logical extension of MVP, so there's no real suspicion about the relatively simultaneous independent creation of logically related concepts.

              *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

              C Offline
              C Offline
              Colin Eberhardt
              wrote on last edited by
              #6

              Indeed. What Pete said! It's all MV-Poo However, I do get very annoyed when people take the conceptually simple and elegant MVVM pattern and extend it into something that is much harder to comprehend. Does anyone really need the Model-View-Presenter-ViewModel (MVPVM) pattern? http://msdn.microsoft.com/en-us/magazine/hh580734.aspx[^] Admittedly, I haven;t read the article - so maybe I am a bit hasty in judging. However, what I really like about MVVM is that I can explain it to any competent developer within about 5 mins and know that they will follow it correctly. The same cannot be said for 'classic' MVC pattern.

              Colin Eberhardt Twitter | Blog | LinkedIn

              P 1 Reply Last reply
              0
              • C Colin Eberhardt

                Indeed. What Pete said! It's all MV-Poo However, I do get very annoyed when people take the conceptually simple and elegant MVVM pattern and extend it into something that is much harder to comprehend. Does anyone really need the Model-View-Presenter-ViewModel (MVPVM) pattern? http://msdn.microsoft.com/en-us/magazine/hh580734.aspx[^] Admittedly, I haven;t read the article - so maybe I am a bit hasty in judging. However, what I really like about MVVM is that I can explain it to any competent developer within about 5 mins and know that they will follow it correctly. The same cannot be said for 'classic' MVC pattern.

                Colin Eberhardt Twitter | Blog | LinkedIn

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                Indeed, you're right. MVVM is a simple concept - granted there are subtleties, but these are implementation subtleties and nothing to do with the underlying pattern. What annoys me is when people heap all sorts of different patterns on top and then say, "this is MVVM". For instance, although we all use Mediators or Messengers, they are nothing to do with MVVM - they are merely a way to help communicate between separated concerns. Similarly, when people say that MVVM is DI or IoC, again, these are just other techniques to help - they aren't MVVM. Properly applied, they help make better code, but they are not part of the core MVVM concept. Possibly my biggest bugbear is when people think that MVVM means that you have to remove ALL code behind. That's just plain errant nonsense. If you want to trigger an animation just because your window is closing then, by all means, trigger it from code behind. Ah well, we're just rehashing old ground here.

                *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                C S 2 Replies Last reply
                0
                • P Pete OHanlon

                  Indeed, you're right. MVVM is a simple concept - granted there are subtleties, but these are implementation subtleties and nothing to do with the underlying pattern. What annoys me is when people heap all sorts of different patterns on top and then say, "this is MVVM". For instance, although we all use Mediators or Messengers, they are nothing to do with MVVM - they are merely a way to help communicate between separated concerns. Similarly, when people say that MVVM is DI or IoC, again, these are just other techniques to help - they aren't MVVM. Properly applied, they help make better code, but they are not part of the core MVVM concept. Possibly my biggest bugbear is when people think that MVVM means that you have to remove ALL code behind. That's just plain errant nonsense. If you want to trigger an animation just because your window is closing then, by all means, trigger it from code behind. Ah well, we're just rehashing old ground here.

                  *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                  "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                  My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                  C Offline
                  C Offline
                  Colin Eberhardt
                  wrote on last edited by
                  #8

                  Aye, old ground indeed. But we can re-tread that ground with fond memories. Must be my round? :java: (where's the beer icon?) While you're here, what do you think of this: http://www.codeproject.com/Messages/4185399/Comments-on-specific-article-revisions-equals-wron.aspx[^] Has anyone else complained about this yet?

                  Colin Eberhardt Twitter | Blog | LinkedIn

                  P 1 Reply Last reply
                  0
                  • C Colin Eberhardt

                    Aye, old ground indeed. But we can re-tread that ground with fond memories. Must be my round? :java: (where's the beer icon?) While you're here, what do you think of this: http://www.codeproject.com/Messages/4185399/Comments-on-specific-article-revisions-equals-wron.aspx[^] Has anyone else complained about this yet?

                    Colin Eberhardt Twitter | Blog | LinkedIn

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    I don't like it. Messages are getting lost this way.

                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                    1 Reply Last reply
                    0
                    • P Pete OHanlon

                      Indeed, you're right. MVVM is a simple concept - granted there are subtleties, but these are implementation subtleties and nothing to do with the underlying pattern. What annoys me is when people heap all sorts of different patterns on top and then say, "this is MVVM". For instance, although we all use Mediators or Messengers, they are nothing to do with MVVM - they are merely a way to help communicate between separated concerns. Similarly, when people say that MVVM is DI or IoC, again, these are just other techniques to help - they aren't MVVM. Properly applied, they help make better code, but they are not part of the core MVVM concept. Possibly my biggest bugbear is when people think that MVVM means that you have to remove ALL code behind. That's just plain errant nonsense. If you want to trigger an animation just because your window is closing then, by all means, trigger it from code behind. Ah well, we're just rehashing old ground here.

                      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                      S Offline
                      S Offline
                      SledgeHammer01
                      wrote on last edited by
                      #10

                      Pete O'Hanlon wrote:

                      Possibly my biggest bugbear is when people think that MVVM means that you have to remove ALL code behind. That's just plain errant nonsense. If you want to trigger an animation just because your window is closing then, by all means, trigger it from code behind.

                      I know this was just an example, but this is definitely something that can be done entirely in XAML. I'm one of those guys that self enforce the no code-behind rule :). So far, I haven't found a need to have code behind. There are plenty of MVVM tricks to get around the need... if you are writing a lot of code behind, you should probably repackage it in a nice MVVM friendly UserControl or something of that sort. If you start allowing code behind, it gets hard to draw the line... you end up with a lot of "I was feeling lazy that day, so I'm going to throw it in the code behind and move it later" -- which never happens. Plus, you end up with your logic split across two .cs files :)

                      P 1 Reply Last reply
                      0
                      • S SledgeHammer01

                        Pete O'Hanlon wrote:

                        Possibly my biggest bugbear is when people think that MVVM means that you have to remove ALL code behind. That's just plain errant nonsense. If you want to trigger an animation just because your window is closing then, by all means, trigger it from code behind.

                        I know this was just an example, but this is definitely something that can be done entirely in XAML. I'm one of those guys that self enforce the no code-behind rule :). So far, I haven't found a need to have code behind. There are plenty of MVVM tricks to get around the need... if you are writing a lot of code behind, you should probably repackage it in a nice MVVM friendly UserControl or something of that sort. If you start allowing code behind, it gets hard to draw the line... you end up with a lot of "I was feeling lazy that day, so I'm going to throw it in the code behind and move it later" -- which never happens. Plus, you end up with your logic split across two .cs files :)

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #11

                        You're right, there are lots of MVVM tricks that can be used to remove all the code behind. But at what point does it become too much? Each additional thing you put in place becomes yet something between you wanting to do something and actually doing it, and each bit takes that bit extra time. I am all in favour of removing unnecessary code behind, but when it becomes dogmatic then you have gone too far.

                        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups