Wrox Programmer Forums
|
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2010, 02:44 AM
Authorized User
 
Join Date: Jan 2006
Posts: 13
Thanks: 6
Thanked 1 Time in 1 Post
Default MVP pattern IxxxView question

Hi Scott,

I am reading the MVP pattern section of Ch. 8, and I am wondering the following:

Why do you create a view interface (IxxxView) that has properties that in the implementation only sets some value? Why not just create methods? e.g.

In ProductDetail.aspx.cs, you have

publicdecimal Price
{
set { this.litPrice.Text = String.Format("{0:C}", value); }
}

Why not create a method and its interface named SetPrice which does the same thing (setting litPrice.Text value).

It seems more appropriate to use methods instead of write-only properties for this page (and other pages in this MVP project).
 
Old November 25th, 2010, 04:03 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi SamVan,

I guess its personal preference, so by all means use methods if you feel it conveys better to the calling code.

Cheers
Scott
 
Old November 25th, 2010, 10:25 AM
Registered User
 
Join Date: Nov 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

In case you are interested, I ahve been having a discussion with Scott on this very subject in the ASP.NET forums. Please have a look at Confused about architecture - n-tier, MVC, MVP, etc? Please help a newbie! and see if it helps. We haven't reached any conclusion (yet), but I just posted back a reply and am hoping Scott will be able to explain.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Invite: Chat About Microsoft Office and Windows with Microsoft MVP Experts HiTechCoach Access 0 October 13th, 2010 05:11 PM
Microsoft MVP Donald Belcham to Speak on Live Mesh Shaguf ASP.NET 3.5 Professionals 0 December 5th, 2008 06:11 AM
DirectoryInfo.GetFiles(pattern): search pattern fo arif_1947 VS.NET 2002/2003 1 October 19th, 2004 11:59 PM
Question on Pattern matching using VBscript Dereksam VBScript 1 September 9th, 2004 04:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.