⚙️Bytecode
Also known as Byte Code, Intermediate Code
A halfway form of code. A virtual machine runs it on any computer.
Think of it like
Think of it like sheet music. It is not the sound yet, but any player who reads music can play it.
Example
A team builds one Java file of bytecode. The same file runs on their Windows laptops and their Linux servers.
Why it matters
Java, C# and Python all use it. That is how one program runs on many kinds of machine.
Definition
Example code
console
$ python3 -m dis add.py
...
LOAD_FAST_BORROW_LOAD_FAST_BORROW 1 (a, b)
BINARY_OP 0 (+)
RETURN_VALUECommon mistake
Key takeaways
- 1Halfway step. Between source code and machine code.
- 2Needs a VM. A virtual machine runs it.
- 3Runs anywhere. One file works on many machines.