1

I've been working on an MVP WinForms app where the Views and Presenters are in the same Visual Studio Project (assembly). I was thinking of separating the two into their own assemblies so the View would have fewer references to what the Presenter is using. For example, my Presenters may have reference to a service layer assembly to carry out some work. This requires me to add a reference to my service layer for the Presenter to use the services. However, my Views are in the same assembly as the Presenter so they have the ability to use the services as well, but I never allow that.

Would there be any issue if I were to separate my Views and Presenters into their own projects so I can minimize the references my Views are gaining access to due to what my Presenters need to do? Is there a best practice here for the placement of Presenters and Views in a Visual Studio Studio solution.

Thanks in advance.

Robertcode
  • 911
  • 1
  • 13
  • 26
  • I would guess that its fine to separate them into Projects within the same solution (just to make it easy to maintain in the same solution). But I'm no expert on MVP - perhaps it breaks the paradigm - but my gut says its nice to make separate projects (for a variety of reasons, including sharing your models with other assemblies) – Grantly Jun 01 '18 at 16:33
  • 3
    It doesn't matter where they live. The only thing that matters is that if you are following a pattern, you adhere to said pattern. The only thing you may run into is depending on how it is structured, you might start fighting circular dependencies. – TyCobb Jun 01 '18 at 16:34
  • @TyCobb Hmm...I forgot about the circular thing. That will be an issue being in separate projects because my View project would need a reference to my Presenter project and my Presenter project would need a reference to my View project. Not an issue now with them in the same project assembly. I just don't like my View possibly having access to what my Presenter has (i.e. service layer) because they are in same assembly. I'll just have to be mindful to not let any View code access things that belong to the Presenter. Thanks. – Robertcode Jun 01 '18 at 16:45

0 Answers0