How to know when to create custom interfaces

Possible duplicates:
Interfaces: Why can I understand them?
How to know when to create an interface?

I am using C # and I know which interfaces and how to use them, etc. but I haven’t yet learned that when I am tasked with writing a project, create a component ... How do I know more about interfaces, so when I want to do something, I can think about using them in my design ... or for example, I want to learn about dependency injection or even use mocking objects for testing, they are all connected with a good understanding of interfaces and know when and how to use them ... Can you tell me good advice, reading, ... maybe help me with this?

+3
source share
5 answers

What interface should these things have in common if they are used the same way?

If you can answer this question, then you are already on the right path of designing and using the interface in real-world scenarios.

+2
source

Use interfaces when you have several things that can perform a common set of actions. How these actions can be different, but if they use classes, they act the same.

. . , , , , - , , . .

-, () , . - , , .

+2

- . , , . , , .

, IList<T> List<T>, IList<T> , -, . , . (, NHibernate, , , .)

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

, . , , . .

, .

0

, TDD, , , . "" , / ​​/ ..

- , - , .

0

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


All Articles