Web Client Software Factory(WCSF) and Smart Client Software Factory(SCSF) both use MVP pattern.
Web客户端软件工厂(WCSF)和智能客户端软件工厂(SCSF)都使用MVP模式。
M-Model can be shared.
可以共享M模型。
V-View has to be different as both are on different platform(Desktop/Web).
V-View必须不同,因为它们都在不同的平台(桌面/ Web)上。
I want to know can the P-Presenter can be shared or can I be exactly same for both and how.
我想知道P-Presenter可以共享,还是我可以完全相同。
2 个解决方案
#1
In general, no, that's not how the pattern(s) work. The Model is the reusable portion, and the combination of V + C/P comprise the application layer, and therefore are application-specific by definition.
一般来说,不,这不是模式的工作方式。模型是可重用部分,V + C / P的组合构成应用层,因此根据定义是特定于应用的。
If you have logic in your presenters that seems like it should be reusable across different applications, you should look at how you can push that down into your domain layer, and make it part of your Model.
如果您的演示者中有逻辑似乎应该可以在不同的应用程序中重用,那么您应该看看如何将其推送到您的域层,并使其成为您的模型的一部分。
This is one of the best articles on the subject.
这是关于这个主题的最好的文章之一。
#2
For the most part, I agree with sliderhouserules. The presenters manipulate UI components according to business rules and are therefore going to be somewhat platform-specific to the UI platform. From what I understand you're wanting to manifest the same application through two different UI platforms. Although, the business rules for this app may stay the same across the two platforms, the UI presentation will be different.
在大多数情况下,我同意sliderhouserules。演示者根据业务规则操纵UI组件,因此将在某种程度上针对UI平台进行特定于平台的操作。根据我的理解,您希望通过两个不同的UI平台显示相同的应用程序。虽然,这个应用程序的业务规则可能在两个平台上保持不变,但UI呈现方式会有所不同。
So, perhaps you should look into a creating a shared library where that common business logic your presenters enact can be reused in UI-specific presentation code for each app. I think this could go a long way in reducing platform-specific code.
所以,也许您应该考虑创建一个共享库,其中您的演示者制定的常见业务逻辑可以在每个应用程序的UI特定的演示代码中重用。我认为这可以在减少平台特定代码方面发挥很大作用。
#1
In general, no, that's not how the pattern(s) work. The Model is the reusable portion, and the combination of V + C/P comprise the application layer, and therefore are application-specific by definition.
一般来说,不,这不是模式的工作方式。模型是可重用部分,V + C / P的组合构成应用层,因此根据定义是特定于应用的。
If you have logic in your presenters that seems like it should be reusable across different applications, you should look at how you can push that down into your domain layer, and make it part of your Model.
如果您的演示者中有逻辑似乎应该可以在不同的应用程序中重用,那么您应该看看如何将其推送到您的域层,并使其成为您的模型的一部分。
This is one of the best articles on the subject.
这是关于这个主题的最好的文章之一。
#2
For the most part, I agree with sliderhouserules. The presenters manipulate UI components according to business rules and are therefore going to be somewhat platform-specific to the UI platform. From what I understand you're wanting to manifest the same application through two different UI platforms. Although, the business rules for this app may stay the same across the two platforms, the UI presentation will be different.
在大多数情况下,我同意sliderhouserules。演示者根据业务规则操纵UI组件,因此将在某种程度上针对UI平台进行特定于平台的操作。根据我的理解,您希望通过两个不同的UI平台显示相同的应用程序。虽然,这个应用程序的业务规则可能在两个平台上保持不变,但UI呈现方式会有所不同。
So, perhaps you should look into a creating a shared library where that common business logic your presenters enact can be reused in UI-specific presentation code for each app. I think this could go a long way in reducing platform-specific code.
所以,也许您应该考虑创建一个共享库,其中您的演示者制定的常见业务逻辑可以在每个应用程序的UI特定的演示代码中重用。我认为这可以在减少平台特定代码方面发挥很大作用。