Part of code theory, block coding is a form of forward error correction (FEC), also known as a channel code, that converts messages into specific codes and sends the information as a block of data with a predetermined length. Larger blocks of data make it easier for the receiving computer to decode the information and correct errors that occur during the transfer. Block codes and convolutional codes are two code types commonly used in FEC. These types of code allow a message to be sent over an unreliable connection and still be decipherable when it arrives.
The use of block coding is necessary due to noise that occurs when a message is sent. When data needs to travel a long distance or over an unreliable connection, the Hamming weight and distance are used to determine the likelihood of errors. Hamming weight is the number of digits needed to express all possible code combinations, and the hamming distance is how many errors would have to occur before a bit represented a legitimate, but wrong, piece of information.
For example, if a sender using block coding wanted to send a message that could use only three possible codes that were each three digits long, the Hamming weight would be three. The codes might be 000, 010, and 011. If an error resulted in any one digit changing, such as 000 changing to 010, the code would read as a legitimate code (010) but not the code that the sender intended (000). Thus the Hamming distance for this code is one because only one digit needs to change to cause an error the computer cannot fix.
To lower the Hamming distance and reduce errors, data is sent as a block of code which is encoded into specific code words of a certain length. The original message data bits are referred to as k bits. The k bits are translated to corresponding n bits, which are codes that have been selected to stand in as longer codes for each k bit. Ones or zeros are added to make the bits a uniform length and reduce the Hamming distance. Then these blocks of n bits are transmitted to the receiving computer.
Thinking about block coding is simplest when comparing it to two people having a conversation. When talking in a noisy room or shouting across a long distance, there is more room for errors in what the receiving person hears. If the sentence is long, the person can correct more errors by taking the entire sentence in context, but short sentences have a higher error rate because it is harder to decipher what the person is saying.
As an example, if one person shouts, "Red cat" and the other person hears, "Fed cat," they interrupt the sentence incorrectly. If, however, the first person said, "I have a red colored cat" and the second person heard, "I have a fed colored cat," the context of the sentence makes it easy to determine the person actually said "red" and not "fed." This is the basic principle behind block coding and the use of longer, uniform codes to help computers accurately translate a block of information.