Interface (computing)
This article needs additional citations for verification. (May 2010) |
In computing, an interface is a shared boundary across which two or more separate components of a
Hardware interfaces
Hardware interfaces exist in many components, such as the various
Software interfaces
A software interface may refer to a wide range of different types of interfaces at different "levels". For example, an operating system may interface with pieces of hardware.
In practice
A key principle of design is to prohibit access to all resources by default, allowing access only through well-defined entry points, i.e., interfaces.[7] Software interfaces provide access to computer resources (such as memory, CPU, storage, etc.) of the underlying computer system; direct access (i.e., not through well-designed interfaces) to such resources by software can have major ramifications—sometimes disastrous ones—for functionality and stability.[citation needed]
Interfaces between software components can provide
The interface of a software module A is deliberately defined separately from the
In object-oriented languages
In some
An interface is thus a
Usually, a method defined in an interface contains no code and thus cannot itself be called; it must be implemented by non-abstract code to be run when it is invoked.[push()
and pop()
. It can be implemented in different ways, for example, FastStack
and GenericStack
—the first being fast, working with a data structure of fixed size, and the second using a data structure that can be resized, but at the cost of somewhat lower speed.
Though interfaces can contain many methods, they may contain only one or even none at all. For example, the
Programming to the interface
The use of interfaces allows for a programming style called programming to the interface. The idea behind this approach is to base programming logic on the interfaces of the objects used, rather than on internal implementation details. Programming to the interface reduces dependency on implementation specifics and makes code more reusable.[12]
Pushing this idea to the extreme, inversion of control leaves the context to inject the code with the specific implementations of the interface that will be used to perform the work.
User interfaces
A user interface is a point of interaction between a computer and humans; it includes any number of
See also
- Abstraction inversion
- Application binary interface
- Application programming interface
- Business Interoperability Interface
- Computer bus
- Hard disk drive interface
- Implementation (computer science)
- Implementation inheritance
- Interoperability
- Inheritance semantics
- Modular programming
- Software componentry
- Virtual inheritance
References
- ISBN 9780262525503.
- ISBN 9780738126012.
- ^ a b
Blaauw, Gerritt A.; Brooks, Jr., Frederick P. (1997), "Chapter 8.6, Device Interfaces", Computer Architecture-Concepts and Evolution, Addison-Wesley, pp. 489–493, ISBN 0-201-10557-8See also: Patterson, David A.; Hennessey, John L. (2005), "Chapter 8.5, Interfacing I/O Devices to the Processor, Memory and Operating System", Computer Organization and Design - The Hardware/Software Interface, Third Edition, Morgan Kaufmann, pp. 588–596,ISBN 1-55860-604-1
- ISBN 9780070483118. Retrieved 15 June 2018.
- ISBN 9781259029950.
- ISBN 9781846289637.
- ^
Bill Venners (2005-06-06). "Leading-Edge Java: Design Principles from Design Patterns: Program to an interface, not an implementation - A Conversation with Erich Gamma, Part III". artima developer. Archived from the original on 2011-08-05. Retrieved 2011-08-03.
Once you depend on interfaces only, you're decoupled from the implementation. That means the implementation can vary, and that is a healthy dependency relationship. For example, for testing purposes you can replace a heavy database implementation with a lighter-weight mock implementation. Fortunately, with today's refactoring support you no longer have to come up with an interface up front. You can distill an interface from a concrete class once you have the full insights into a problem. The intended interface is just one 'extract interface' refactoring away. ...
- ISBN 9780080502571.
- ^ "What Is an Interface". The Java Tutorials. Oracle. Archived from the original on 2012-04-12. Retrieved 2012-05-01.
- ^ "Interfaces". The Java Tutorials. Oracle. Archived from the original on 2012-05-26. Retrieved 2012-05-01.
- ^
"Performance improvement techniques in Serialization". Precise Java. Archived from the original on 2011-08-24. Retrieved 2011-08-04.
We will talk initially about Serializable interface. This is a marker interface and does not have any methods.
- ISBN 9780201633610.