r/computerscience • • 4d ago

Advice Interfaces

I stumbled upon the word interface when i stumbled upon the terminal in visual studio code. A terminal is a text based user interface which does lots of useful stuff.

That got me thinking about the word interface and what exactly it is in the computer sense. I understand user interface is the area or boundary between the human (user) and the computer( or rather software?) interacting with each other.

The problem is I am getting conflicting thoughts with current information I've searched and I'm unable to get a full understanding of the term.

So can someone please give their understanding/opinion of what an interface is in a broad computing sense. And can they also give multiple examples of different types of interfaces used in computer hardware and software too please.

Many thanks

2 Upvotes

13 comments sorted by

41

u/Humble-Captain3418 4d ago

Interface is the surface between two distinct entities. That can be the human-machine interface (HMI), machine-machine interface (M2M), network interface (card, NIC), application programming interface (API) and so on. It fundamentally means "this is the part of this box that you interact with".

7

u/United-Astronaut1554 4d ago

It’s one of those words that gets thrown around so much you almost forget it has a real meaning underneath

Think of it as the contract for communication, it defines what messages can be sent and what you'll get back, but hides all the messy guts behind the scenes. An API is the classic software one but even the pins on a CPU are a hardware interface, they just speak in voltage instead of JSON

9

u/Humble-Captain3418 4d ago

I'd like to further distinguish that a contract for communication is a protocol. An interface can come with a protocol attached and vice versa, but there are interfaces without protocols; e.g. almost all physical interfaces.

4

u/lfdfq Computer Scientist 4d ago

An interface is a thing between two or more other things.

Your text editor is an interface between you and the file.
A library is an interface between one bit of code and another bit of code.
An abstract data type is an interface between a bit of code and the implementation of the data structure.

Sometimes the thing is tangible: a bit of hardware or software that actually does a thing. Sometimes the thing is conceptual. Sometimes one of the things is a human, sometimes it's between two humans, sometimes it's an interface between two software things or two hardware things.

2

u/drgrd 4d ago

When you're doing things yourself, you can mostly do what you want; but whenever you need to coordinate with someone else, you need to communicate with them, and that means translating your internal thoughts and processes into a form they can understand. They then need to interpret what you say or do and decide how to proceed. That communication, in whatever form it takes, is the interface between you.

Any two entities that need to interact with each other do so through an interface; and that interface can be a source of mistakes and misunderstanding. As others have said, the word "interface" in computer science is used to refer to the communication channels between a human and a computer, but also to the communication channels between different structures within a computer system. We design interfaces to try to reduce the confusion and opportunity for error - we build redundancy so that if data is lost, the intent can be recovered; and we design controls and displays so that the user can communicate their intent, and the computer can communicate its state.

2

u/repaj 4d ago

Interface is just a contract. It tells about how someone agreed to use certain entity, or how you constrained the entity someone would use.

1

u/o4ub Computer Scientist 3d ago

I use the same definition. An interface is a contract where the entity providing the interface defines what can be done, what services is proposed and what information is required to provide for it to work properly.

For a command line interface, it means what are the commands you are allowed to enter, what are the options you can apply to each.

For an application programming interface, it means what are the functionality your library offers, and what data it will use.

1

u/Paxtian 3d ago

Broadly, it's the boundary between any two agents: human/computer or computer/computer, for example.

So there's an interface between you, the user, and your device. You want to get to Reddit. So you launch your browser. The browser is configured to execute HTTP to send and receive data between itself and Reddit's servers. The server provides an interface by which to request and deliver data.

Between all of that, there are physical connections between your computer and your local router, then your ISP, then the backbone of the Internet, lots of massive routers. Each of them has physical interfaces between each other.

1

u/Key_River7180 3d ago

An interface is the intermediary between two things. An application to the OS or a library, an user to a graphical window, a business to a business, a peer to a peer, ...

1

u/bothunter 3d ago

This is one of those terms where the plain English definition applies:

INTERFACE Definition & Meaning - Merriam-Webster

the place at which independent and often unrelated systems meet and act on or communicate with each other

That's it. There are a myriad different kinds of interfaces when it comes to computers. Your keyboard is a Human-Computer interface. An API is an Application Programming Interface (or where code from different systems interact)

1

u/esaule 2d ago

Interface (like most terms in CS) is massively overloaded. It means lots of very different things for different people.

In the general abstract sense, it is the contact surface between two domains. Bur that is not terribly helpful a definition.

You will realize that in CS there are only about 100 worda and we use them for everything.

0

u/P-Jean 4d ago

It’s a guarantee of functionality. Three different people could implement a feature three different ways, but from the perspective of whoever is using the interface, it will function the same way.

Most cars have a the same interface: gas, brake, wheel, but there could be slight variations as to how the gas pedal is designed. I don’t care though, I’m just driving the car.