If composers were hackers
Published: 2023-04-01 Last updated: 2023-04-01
- Johan Sebastian Bach
- Wolfgang Amadeus Mozart
- Ludwig van Beethoven
- Alexander Nikolayevich Scriabin
- Closing words
Music is my first true loveComputer games are my zeroeth true love.. The first time I got my hands on an old untuned guitar, I didn't want to put it down. I found a summer job to buy my first instrument and pay for a teacher, and since then, music has been a constant source of joy in my life. Picking a CS degree at a university over a musical college education was a hard choice for me.
I can't help but look at the world through my musical obsession. There are many deep similarities between music and computing but we won't explore them in this article. Instead, I will focus on a silly and subjective question: “If my favorite composers decided to write some code, which language would they pick?”.
Johan Sebastian Bach
Johan Sebastian Bach is the most talented and prolific musician in history.
Bach would love the APL programming language:
- Like a well-written APL program, Bach's music is dense. He achieves immense expressive power with a few well-chosen constructs.
- In his lifetime, Bach was famous not for his compositions, but for his improvisation skills. APL is an excellent fit for live coding because of its interactivity and terseness.
- Motifs and keys bear deep symbolic and emotional meaning in Bach's music. A twisted motif might mean a crucifixion and a sequence of twelve beats might depict a clock striking midnight. APL assigns ingeniously-chosen symbols to all its primitives.
- Bach's productivity was phenomenal. For example, he was cranking at least one cantata (about 20 minutes of music) per week for church services on Sundays for over three years, writing over three hundred cantatas. And it wasn't even his primary duty. Tell me about your tight deadlines. The only programmer who can come close to this level of productivity must be an over-caffeinated APL wizard.
- The Voyager Golden Record contains three compositions by Bach. If we wanted to prove to aliens that we know how to compute, APL would be the best choice for writing programs on golden surfaces.
If you want to learn more about J.S. Bach:
- Listen to the Bach and the High Baroque courseAudible.com offers subscribers all courses I mention in this article for free or at a meager price. by professor Robert Greenberg.
- Read Johan Sebastian Bach: The Learned Musician by Christoph Wolff.
If you want to learn more about APL:
- Read Ken Iverson's ACM Turing Award lecture Notation as a Tool of Thought. The jsoftware website hosts this and many other papers on APL.
- Read Mastering Dyalog APL book by Bernard Legrand and play with the Dyalog APL Tutorial.
- Listen to the ArrayCast and APL.Show podcasts.
- Watch the Depth-first search in APL video for inspiration.
- Consider getting a physical copy of APL: An Interactive Approach book by Leonard Gilman and Allen J. Rose. The content is pretty dated, but this book is one of the most engaging books on programming I've ever read.
Wolfgang Amadeus Mozart
Mozart's musical genius was so bright and incomprehensible that mysteries and myths still surround his life.
Mozart would prefer the Scheme programming language.
- Mozart's music reflects the values of the age of enlightenment and appeals to everyone. It's clean and beautifully constructed. Scheme is so simple that a few pages can introduce most of the language. Before the recent switch to Python, MIT professors used Scheme for introductory Computer Science classes.
- Mozart wrote music in all genres of his time (though he loved theater and opera the most). Scheme is a programmable programming language; it is flexible enough to be helpful in any domain. See Racket and "The Little X" books in the Resources section.
If you want to learn more about Mozart:
- Listen to the Great Masters: Mozart—His Life and Music course by professor Robert Greenberg.
- Read Mozart: A Life by Maynard Solomon.
If you want to learn more about Scheme:
- Read The Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman. It's worth reading even if you don't care about Scheme.
- Read The Little Schemer and related books: The Reasoned Schemer, The Little Typer, The Little Prover, and The Little Learner.
Ludwig van Beethoven
Beethoven is the most influential composer in history. He single-handedly changed the direction of western music and the role of an artist in society.
One of the few languages worthy of Beethoven would be Haskell:
- Beethoven often constructed his music from the interaction and development of small motifs and rhythms, many of which initially seem trivial.
The art of writing good Haskell code is composing programs from small functions, many of which do not do much when considered in isolation (
fix, for example).
- Beethoven was constantly evolving his style, pushing the boundary of musical art. He reinvented himself three times during his career, turning his suffering into fuel for a breakthrough. Similarly, the Haskell ecosystem constantly evolves, turning pain points into new beautiful ways to write and think about software. For example, issues with lazy input/output led to the invention of iteratees, and problems with nested record updates led to optics (such as lenses) and bidirectional programming.
- Beethoven turned my musical world upside down: I caught a piano bug after hearing one of his sonatas. Haskell enormously influenced my professional life, forever changing my thoughts about computing.
If you want to learn more about Beethoven:
- Listen to the Great Masters: Beethoven—His Life and Music course by professor Robert Greenberg.
- Read Beethoven by Maynard Solomon.
- Consider watching the Immortal Beloved movie. The movie has many factual mistakes, but it's inspiring nevertheless.
If you want to learn more about Haskell:
- Read Learn You a Haskell for Great Good! by Miran Lipovača. It's an engaging and illustrated introduction to Haskell.
- Read The Haskell School of Music by Paul Hudak and Donya Quick. The authors show the best sides of Haskell when they apply it to building a library for music generation.
- Check out the Haskell Documentation page for more great pointers.
Alexander Nikolayevich Scriabin
Scriabin is a relatively obscure (at least outside of Russia) Russian composer. I find his music deeply expressive, emotional, and metaphysical. Also, he had the most stylish mustache ever.
Scriabin would love Scala:
- Scriabin dreamed of fusing arts into a synthetic art form he called Mysterium. Similarly, Scala aims to be extensible enough to embrace all programming styles and paradigms (functional, object-oriented, actor-based, etc.).
- Scriabin's music feels profound and unfathomable, like the night sky. Looking at Scala code makes me feel the same awe: I admire its structure and elegance, but its inherent complexity makes my head spin.
If you want to learn more about Scriabin:
- Read The Alexander Scriabin Companion: History, Performance, and Lore by Lincoln Ballard and Matthew Bengtson.
- Read Scriabin, a Biography by Faubion Bowers.
If you want to learn more about Scala:
- Read Programming in Scala by Martin Odersky et al., and Functional Programming in Scala by Rúnar Bjarnason and Paul Chiusano.
There are many more great composers and excellent programming languages. Matching these is an exercise for the reader.
I encourage you to think more often about things and people you like and match them with others. For example, My Favorite Theorem podcast hosts ask their guests to match their favorite theorems with items and activities in their lives, such as pizza and rock climbing.
Enjoy your favorite things!