There are countless programming analogies we can draw from video games. One of the longest running and widely recognized games is The Legend of Zelda. The series follows the adventures of Link, a young hero who drops out of college to launch a successful startup in a Palo Alto garage and changes the world as we know it.
How did Link succeed in his quest?
He equipped himself with The Triforce of Computer Science: algorithms, data structures, and Big O.
If you’re not familiar with it, the Triforce is an artifact of The Legend of Zelda video game franchise, with much of the game play centered on gathering and recombining its three pieces. According to Ye Olde Wikipedia:
When the three pieces of the Triforce are combined, they create a divine artifact that has the power to grant any wish. For this reason, the combined Triforce has been the main source of struggle for control within the series, due to its limitless power.
The pieces of the Triforce represent power, courage, and wisdom.
According to Merriam-Webster, the definitions for each of these attributes are as follows:
-
Power: ability to act or produce an effect
-
Courage: mental or moral strength to venture, persevere, and withstand danger, fear, or difficulty
-
Wisdom: ability to discern inner qualities and relationships
I love a good framework, and these easily map to Algorithms, Big O, and Data Structures.
Table time! 🏓
Triforce attribute | Computer science topic |
---|---|
Power | Algorithms |
Courage | Data structures |
Wisdom | Big O |
Like the Triforce, possessing knowledge of these three compsci topics can grant (almost) any wish. Combined, they establish the foundation for solving any programming problem.
⚔️🛡️ Power ↦ Algorithms
According to Ye Olde Wikipedia, an algorithm is:
a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation
We can think of algorithms as items in Link’s inventory, equipping our hero with the tools required to crawl dungeon after dungeon, battle bosses, and build apps for villagers. The more algorithms you acquire, the more you can accomplish. You will also want to collect more powerful algorithms. Don’t expect to vanquish Ganon with the Bubble Sword. You’ll want the Quick Sword for that. But, as we’ve seen over the last few years, algorithms can cause massive societal change, both positive and negative.
With great power comes great responsibility.
Oh, wait. That’s Spider-Man. But still applicable here.
❤️ Courage ↦ Data Structures
According to Ye Olde Wikipedia, a data structure is:
a collection of data values, the relationships among them, and the functions or operations that can be applied to the data
Like heart containers, data structures store the life energy of a program. As the Hero’s Shade says in Twilight Princess:
A sword wields no strength unless the hand that holds it has courage.
And an algorithm is only as strong as the data structure that supports it. You can only accomplish so much without an array. Even then, at some point, an array becomes limiting and you need a tree. Or a graph. Or a Link-ed list ;)
- Wisdom: ability to discern inner qualities and relationships
🦉 Wisdom ↦ Big O
According to Ye Olde Wikipedia, Big O is a a mathematical notation:
used to classify algorithms according to how their run time or space requirements grow as the input size grows
In The Ocarina of Time, Zelda tells Link:
The flow of time is always cruel…
So is the flow of space!
With Big O, we demonstrate wisdom by analyzing the performance of our algorithms and asking the question: “Can we do better?”
How To Be A Powerful, Courageous, and Wise Programmer
Learning to program is an adventure.
It’s dangerous to go alone! Take this: The Triforce of Computer Science