D
D
Dmitry2016-04-13 22:57:17
ASP.NET
Dmitry, 2016-04-13 22:57:17

Why use interfaces when designing an application architecture?

Explain to the unknowing, I'm looking at an example of onion architecture on the metanit website, interfaces are used in OnionApp.Domain.Interfaces, it's not entirely clear why interfaces are needed there?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
L
LEKAPb, 2016-04-14
@LEKAPb

Using interfaces is just an approach that simplifies testing and makes it easier to spoof the implementation, and whatnot. With the use of interfaces, it is easier to create decomposition applications with the possibility of extensible modules. The simplest and most understandable example of why interfaces are needed is to create a system of plug-ins for the application. www.vr-online.ru/content/c-plugin-za-5-sekund-3890

S
Stanislav Makarov, 2016-04-14
@Nipheris

I think the interfaces in this example are used as they are everywhere - to control the communications between the components of a large system and to ensure that components are replaceable.
If so, let me link to an old answer: What is the role of interfaces in OOP?

A
AxisPod, 2016-04-14
@AxisPod

Everything is learned just fine on your own mistakes, make a serious project without interfaces and all questions will disappear.
And the interfaces are there exactly for what they are intended for in OOP.

S
Sergey, 2016-04-14
@SergioMadness

For polymorphism

V
Viktor Buzin, 2016-04-20
@Buzzz

I'll add a little more. I myself recently did a project on mvc and there are such things as "Unit of Work" and direct separation into application layers and just in the service layer without interfaces in any way. Well, as previously mentioned polymorphism and OOP. If you do nothing of this, then in the end you can get a big poop on a good project. Of course, in small projects it’s possible without them, but we all know that everything small is just a start for the customer and you can just take a false start, and then get covered with tests. We'll have to rewrite and extensibility disappears. And if there is still muddled with services in Azure, then all the pitchforks, so we draw conclusions and try to start right away right away.

A
Andrey Shedko, 2016-04-21
@Mamboking

This interface is like a drawing of a class with a description of what we want this class to be able to do (besides everything that has already been said here).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question