Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
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 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 September 4th, 2008, 07:56 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
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?


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic display using logic tags rajesh_css Struts 1 December 23rd, 2008 03: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 07:19 PM
MVC pattern in Windows Applications. mmwaikar ADO.NET 0 July 15th, 2003 01:05 PM

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