The big advantage MIDI cables bring over other types of data connection between devices is that they are electrically isolated so connecting the MIDI from one device to another will not create hum from a ground loop. The MIDI output from one device is quite literally lighting an LED in the receiving unit. That LED happens to be inside of an "opto-isolator" chip that hides the LED from view but also couples the LED with a light sensitive transistor. When the LED turns on, the transistor turns on, when the LED turns off, the transistor turns off providing a way to move ones and zeros from one device to another.
Because each MIDI cable is really only turning on a single LED, and LEDs only have two leads (an anode and cathode), a MIDI connection can actually be made with only two wires. A third wire is provided as a shield but is only connected at one end of the cable to retain ground isolation. Though standard MIDI connectors and cables provide 5 pins, in most cases only 3 of them are actually used. The original use for MIDI connections was to allow a keyboard player to generate a sound from two or more keyboards by pressing a single key. The connection was simple: connect the MIDI Output from the keyboard you are playing to the MIDI Input on the keyboard you want to "slave". Data only moved in one direction: from the keyboard you are playing to the second slave keyboard. Normally, the data never went in the opposite direction so MIDI evolved with data only moving in a single direction for each cable. Two cables were required to move data to and from a device. Amazing, this is how it was done for decades. Even RS232 cables provided communications in both directions.
As time went on companies started finding more sophisticated uses for MIDI often requiring bidirectional communication: both units can send data to each other. Painfully, a second cable had to be added for the second connection. Eventually, companies started reducing the pain by simply connecting the 2 extra pins to either the MIDI Input or Output chip. Now one cable could send data in both directions which is great for things like remote interfaces which will send control data to a device and receive status information back.
One problem with using a single cable for bidirectional communication is that the use of the extra pins was a desire for backwards compatibility with existing MIDI connections: companies did not want to provide a separate set of connectors for bidirectional communications so there was a problem with using the extra pins. The middle three pins on a MIDI connector can be used for MIDI In OR MIDI Out. If you were designing this to be bidirectional from scratch, you'd just assign the inner 3 pins as the output and the outer pins as the input for instance. There would be only one cable and there would be no way to connect it incorrectly. But, alas, that was not to be and confusion reigned and continues to reign.
Bidirectional communications through a single MIDI cable was a good first step but you still needed to independently provide power to both devices. This is a real drag for almost any kind of remote control but especially for foot pedals. Now you need one or two MIDI cables and a power supply (wall wart). As it so happens, the physical design of the MIDI connector allowed for yet another set of pins to be added that could be used for power. Lexicon's MPX 1 and G2 products have a 7 pin connector for their MIDI Input which will can be used to connect to a Lexicon MPX R1 foot controller. A single cable to the foot controller provides data communications in both directions and power to the foot controller.
If you are getting into MIDI and intend to use it to connect a foot pedal or keyboard live, we'd recommend buying the best cable available and having at least one backup available at all times. Because MIDI happens invisibly, it can be difficult to detect when a cable is becoming intermittent. If in doubt, try your backup cable.
If you are using MIDI in such a way that failure will not result in humiliation and stress, less expensive cables work perfectly well.
High end 5 pin MIDI to MIDI cables:
7 Pin MIDI Cables
MIDI to USB cables:
USB MIDI Interface boxes: