I am just building a MVC .NET application, eventually this will use entity framework and the repository pattern to structure the program. The first release however will only be calling other jobs that run reports.

For this I was going to make the interface iReport of which another project (that can call Matlab) will implement and this way I have abstracted this report and can take away Matlab and replace it if need be with another system that can produce the report in question.

My question therefore is, presuming this is a good architecture, how to structure this, where to put this interface? Do I simply put it in a separate folder on the web app project?

This seems like a simple question but I tend to struggle with project layout as I want to make sure it is correct.

closed as too broad by Bart van Ingen Schenau, user22815, user40980, jwenting, durron597 Sep 23 '15 at 16:42

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Will there be just this one interface, or many of them? – RubberDuck Sep 22 '15 at 10:18

It's good to put the interface with the domain objects it references.

So if you have Report, ReportLine, ReportType... etc and IReportGenerator I would stick them all in a class library project, with a 'Interfaces' folder/namespace for the interface.

This way, everything can reference the domain project and implement stuff using the objects and interfaces, but can then choose the implementation of the interface they would like to use without having to reference anything extra.

If you end up having lots of separate services, say IReportGenerator, IReportEmailer etc etc at some point you might want to split these out from the domain model class lib, just because they have such differing responsibilities, or perhaps they have to reference other libraries (although you should try and avoid this in your interfaces)

In this case, I would put the interface with the first implementation you write. say you have ReportGenerator_MatLab, you can stick it in that class lib. As you only have the one implementation (plus a mock!!) your projects are going to be referencing it anyway.

Not the answer you're looking for? Browse other questions tagged or ask your own question.