In software engineering, an interface is a contract that defines a set of methods, properties, or behaviors that a class or module must implement, without specifying how those implementations should work. Interfaces establish clear boundaries between components, enabling different parts of a system to communicate through well-defined agreements rather than relying on concrete implementation details. This concept is central to object-oriented and component-based programming.
Interfaces manifest differently across programming languages. In Java and C#, the interface keyword explicitly defines method signatures that implementing classes must fulfill. In TypeScript, interfaces describe the shape of objects for compile-time type checking. Go uses implicit interface satisfaction, where any type that implements the required methods automatically fulfills the interface. Python achieves similar patterns through abstract base classes and duck typing.
Beyond programming languages, the concept of interfaces extends to APIs (Application Programming Interfaces), user interfaces (UIs), and hardware interfaces. In all cases, the core principle remains the same: an interface defines what interactions are possible without dictating the underlying mechanism. This separation of concerns makes it easier to swap implementations, mock dependencies for testing, and develop components in parallel with confidence that they'll integrate correctly.