In a switch you get on/off, but a button returns to the original setting.
A switch, or, more accurately, a toggle, moves an entity from one state to another until it is triggered again.
A button, or, more specifically, a gate, triggers something just once.
The original keyboard switch, the buckling spring, can be explained as a button, but what actually happens is you press a button, or a key, which compresses a spring, toggling a switch. It is in the release of the key that the distinction arrives.
Once you press the key and hold it, the system will register continuous input of that switch (toggle on). Once you release it, the toggle goes off again.
If the key were to function as a button, holding it would only register as one hit until it is pressed again.
Best explanation so far
I have no idea but I strongly admire your spirit of inquiry. I’ve always felt it was an odd name but was never able to fully articulate why.
A switch is an electromechanical component that can open or close one or more circuits. There are many types of switch, with whole sets of nomenclature depending on how specific you want to get. A keyboard switch is an example of a momentary normally-open single pole - single throw (mom NO SPST) switch [1]
A button is a user interface / mechanical design component which protudes from a surface and can be manually actuated.[2]
You can have each without the other.
While a keyboard switch can be used as a button, it’s not designed for the purpose, it’s designed to have a keycap installed, at which point you do indeed have a button. When we are talking about keyswitches though, we’re specifically interested in the electromechanical component, not the portion that a user pushes.
Source: domain specific education ↩︎
Like you mention, button’s have one state while switches have two. Keys have a KEYPRESS_DOWN and KEYPRESS_UP state, the latter firing when you release the key.
A button only has a down state.
In the automation world, they’d be called buttons. Different areas, different jargons, I guess.
A tiny nit to pick: switches let you select between 2 or more discrete states. The most common one in the industry is the Hand-Auto-Off switch, allowing you to force a motor/thing on, off, or relinquish control to the system.
Maybe it’s some legacy nomenclature from typewriters
I think we get keys from the typewriter but there is nothing on a typewriter that switches a state. Save for clean paper to dirty paper
There are many types of switches. The inner workings of a mechanical keyboard switch are just one example of them.
Here are some links to help understand what’s happening in a keyboard switch and the different types of switches.
Types of switches (general):
https://www.electronicshub.org/switches/Difference in keyboard switches (with animations):
https://www.thekeyboardco.com/blog/index.php/2012/12/an-introduction-to-cherry-mx-mechanical-switches/A (maybe) over-comprehensive guide to keyboard switches:
https://switchandclick.com/mechanical-keyboard-switch-guide/