Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.††If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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
Thread Tools Display Modes
  #1 (permalink)  
Old September 4th, 2008, 07:56 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,409
Thanks: 0
Thanked 16 Times in 16 Posts
Default MVC pattern - where does display "logic" go?

Hi all,

I've read the Head First Design Patterns book MVC pattern section several times in an effort to understand MVC. I finally have a project that can really implement it (most of the time I'm doing web app development and find it difficult to apply the MVC pattern to ASP.NET - yes I realize there is now an MVC framework for it, that's another discussion).

I am starting to understand the implementation and now have what I believe is a clear separation of what the model, view and controller should do. However, as I've been developing I've come across this question:

Where should I put logic that is really about user interaction?

For example, I have a view that shows the data of the model. On the view is an action trigger for the "AddThing" action. The view is the first to handle the action request, and in MVC fashion, hands off the request to the controller which actually does it. Part of doing this action is to prompt the user for the new thing that will be added. This requires showing a dialog to prompt for the new thing's information.

Where/how do I handle this?

I'm my case, I have an assembly containing all the presentation entities (windows forms and user controls) as well as an implementation of the controller. I'm thinking that this implementation is the "windows forms presentation controller" version of the controller so it's reasonable that it knows about the available forms in order to actually execute the action requests. After it prompts the user for the new thing's information, it delegates the action of actually adding the thing to the model off to the model instance. So the business logic of the model is in the model, while some of the user interface logic is in the concrete controller implementation. The logic specific to how the view actually displays the model is still in the view itself.

When I port this application over to the web, I'll create another concrete controller implementation (in the web app) which will know about the various pages and such in order to provide the right behavior there. There will also be new views, but the main model will remain the same.

Am I implementing MVC correctly? Should the user interface logic (not that of the view however) be abstracted out even further in some way?

Reply With Quote

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
dynamic display using logic tags rajesh_css Struts 1 December 23rd, 2008 02:42 AM
mvc datta123 Struts 1 October 26th, 2006 11:00 AM
DirectoryInfo.GetFiles(pattern): search pattern fo arif_1947 VS.NET 2002/2003 1 October 19th, 2004 11:59 PM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 06:19 PM
MVC pattern in Windows Applications. mmwaikar ADO.NET 0 July 15th, 2003 01:05 PM

All times are GMT -4. The time now is 11:58 PM.

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