(Source: Happy Photo Stock/stock.adobe.com; generated with AI)
Since the 20th century, computing has been dominated by electrons, bits, and transistors, which are key building blocks of digital technology. While technology has shrunk and programming languages have come and gone, the fundamentals have stayed the same for the most part, with the electron ruling the day. I recall cutting my embedded engineering teeth with Stamp microcontrollers and the PBASIC programming language. It was cumbersome at best. Flash forward 20 years, devices such as Arduino and languages like CircuitPython have significantly improved the ease of programming embedded systems. But still, the electron and the bit represent the fundamentals, just as they did in my Stamp PBASIC days.
However, all that might change tomorrow. A paradigm shift is emerging. Quantum computing is the new kid in town, and it’s changing the tenets of computing in the 21st century. To help understand these changes, this blog outlines how quantum programming languages move beyond classical bits to harness superposition, entanglement, and interference, shaping the future of computation.
At first glance, the syntax of quantum programming languages looks only slightly different from the current languages used in traditional computing, such as Python, Java, C++, Rust, or Go. For example, a code snippet written in Google’s Cirq programming language looks like this:
import cirq
# Define two qubits
q0, q1 = cirq.LineQubit.range(2)
# Create a quantum circuit
circuit = cirq.Circuit(
cirq.H(q0), # Hadamard gate
cirq.CX(q0, q1), # CNOT gate
cirq.measure(q0, q1) # Measurement
)
print(circuit)
We can already see some familiar programming concepts without trying to understand what the Cirq code does. Functions, variables, and assignment operators are similar to Python, so it’s probably safe to assume that Google based Cirq on that popular language. Other quantum programming languages, such as Microsoft’s Q#, IBM’s Qiskit, and Quipper, all have a familiar syntactical look and feel.
So, what is the difference between quantum programming and traditional programming? Let’s take a step back and understand the fundamental nature of quantum computing.
Quantum computing is a rapidly evolving ecosystem. It is far from mature and will likely undergo significant growth and radical changes in the months and years ahead. But for now, let’s look at some fundamental topics that are key to understanding quantum programming. And don’t worry; you are not alone if it all feels strange and overwhelming.
Let’s begin by imagining a light switch. In a traditional computer, a bit is like that switch—it can be either ON (1) or OFF (0). That's it. Everything is based on these definite states.
Now, imagine a dimmer switch. It's not just ON or OFF; it can be anywhere in between. That's what a qubit is like. The qubit is the fundamental unit of information in a quantum computer.
Here's where it gets mind-bending:
Just like we have programming languages for classical computers, we need languages to tell quantum computers what to do. Quantum programming languages are designed to:
In contrast to classical bits, qubits can simultaneously exist in multiple states because of superposition and entanglement. Properly managing these states is crucial for accurate quantum computation. Quantum gates are the mechanism by which qubits are manipulated. To achieve superposition, a Hadamard gate (H) is applied to a qubit. Additionally, applying a CNOT gate to two qubits can entangle them. Other types of quantum gates include:
Once quantum gates manipulate qubits, gates are linked together into quantum circuits. Different quantum circuit topologies encode a variety of quantum algorithms. These algorithms solve specific computationally intensive problems where exploiting the quantum phenomena of entanglement and superposition help speed up computations. These problems involve cryptography, optimization, systems of linear equations, and scientific questions involving climate, medicine, and high-energy particles, to name a few. In short, quantum programming will benefit some but not all computational problems.
Two of the more famous quantum algorithms are:
It’s important to note that when you run a quantum program, you get probabilistic results, so best practices call for running the program multiple times to get a statistically significant answer.
So, with all this newfound information under our belt, let’s go back to the Cirq code snippet from before and try to understand what exactly is going on.
cirq.H(q0),
cirq.CX(q0, q1),
cirq.measure(q0, q1)
This outputs a text-based visualization of the quantum circuit:
0: ───H───@───M───
│
1: ───────X───M───
So, in a nutshell, this Cirq circuit does the following:
Lastly, we can add some code to load the quantum circuit into a simulator, run it 1,000 times, and then plot the output as a histogram. The final code will look as follows:
import matplotlib.pyplot as plt
cirq.H(q0), # Hadamard gate to put q0 in superposition
cirq.CX(q0, q1), # CNOT gate to entangle q0 and q1
cirq.measure(q0, q1) # Measure both qubits
# Print the quantum circuit
print("Quantum Circuit:")
# Initialize a quantum simulator
simulator = cirq.Simulator()
# Run the circuit multiple times to gather statistics
result = simulator.run(circuit, repetitions=1000)
# Get measurement results as a histogram
histogram = result.histogram(key="0,1")
# Convert histogram data into a readable format
keys = [bin(k)[2:].zfill(2) for k in histogram.keys()] # Convert integer keys to binary (00, 11)
values = [histogram[k] for k in histogram.keys()] # Get counts
# Print raw measurement counts
print("\nMeasurement Results:", dict(zip(keys, values)))
# Create a histogram plot
plt.bar(keys, values, color='royalblue')
plt.xlabel("Measurement Outcome")
plt.ylabel("Frequency")
plt.title("Quantum Circuit Measurement Results")
plt.show()
Quantum programming is fundamentally different from classical programming—not just in how we write code, but in how computation itself works. While quantum programming languages like Cirq, Qiskit, and Q# may appear syntactically familiar, the underlying mechanics—superposition, entanglement, and interference—introduce an entirely new way of thinking about computation.
Unlike classical bits that operate within binary constraints, qubits exist in fluid, probabilistic states, requiring new techniques to manage their behavior and extract useful results. Quantum circuits, rather than executing sequential logic, manipulate qubits using quantum gates, constructing algorithms that employ quantum mechanics to solve problems that surpass the reach of classical systems.
While still in its early stages, quantum computing holds transformational potential. It promises exponential acceleration in cryptography, drug discovery, materials science, optimization, and AI. However, it’s important to recognize that quantum computing is not a universal replacement for classical methods. Instead, it is a powerful complement, best suited for problems where quantum effects provide a computational advantage.
As quantum hardware advances and quantum programming becomes more accessible, the next generation of developers will need to rethink what it means to write software. The era of electrons, bits, and transistors is now sharing the stage with qubits, quantum gates, and probabilistic computing. Whether as researchers, engineers, or programmers, those who understand quantum computing today are helping shape the future of computation itself.
Michael Parks, P.E. is the co-founder of Green Shoe Garage, a custom electronics design studio and embedded security research firm located in Western Maryland. He produces the Gears of Resistance Podcast to help raise public awareness of technical and scientific matters. Michael is also a licensed Professional Engineer in the state of Maryland and holds a Master’s degree in systems engineering from Johns Hopkins University.