Simple Code: Contracts

What Are Contracts?

A high abstraction level of contracts for code is APIs. They define an interface that is basically a contract that the producer and consumer of the API agree to use to communicate with each other. Two common forms of APIs are libraries that are used in code and external APIs that are used via HTTP, RPC, etc.

When thinking a bit deeper, contracts consist firstly of functions, methods, or external endpoints and secondly of data, more precisely on data models and data types within the models.