Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.09 KB

04-02-encoding.md

File metadata and controls

32 lines (21 loc) · 1.09 KB

Encoding

Example

Finger counting

When people learn to count, they use their hand. Each finger that is up counts as one, then showing three fingers represent the number three.

If we want to add up to larger numbers we will run out of fingers when we want to go over ten. But we can set a different value to each one and then count to over one thousand.

For example, in our left hand the thumb can be worth one, the index finger can be two, the middle one four, the ring one eight and the pinky sixteen.

Now if we want to represent the number fourteen, we can show our three middle fingers.

Hands made by Freepik from www.flaticon.com. Licensed under CC BY 3.0.

Definition

"Encode" a value is the action of representing it in a specific way, while "decode" is to read that representation to get the actual value.

To successfully encode and decode a value, it is necessary for the sender and recipient to agree on what representation to use.