Interface (computing): Difference between revisions

Content deleted Content added
No edit summary
m Disambiguating links to Object-orientation (link changed to Object-oriented programming) using DisamAssist.
(36 intermediate revisions by 18 users not shown)
Line 1:
{{Short description|Shared boundary between elements of a computing system}}
{{Refimprove|date=May 2010}}
 
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]]|peripheral devices]], [[User interface|humans]], and combinations of these.<ref name="HookwayInterface14">{{cite book |url=https://books.google.com/books?id=BQM_AwAAQBAJ |chapter=Chapter 1: The Subject of the Interface |title=Interface |author=Hookway, B. |publisher=MIT Press |pages=1–58 |year=2014 |isbn=9780262525503}}</ref> 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.<ref>{{cite encyclopedia
| year = 2000
| title = IEEE 100 - The Authoritative Dictionary Of IEEE Standards Terms
Line 11 ⟶ 10:
 
== Hardware interfaces ==
[[File:RJ-45 Ethernet socket on Lenovo T410 Laptop.jpg|thumb|upright=1.4|Hardware interfaces of a [[laptop]] computer: [[Ethernet]] network socket (center), to the left a part of the [[Video Graphics Array|VGA]] port, to the right (upper) a [[display port]] socket, to the right (lower) a [[Universal Serial Bus|USB]]-BA socket.]]
{{Main article|Hardware interface}}
Hardware interfaces exist in many components, such as the various [[Bus (computing)|buses]], [[Computer data storage|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).<ref name="87Blaauw">
Line 45 ⟶ 44:
{{See also|Application binary interface|Application programming interface}}
 
A software interface may refer to a wide range of different types of interfaceinterfaces at different "levels". For example, an operating system may interface with pieces of hardware. [[application software|Application]]s or [[Computer program|program]]s running on the operating system may need to interact via data [[Stream (computing)|streams]], filters, and pipelines.<ref name="BuyyaMastering13">{{cite book |url=https://books.google.com/books?id=VSDZAgAAQBAJ&pg=SA2-PA13 |title=Mastering Cloud Computing |author=Buyya, R. |publisher=Tata McGraw-Hill Education |page=2.13 |year=2013 |isbn=9781259029950}}</ref> In [[Object-oriented programming|object oriented programs]], objects within an application may need to interact via [[Method (computer science)|methods]].<ref name="PooObject08">{{cite book |chapter=Chapter 2: Object, Class, Message and Method |title=Object-Oriented Programming and Java |url=https://archive.org/details/springer_10.1007-978-1-84628-963-7 |author1=Poo, D. |author2=Kiong, D. |author3=Ashok, S. |publisher=Springer-Verlag |pages=7–15 |year=2008 |isbn=9781846289637}}</ref>
 
=== In practice ===
Line 69 ⟶ 68:
=== In object-oriented languages ===
{{Main article|Interface (object-oriented programming)|Concept (generic programming)}}
In some [[Object-oriented programming|object-oriented]] languages, especially those without full [[multiple inheritance]], the term ''interface'' is used to define an [[Abstract data type|abstract type]] that acts as an [[abstraction]] of a [[Class (computer science)|class]]. It contains no data, but defines behaviours as [[Method (computer science)|method]] signatures. A [[class (computer science)|class]] having code and data for all the methods corresponding to that interface and declaring so is said to ''implement'' that interface.<ref>{{cite web|url=http://docs.oracle.com/javase/tutorial/java/concepts/interface.html|title=What Is an Interface|work=The Java Tutorials|publisher=Oracle|access-date=2012-05-01|url-status=live|archive-url=https://web.archive.org/web/20120412093619/http://docs.oracle.com/javase/tutorial/java/concepts/interface.html|archive-date=2012-04-12}}</ref> Furthermore, even in single-inheritance-languages, one can implement multiple interfaces, and hence can ''be'' of different types at the same time.<ref>{{cite web|url=http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html|title=Interfaces|work=The Java Tutorials|publisher=Oracle|access-date=2012-05-01|url-status=live|archive-url=https://web.archive.org/web/20120526080117/http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html|archive-date=2012-05-26}}</ref>
 
An interface is thus a [[data type|type]] definition; anywhere an object can be exchanged (for example, in a [[function (computer science)|function]] or [[method (computer science)|method]] call) the ''type'' of the object to be exchanged can be defined in terms of one of its implemented ''interface''s or base-classes rather than specifying the specific [[Class (computer science)|class]]. This approach means that any class that implements that interface can be used.{{citation needed|date=June 2018}} For example, a [[Skeleton (computer programming)|dummy implementation]] may be used to allow development to progress before the final implementation is available. In another case, a [[Test-driven development#Fakes, mocks and integration tests|fake or mock]] implementation may be substituted during testing. Such [[Method stub|stub]] implementations are replaced by real code later in the development process.
Line 113 ⟶ 112:
* [[Business Interoperability Interface]]
* [[Computer bus]]
* [[Coupling (computer programming)]]
* [[Hard disk drive interface]]
* [[Implementation (computer science)]]