Timeline for How do I set up MVP for a Winforms solution?
Current License: CC BY-SA 2.5
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 16, 2011 at 11:20 | vote | accept | JonWillis | ||
| Feb 14, 2011 at 17:34 | comment | added | Walter | @Jon - Your variations are all pretty much in keeping with the spirit of MVP. As far as working with interfaces or concrete types, it's going to depend on the circumstances of the app. If the app is fairly small, not very complex, then perhaps adding interfaces isn't necessary. I like to keep things as simple as possible, until it's quite clear that the app absolutely needs to implement X architecture. See this answer for more detail: programmers.stackexchange.com/questions/34547/… | |
| Feb 14, 2011 at 15:12 | comment | added | JonWillis | thanks for the advice. I remember learning MVC at university. Sounded great but with a blank canvas you wonder where to start and how it really works. In terms of MVP being wrong, I mean were any of the ideas/varitions of MVC I posted above the wrong way of doing it, i.e. when the view knows how the presenter works. Or should the view have a reference to an interface of a presenter or concrete type etc. Just many different variations which can all work for the same purpose. | |
| Feb 14, 2011 at 14:10 | comment | added | Walter | @Jon - Ways MVP are wrong? In my book it would be when the view knows about the presenter. It may not be "wrong" in the sense that it works but it just wouldn't be MVP, it's morphed into something else at that point. The problem with design patterns is that the examples are always as clean and simple as possible. Then when you go to implement them for the first time and the real world jumps up and says 'hey real apps are way more complicated than that puny example.' That's where your growth begins. Find what works for you and the app's circumstances. | |
| Feb 14, 2011 at 13:46 | comment | added | JonWillis | I would agree with all effort going to simplify the view to justify it not being unit tested, then the presenter should have control. My only concern with this (thinking in my head so could be wrong) is that say winforms/usercontrols may need to be linked to parent elements and wondered if additional logic is needed in a presenter to write it up. | |
| Feb 14, 2011 at 13:42 | comment | added | JonWillis | Maybe the question I should ask are any of the ways to use MVP just plain wrong. I would agree with variations suit different scenarios, but feel there should be a generally accepted approach. The examples of MVP are all simple examples and nearly all with the same need, to edit a domain object and save changes. Yet from those examples with the same objective the above variations have been produced. I have just coded part of an app using events fired in the view to be handled in the presenter but I could have had the view hold a reference to the presenter and directly call methods. | |
| Feb 14, 2011 at 13:07 | history | answered | Walter | CC BY-SA 2.5 |