Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 25th, 2010, 01:44 AM
Authorized User
 
Join Date: Jan 2006
Location: , , Canada.
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).
Reply With Quote
  #2 (permalink)  
Old November 25th, 2010, 03:03 AM
elbandit's Avatar
Wrox Author
Points: 599, Level: 8
Points: 599, Level: 8 Points: 599, Level: 8 Points: 599, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
Posts: 107
Thanks: 11
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
Reply With Quote
  #3 (permalink)  
Old November 25th, 2010, 09:25 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 05: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



All times are GMT -4. The time now is 09:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.