English 中文(简体)
MVP, design question
原标题:

I working on a MVP designed application and have some design questions. When writing code in the presenter-layer how should the communication go between different presenters/views? Lets say I have a WindowPresenter with its WindowView and I want to set the window title on a window from another window. I have a title-setter on the window view that wraps the actual gui title. Should I call the title-setter directly on the view (windowPresenter.View.Title = "Title") or should I wrap the view title as a presenter title setter (windowPresenter.Title = "Title") ?

问题回答

Ask yourself how would you test it? If you do windowPresenter.View.Title = "Title", how can you test that presenter is setting the title?

There is a nice article that focuses quite a lot on similar things in MSDN magazine this month:

Beyond MVP - Extending the MVP Pattern for Enterprise-Class Application UI Architecture





相关问题
Choosing the right subclass to instantiate programmatically

Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...

Design pattern for managing queues and stacks?

Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the ...

Organizing classes using the repository design pattern

I have started upgrading one of our internal software applications, written in ASP.NET Web Forms, and moving to ASP.NET MVC. I am trying to leverage the Repository design pattern for my classes, ...

Misuse of Observer Pattern?

I have a Car object which contains a latitude field and a longitude field. I use the observer pattern so that any time either of these fields change in my application, my car object is notified. I ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

热门标签