Interface
(computing)
In computing, an interface is a shared boundary across which two or more
separate components of a computer system exchange information. The
exchange can be between software, computer hardware, peripheral
devices, humans, and combinations of these.[1] Some computer hardware
devices, such as a touchscreen, can both send and receive data through
the interface, while others such as a mouse or microphone may only
provide an interface to send data to a given system.[2]
Hardware interfaces
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 1 of 19
:
Hardware interfaces of a laptop computer: Ethernet
network socket (center), to the left a part of the VGA
port, to the right (upper) a display port socket, to the
right (lower) a USB-A socket.
Hardware interfaces exist in many components, such as the various buses,
storage devices, other I/O devices, etc. A hardware interface is described
by the mechanical, electrical, and logical signals at the interface and the
protocol for sequencing them (sometimes called signaling).[3] A standard
interface, such as SCSI, decouples the design and introduction of
computing hardware, such as I/O devices, from the design and
introduction of other components of a computing system, thereby allowing
users and manufacturers great flexibility in the implementation of
computing systems.[3] Hardware interfaces can be parallel with several
electrical connections carrying parts of the data simultaneously or serial
where data are sent one bit at a time.[4]
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. Applications or programs running on the
operating system may need to interact via data streams, filters, and
pipelines.[5] In object oriented programs, objects within an application may
need to interact via methods.[6]
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 2 of 19
:
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.
Interfaces between software components can provide constants, data
types, types of procedures, exception specifications, and method
signatures. Sometimes, public variables are also defined as part of an
interface.[8]
The interface of a software module A is deliberately defined separately
from the implementation of that module. The latter contains the actual
code of the procedures and methods described in the interface, as well as
other "private" variables, procedures, etc. Another software module B, for
example the client to A, that interacts with A is forced to do so only
through the published interface. One practical advantage of this
arrangement is that replacing the implementation of A with another
implementation of the same interface should not cause B to fail—how A
internally meets the requirements of the interface is not relevant to B,
which is only concerned with the specifications of the interface. (See also
Liskov substitution principle.)
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 3 of 19
:
In object-oriented
languages
In some object-oriented languages, especially those without full multiple
inheritance, the term interface is used to define an abstract type that acts
as an abstraction of a class. It contains no data, but defines behaviours as
method signatures. A class having code and data for all the methods
corresponding to that interface and declaring so is said to implement that
interface.[9] Furthermore, even in single-inheritance-languages, one can
implement multiple interfaces, and hence can be of different types at the
same time.[10]
An interface is thus a type definition; anywhere an object can be
exchanged (for example, in a function or method call) the type of the
object to be exchanged can be defined in terms of one of its implemented
interfaces or base-classes rather than specifying the specific class. This
approach means that any class that implements that interface can be
used. For example, a dummy implementation may be used to allow
development to progress before the final implementation is available. In
another case, a fake or mock implementation may be substituted during
testing. Such stub implementations are replaced by real code later in the
development process.
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. An interface called " Stack " might define two
methods: 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 Java language defines the interface
Readable that has the single read() method; various implementations
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 4 of 19
:
are used for different purposes, including BufferedReader ,
FileReader , InputStreamReader , PipedReader , and
StringReader . Marker interfaces like Serializable contain no
methods at all and serve to provide run-time information to generic
processing using Reflection.[11]
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 modalities of interaction (such as
graphics, sound, position, movement, etc.) where data is transferred
between the user and the computer system.
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 5 of 19
:
See also
Abstraction inversion
Application binary interface
Application programming
interface
Business Interoperability
Interface
Computer bus
Hard disk drive interface
Implementation (computer
science)
Implementation inheritance
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 6 of 19
:
Interoperability
Inheritance semantics
Modular programming
Software componentry
Virtual inheritance
References
1. Hookway, B. (2014).
"Chapter 1: The Subject of
the Interface". Interface (htt
ps://books.google.com/boo
ks?id=BQM_AwAAQBAJ) .
MIT Press. pp. 1–58.
ISBN 9780262525503.
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 7 of 19
:
ISBN 9780262525503.
2. IEEE 100 - The
Authoritative Dictionary Of
IEEE Standards Terms.
NYC, NY, USA: IEEE Press.
2000. pp. 574–575.
ISBN 9780738126012.
3. 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-8 See also:
Patterson, David A.;
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 8 of 19
:
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 (htt
ps://archive.org/details/isb
n_9781558606043/page/
588) , Morgan Kaufmann,
pp. 588–596 (https://archi
ve.org/details/isbn_978155
8606043/page/588) ,
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 9 of 19
:
8606043/page/588) ,
ISBN 1-55860-604-1
4. Govindarajalu, B. (2008).
"3.15 Peripheral Interfaces
and Controllers - OG" (http
s://books.google.com/book
s?id=Hyl8SA1eHzIC&pg=P
A142) . IBM PC And
Clones: Hardware,
Troubleshooting And
Maintenance. Tata
McGraw-Hill Publishing Co.
Ltd. pp. 142–144.
ISBN 9780070483118.
Retrieved 15 June 2018.
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 10 of 19
:
5. Buyya, R. (2013).
Mastering Cloud
Computing (https://books.g
oogle.com/books?id=VSDZ
AgAAQBAJ&pg=SA2-PA1
3) . Tata McGraw-Hill
Education. p. 2.13.
ISBN 9781259029950.
6. Poo, D.; Kiong, D.; Ashok,
S. (2008). "Chapter 2:
Object, Class, Message
and Method". Object-
Oriented Programming and
Java (https://archive.org/d
etails/springer_10.1007-97
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 11 of 19
:
etails/springer_10.1007-97
8-1-84628-963-7) .
Springer-Verlag. pp. 7–15.
ISBN 9781846289637.
7. 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" (http://ww
w.artima.com/lejava/article
s/designprinciples.html) .
artima developer. Archived
(https://web.archive.org/we
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 12 of 19
:
(https://web.archive.org/we
b/20110805191904/http://
www.artima.com/lejava/arti
cles/designprinciples.html)
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
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 13 of 19
:
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. ..."
8. Patterson, D.A.; Hennessy,
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 14 of 19
:
8. Patterson, D.A.; Hennessy,
J.L. (7 August 2004).
Computer Organization
and Design: The
Hardware/Software
Interface (3rd ed.). Elsevier.
p. 656.
ISBN 9780080502571.
9. "What Is an Interface" (htt
p://docs.oracle.com/javas
e/tutorial/java/concepts/int
erface.html) . The Java
Tutorials. Oracle. Archived
(https://web.archive.org/we
b/20120412093619/htt
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 15 of 19
:
p://docs.oracle.com/javas
e/tutorial/java/concepts/int
erface.html) from the
original on 2012-04-12.
Retrieved 2012-05-01.
10. "Interfaces" (http://docs.or
acle.com/javase/tutorial/jav
a/IandI/createinterface.htm
l) . The Java Tutorials.
Oracle. Archived (https://w
eb.archive.org/web/20120
526080117/http://docs.ora
cle.com/javase/tutorial/jav
a/IandI/createinterface.htm
l) from the original on
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 16 of 19
:
l) from the original on
2012-05-26. Retrieved
2012-05-01.
11. "Performance improvement
techniques in Serialization"
(http://www.precisejava.co
m/javaperf/j2se/Serializatio
n.htm) . Precise Java.
Archived (https://web.archi
ve.org/web/20110824150
046/http://www.precisejav
a.com/javaperf/j2se/Seriali
zation.htm) from the
original on 2011-08-24.
Retrieved 2011-08-04.
"We will talk initially about
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 17 of 19
:
"We will talk initially about
Serializable interface. This
is a marker interface and
does not have any
methods."
12. Gamma; Helm; Johnson;
Vlissides (1995). Design
Patterns: Elements of
Reusable Object-Oriented
Software (https://archive.or
g/details/designpatternsel0
0gamm) . Addison Wesley.
pp. 17–18 (https://archive.o
rg/details/designpatternsel
00gamm/page/17) .
ISBN 9780201633610.
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 18 of 19
:
ISBN 9780201633610.
Retrieved from
"https://en.wikipedia.org/w/index.php?
title=Interface_(computing)&oldid=124
4878409"
This page was last edited on 9
September 2024, at 18:51 (UTC). •
Content is available under CC BY-SA
4.0 unless otherwise noted.
https://en.m.wikipedia.org/wiki/Interface_(computing) 6/12/24, 14 18
Page 19 of 19
: