*** Welcome to piglix ***

Interface-based programming



Interface-based programming, also known as interface-based architecture, is an architectural pattern for implementing modular programming at the component level in an object-oriented programming language which does not have a module system. An example of such a language is Java, which (as of 2015), does not have a module system at the level of components. Java has a package system, but Java software components typically consist of multiple Java packages – and in any case, interface programming can provide advantages over merely using Java packages, even if a component only consists of a single Java package.

Interface-based programming defines the application as a collection of components, in which Application Programming Interface (API) calls between components may only be made through abstract interfaces, not concrete classes. Instances of classes will generally be obtained through other interfaces using techniques such as the Factory pattern.

This is claimed to increase the modularity of the application and hence its maintainability. However, some caution is warranted – merely splitting an application into arbitrary components communicating via interfaces does not in itself guarantee low coupling or high cohesion, two other attributes that are commonly regarded as key for maintainability.

An interface-based architecture can be used when third parties – or indeed separate teams within the same organisation – develop additional components or plugins for an established system. The codebase of the Eclipse IDE is an example of interface-based programming. Eclipse plugin vendors just have to develop components that satisfy the interface specified by the parent application vendor, the Eclipse Foundation. Indeed, in Eclipse, even the original components such as the Java Development Tools are themselves plugins. This is somewhat like a mobile phone manufacturer specifying a mobile charger interface (pin arrangement, expected direct current voltage, etc.) and both the manufacturer and third parties making their own mobile phone chargers that comply with this standard interface specification.


...
Wikipedia

...