Where to declare interfaces?

I am working on a project with various assemblies (imagine a printer module, image processing module, etc.). In this project, all interfaces are declared within the same Interfaces-assembly (suppose that Interfaces.dll with the interfaces IPrinterModule, IImagingModule, etc.).

Since I'm a cowboy coder;) I have to ask the SO community if this is really the best practice or how can this be done better?

+3
source share
3 answers

We have taken a similar approach. You definitely want to separate the interfaces from their (current) implementation, so it’s easy to provide different implementations in the future. Martin Fowler described this as Shared Interfaces .

( IPrinter IImageXXX?), , .

+4

- , , .

, (, ). - - , , , . , .

+6

If there are circular links, then supporting all your interfaces in a separate assembly will help you. I read a lot of code examples (from microsoft, codeproject and other sites) over the past few days, studying the process of work, the interface is announced in its implementation.

Like IPrinterModule will be declared in an assembly that implements

+1
source

Source: https://habr.com/ru/post/1708655/


All Articles