Content deleted Content added
No edit summary Tag: Reverted |
m Reverted edits by 103.82.0.28 (talk) to last version by ClueBot NG |
||
Line 2:
{{Refimprove|date=May 2010}}
In computing, an '''interface''' is a shared boundary across which
| year = 2000
| title = IEEE 100 - The Authoritative Dictionary Of IEEE Standards Terms
Line 10:
| pages = 574–575}}</ref>
==
[[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]]-A socket.]]
{{Main article|Hardware interface}}
{{Citation
| last1 = Blaauw
Line 42:
</ref> 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.<ref name="87Blaauw" /> Hardware interfaces can be [[Parallel communication|parallel]] with several electrical connections carrying parts of the data simultaneously or [[Serial communication|serial]] where data are sent one [[bit]] at a time.<ref name="GovindarajaluIBM08">{{cite book |chapter-url=https://books.google.com/books?id=Hyl8SA1eHzIC&pg=PA142 |chapter=3.15 Peripheral Interfaces and Controllers - OG |title=IBM PC And Clones: Hardware, Troubleshooting And Maintenance |author=Govindarajalu, B. |publisher=Tata McGraw-Hill Publishing Co. Ltd |pages=142–144 |year=2008 |isbn=9780070483118 |access-date=15 June 2018}}</ref>
==
{{See also|Application binary interface|Application programming interface}}
Line 71:
In some [[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
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.{{citation needed|date=June 2018}} An interface called "<code>[[Stack (data structure)|Stack]]</code>" might define two methods: <code>push()</code> and <code>pop()</code>. It can be implemented in different ways, for example, <code>FastStack</code> and <code>GenericStack</code>—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.
|