<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Thoughts on MVP and WebForms</title>
	<atom:link href="http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/</link>
	<description>Software development, testing, and techie life</description>
	<lastBuildDate>Thu, 08 Mar 2012 22:19:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Chad Myers</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-591</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Tue, 30 Sep 2008 22:24:14 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-591</guid>
		<description>@shmotter:  Ah, yes, good catch. It would indeed be 

interface ISomeView : IView
   Username{ get; }

-c</description>
		<content:encoded><![CDATA[<p>@shmotter:  Ah, yes, good catch. It would indeed be </p>
<p>interface ISomeView : IView<br />
   Username{ get; }</p>
<p>-c</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shmotter</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-590</link>
		<dc:creator>shmotter</dc:creator>
		<pubDate>Tue, 30 Sep 2008 21:33:14 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-590</guid>
		<description>@Chad: Username{ get; set;}

Do you really expose a setter for View&#039;s fields like UserName? From the article I understood that view updates itself in UpdateYourself(UserPreferencesPresentationModel model) method. Keeping in mind that PresentationModal could have some logic, exposing a setter for View&#039;s element could bypass this [ tested ] logic.</description>
		<content:encoded><![CDATA[<p>@Chad: Username{ get; set;}</p>
<p>Do you really expose a setter for View&#8217;s fields like UserName? From the article I understood that view updates itself in UpdateYourself(UserPreferencesPresentationModel model) method. Keeping in mind that PresentationModal could have some logic, exposing a setter for View&#8217;s element could bypass this [ tested ] logic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad Myers</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-589</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Thu, 25 Sep 2008 04:18:50 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-589</guid>
		<description>@shmotter:

There are a few ways, but the one I&#039;ve usually ended up using was to expose properties on the IView interface (i.e. Username{ get; set;})  that the Presenter can grab off its IView reference.</description>
		<content:encoded><![CDATA[<p>@shmotter:</p>
<p>There are a few ways, but the one I&#8217;ve usually ended up using was to expose properties on the IView interface (i.e. Username{ get; set;})  that the Presenter can grab off its IView reference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shmotter</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-588</link>
		<dc:creator>shmotter</dc:creator>
		<pubDate>Wed, 24 Sep 2008 21:51:59 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-588</guid>
		<description>Chad, thanks for the article!
One question, how do you get data back from view? Do you have a method in the view
void UpdatePresentationModel(UserPreferencesPresentationModel model)
{
  model.Username = UsernameTextBox.Text;
  etc...
}

and call this method inside event handlers, like ResetPasswordClicked?

Gary Brunton asked the same thing much earlier in the comments.</description>
		<content:encoded><![CDATA[<p>Chad, thanks for the article!<br />
One question, how do you get data back from view? Do you have a method in the view<br />
void UpdatePresentationModel(UserPreferencesPresentationModel model)<br />
{<br />
  model.Username = UsernameTextBox.Text;<br />
  etc&#8230;<br />
}</p>
<p>and call this method inside event handlers, like ResetPasswordClicked?</p>
<p>Gary Brunton asked the same thing much earlier in the comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Lash</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-587</link>
		<dc:creator>Dan Lash</dc:creator>
		<pubDate>Fri, 19 Sep 2008 15:01:42 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-587</guid>
		<description>Do you think you could extend the example code to show the page handling a post back (like changing the value of something that would have implications on another field). I think you were getting at it with the preferred email type and user wants to be notified, but controller and page code would help complete the picture.

Also could you extend the code to show how the controller would be implemented in terms of business state. I&#039;m curious about state with webforms and what you think a good way to load, maintain/calculate, and save the data. Is it in the controller, is in a business service, is in business entities, etc.

I like the practical example so far!</description>
		<content:encoded><![CDATA[<p>Do you think you could extend the example code to show the page handling a post back (like changing the value of something that would have implications on another field). I think you were getting at it with the preferred email type and user wants to be notified, but controller and page code would help complete the picture.</p>
<p>Also could you extend the code to show how the controller would be implemented in terms of business state. I&#8217;m curious about state with webforms and what you think a good way to load, maintain/calculate, and save the data. Is it in the controller, is in a business service, is in business entities, etc.</p>
<p>I like the practical example so far!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad Myers</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-586</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Thu, 18 Sep 2008 13:42:43 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-586</guid>
		<description>@Igor:

You might also have a few integration tests between the Presenter and the View, but the idea of PM is to limit the interaction between the two.  The view might just expose a bunch of properties (state) so you could just stub it and the view just calls methods on the presenter (Hey! this button was clicked!)</description>
		<content:encoded><![CDATA[<p>@Igor:</p>
<p>You might also have a few integration tests between the Presenter and the View, but the idea of PM is to limit the interaction between the two.  The view might just expose a bunch of properties (state) so you could just stub it and the view just calls methods on the presenter (Hey! this button was clicked!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Brejc</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-585</link>
		<dc:creator>Igor Brejc</dc:creator>
		<pubDate>Thu, 18 Sep 2008 10:47:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-585</guid>
		<description>Chad, thanks. So you&#039;re basically just checking the state of PM all the time and not worry about the interaction with the view. Nice, maybe I&#039;ll try it in the future :)</description>
		<content:encoded><![CDATA[<p>Chad, thanks. So you&#8217;re basically just checking the state of PM all the time and not worry about the interaction with the view. Nice, maybe I&#8217;ll try it in the future :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad Myers</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-584</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Wed, 17 Sep 2008 12:26:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-584</guid>
		<description>@Igor
State-based testing is just regular, non-mocking testing. I.e.:

Assert.IsTrue(_presentationModel.PasswordDisabled);

or (using Scott Bellware&#039;s SpecUnit.NET testing extension methods)

_presentationModel.EditingAllowed.ShouldBeTrue();

A full test might be like this:

[Test]
public void editing_should_be_allowed_after_entering_edit_mode()
{
   var theView = MockRepository.CreateStub&lt;ISomeView&gt;();
   var presenter = new SomePresenter(theView);

   presenter.EnterEditMode();

   presenter.Model.EditingAllowed.ShouldBeTrue();
}


</description>
		<content:encoded><![CDATA[<p>@Igor<br />
State-based testing is just regular, non-mocking testing. I.e.:</p>
<p>Assert.IsTrue(_presentationModel.PasswordDisabled);</p>
<p>or (using Scott Bellware&#8217;s SpecUnit.NET testing extension methods)</p>
<p>_presentationModel.EditingAllowed.ShouldBeTrue();</p>
<p>A full test might be like this:</p>
<p>[Test]<br />
public void editing_should_be_allowed_after_entering_edit_mode()<br />
{<br />
   var theView = MockRepository.CreateStub<isomeview>();<br />
   var presenter = new SomePresenter(theView);</p>
<p>   presenter.EnterEditMode();</p>
<p>   presenter.Model.EditingAllowed.ShouldBeTrue();<br />
}</p>
<p></isomeview></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Brejc</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-583</link>
		<dc:creator>Igor Brejc</dc:creator>
		<pubDate>Wed, 17 Sep 2008 09:59:09 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-583</guid>
		<description>Chad, thanks for the answer. Regarding the state-based testing of presenters: can you please paste some short code snipped that demonstrates it? 
BTW when I referred to mocking, I wasn&#039;t talking about mocking PM, but mocking the presenter&#039;s view interface. PM is not mocked, of course, since it&#039;s supposed to be a pure DTO class.</description>
		<content:encoded><![CDATA[<p>Chad, thanks for the answer. Regarding the state-based testing of presenters: can you please paste some short code snipped that demonstrates it?<br />
BTW when I referred to mocking, I wasn&#8217;t talking about mocking PM, but mocking the presenter&#8217;s view interface. PM is not mocked, of course, since it&#8217;s supposed to be a pure DTO class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad Myers</title>
		<link>http://lostechies.com/chadmyers/2008/08/30/thoughts-on-mvp-and-webforms/#comment-582</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Tue, 16 Sep 2008 13:01:21 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2008/08/29/thoughts-on-mvp-and-webforms.aspx#comment-582</guid>
		<description>@Igor:

(1):  If you&#039;re using WinForms, Can&#039;t you use some of the various data binding options? Aside from that, I don&#039;t think it&#039;s too big of a deal to re-set the values on all the textboxes and such.  You might have to be judicious about when lists or grids are updated in which case you could have a flag or something on the presentation model that lets the view know that there&#039;s new data available and it should rebind.  There are a few options here. No, you don&#039;t HAVE to rebind everything all the time if that&#039;s not appropriate.  There are a few options: Having multiple UpdateYourself() methods that take smaller subsets of the presentation model (PM), Have the ability to compare the previous PM state to the new PM state and produce a difference set of changes.

(2) The point of PM is to make it easier. The PM does not need to be mocked since it is purely state. State-based testing is much easier than mocking/interaction testing and it makes it easier to test the state coming out of the presenter as well as how the view reacts when to new state coming in.</description>
		<content:encoded><![CDATA[<p>@Igor:</p>
<p>(1):  If you&#8217;re using WinForms, Can&#8217;t you use some of the various data binding options? Aside from that, I don&#8217;t think it&#8217;s too big of a deal to re-set the values on all the textboxes and such.  You might have to be judicious about when lists or grids are updated in which case you could have a flag or something on the presentation model that lets the view know that there&#8217;s new data available and it should rebind.  There are a few options here. No, you don&#8217;t HAVE to rebind everything all the time if that&#8217;s not appropriate.  There are a few options: Having multiple UpdateYourself() methods that take smaller subsets of the presentation model (PM), Have the ability to compare the previous PM state to the new PM state and produce a difference set of changes.</p>
<p>(2) The point of PM is to make it easier. The PM does not need to be mocked since it is purely state. State-based testing is much easier than mocking/interaction testing and it makes it easier to test the state coming out of the presenter as well as how the view reacts when to new state coming in.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
