mvp

Concrete Code Example of MVP [closed]

旧巷老猫 提交于 2019-11-28 15:44:14
Can someone provide a concrete (actual Java code) example of MVP in action? This would include the following 3 types of classes and how they call each other's methods to achieve the pattern and process/respond to a client-side response: Model - some kind of value object (VO) View - represents or generates the UI Presenters - business logic Daniel De León MVP is my favorite design pattern to create a UI. The big difference between MVP and MVC is how to handle the view. In MVC, the Controller manipulates the view, taking care of how to render in the view parts of the user actions and model. That

in MVC/MVP/MVPC where do you put your business logic?

醉酒当歌 提交于 2019-11-28 15:40:38
问题 in the MVC/MVP/MVPC design pattern where do you put your business logic? No, I do not mean the ASP.NET MVC Framework (aka "Tag Soup"). Some people say you should put it in the "Controller" in MVC/MVPC or "Presenter". But, others think it should be part of the Model. What do you think and why? 回答1: This is how I see it: The controller is for application logic; logic which is specific to how your application wants to interact with the domain of knowledge it pertains to. The model is for logic

MVP pattern with Javascript framework?

谁都会走 提交于 2019-11-28 15:40:25
问题 Has anyone been able to implement the MVP model with any javascript frameworks? I'm having trouble figuring out how to have the presenter -> view inversion from server code to javascript. I have some ideas, but kind of hackish and would like to see what others are doing. 回答1: The main goal with MVP is decoupling of different aspects in the code. Normally, in JavaScript, there are 3 major such aspects: Event Handling DOM manipulation Server communication (AJAX calls) For each of these concerns

C# WinForms Model-View-Presenter (Passive View)

半腔热情 提交于 2019-11-28 15:35:02
问题 I'm developing a WinForms application in C#. I have limited experience in GUI programming, and I am having to learn a great deal on the fly. That being said, here's what I am building. See the general GUI look at the following link: GUI http://img227.imageshack.us/img227/1084/program0.jpg Now, I have done a lot of the work already, but in the very bad Autonomous design pattern. I did not know the project would ever reach a certain size, and, as such, it is time to do some major refactoring. I

Does the presenter having knowledge of the Activity / Context a bad idea in the MVP pattern?

给你一囗甜甜゛ 提交于 2019-11-28 15:21:00
I've been playing around with the MVP pattern for a few weeks now and I've come to the point where I need context to start a service and access Shared Preferences . I've read that the purpose of MVP is to decouple the view from the logic and having context within a Presenter may defeat that purpose (correct me if I'm wrong on this). Currently, I have a LoginActivity that looks something like this: LoginActivity.java public class LoginActivity extends Activity implements ILoginView { private final String LOG_TAG = "LOGIN_ACTIVITY"; @Inject ILoginPresenter mPresenter; @Bind(R.id.edit_login

MVC / MVP / MVVM What the Heck?

心已入冬 提交于 2019-11-28 15:09:25
问题 I recently worked on a .Net WPF project to build a retail point of sale system where I used the MVP pattern for the first time. It took me a little while to wrap my head around the change of approach but once I did that I thought that the concept rocked! My question is this: what is the distinction between MVC, MVP and MVVM? If there is a clear distinction, are there guidelines as to when you should use one pattern over another? If anyone can offer guidance on this, or point to article that

What is Model View Presenter? [closed]

五迷三道 提交于 2019-11-28 14:36:58
问题 Can someone please explain in a way as simple as possible what the Model View Presenter pattern is? What is the difference with Model View Controller ? Which is best or for which purpose ? 回答1: Martin Fowler has a page on UI design patterns, in which he defines and then talks about MVC, MVP and other patterns. http://martinfowler.com/eaaDev/uiArchs.html To summarise the differences, Controllers in the MVC have more control over the UI, and handle events, while a presenter in the MVP is more

What are the differences between Presenter, Presentation Model, ViewModel and Controller?

末鹿安然 提交于 2019-11-28 14:25:46
问题 I have a pretty good idea how each of these patterns work and know about some of the minor differences between them, but are they really all that different from each other? It seems to me that the Presenter, Presentation Model, ViewModel and Controller are essentially the same concept. Why couldn't I classify all of these concepts as controllers? I feel like it might simplify the entire idea a great deal. Can anyone give a clear description of their differences? I want to clarify that I do

Model-View-Presenter passive view: bootstraping - who displays the view initially?

陌路散爱 提交于 2019-11-28 12:25:08
In the Passive View Model View Presenter pattern, who has the responsibility for displaying the view? I have found related answers for other MVP versions, but they don't seem applicable to the passive view version. I have a concrete example using Java Swing. It's pretty simple, but basically we have a SwingCustomersView which internally builds a JPanel with a table (list of customers) and a label displaying the currently selected customers age. When a customer is selected in the table, the presenter retrieves the selected customer age from the model. I think the example is a correct

Dagger2 scopes and activity lifecycle

穿精又带淫゛_ 提交于 2019-11-28 11:31:57
I have an Android Activity that I'm using Dagger2 to inject a Presenter into. I'd like my Presenter to be capable of holding state even if a configuration change occurs. For instance, I'm going to use the Presenter to kick off a network call and if the user rotates the device while the network call is in-flight I'd like to be able to receive the response after the device finishes its rotation and not have to restart the call. I'm getting tripped up because if I scope the instance of Presenter to the Activity's life, then isn't there a chance that the Presenter would be garbage collected when