The other day while hacking away on some C++ code and listening to music, something occurred to me: if I’m programming in C++, shouldn’t the music I’m listening to be in the same language?
So I took a few verses from various random songs and coded up C++ translations of the lyrics. Here’s what I was able to hack together.
2Pac – Dear Mama
English:
When I was young me and my mama had beef
Seventeen years old kicked out on the streets
Though back at the time, I never thought I’d see her face
Ain’t a woman alive that could take my mama’s place
C++:
// When I was young me and my mama had beef
if (this->young()) {
this->append(new Beef());
mama.append(new Beef());
}
// Seventeen years old kicked out on the streets
// Though back at the time, I never thought I'd see her face
if (this->getAge() == 17) {
this->remove(getShelter());
this->seeFace(false);
}
// Ain't a woman alive that could take my mama's place
mama.replacement = NULL;
The Beatles – Hey Jude
English:
Hey Jude, don’t make it bad
Take a sad song and make it better
Remember to let her into your heart
Then you can start to make it better
C++:
// Hey Jude, don't make it bad
jude.it->make(!JudeState::BAD);
// Take a sad song and make it better
sadSong.improve();
// Remember to let her into your heart
jude.setReminder(new Event(JudeState::ENTER, jude.getHeart()));
// Then you can start to make it better
jude.it->make(JudeState::BETTER);
David Bowie – Man Who Sold The World
English:
Oh no, not me
I never lost control
You’re face to face
With The Man Who Sold The World
C++:
// Oh no, not me
// I never lost control
assert(this->control != NULL);
// You're face to face
// With The Man Who Sold The World
Man m;
m.sell(world);
you->setFacing(&m);
m.setFacing(you);
Lady Gaga – Born This Way
English:
Don’t hide yourself in regret
Just love yourself and you’re set
I’m on the right track, baby
I was born this way
C++:
// Don't hide yourself in regret
if (!you->visible && you->regret)
you->visible = true;
// Just love yourself and you're set
you->love(you);
// I'm on the right track, baby
getTrack(Track::RIGHT)->set(this);
// I was born this way
assert(this->state == this->creationState);
The Police – Every Breath You Take
English:
Every breath you take
Every move you make
Every bond you break
I’ll be watching you
C++:
while(true) {
switch(you->getEvent()) {
// Every breath you take
case BREATH:
// Every move you make
case MOVE:
// Every bond you break
case BOND_BREAK:
// Every step you take
case STEP:
// I'll be watching you
this->watch(you);
break;
default:
assert(false);
}
}
Kanye West – Power
English:
No one man should have all that power
The clocks tickin’ I just count the hours
Stop trippin’ I’m tripping off the power
Till then, fuck that the world’s ours
C++:
// No one man should have all that power
for(int i = 0; i < men.size(); i++) {
Man* man = men.get(i);
if (man->has(allThatPower))
man->remove(allThatPower);
}
// The clocks tickin' I just count the hours
setTimer(1, &countHours);
// Stop trippin' I'm tripping off the power
you->tripping = false;
bool power = true;
this->tripping = power;
// Till then, fuck that the world's ours
if (getCurrentTime() != then) {
that->fuck();
world.setOwner(this);
}