I always see the word contract
and it seems to have different meanings or at least it is how it looks to me (I am not a native English speaker) so when I see the word "contract" I cannot be sure what I should understand and expect from it. I don't know if anyone else is having the same trouble but this bugs me a lot. For example, when I see "interface" it makes me think "abstraction, dependency injection, inheritance, etc." and I know what I am looking for and it is getting formed in my mind nicely and easily.
But when it comes to the word contract
I cannot visualize a pattern, class etc. whatever it is. Is it something formed using interface
or a class
or maybe an attribute
etc.
For example, there is a class here (in Json.NET) which talks about something called IContractResolver
and the page is explained what it is used for :
The IContractResolver interface provides a way to customize how the JsonSerializer serializes and deserializes .NET objects to JSON without placing attributes on your classes.
The explaination is very comprehensible but I cannot just form the idea when I see Contract
and I cannot say :
"Umm, I am expecting some methods which do this and that so I can override it and later I use this class here/there to change/fulfill some functionality etc."
and this bugs me a lot. I read some article about it but they are talking about Design by Contract and it is not something useful for someone who has troubles with the meaning of "contract".
So can some one please explain how I should understand this term and what I should expect when I see it? It would be very nice you could add some sample code in order for me to visualize it.