The Tyrant Fears the Code Poet

Steffany Brown
Nov 3, 2019 · 7 min read
Photo by Humphrey Muleba on Unsplash

During the earliest stages of my nontraditional software engineering education, I would often sit down to code and place my computer on a table covered with books of poetry. I loved coding but drew my power and sustenance as a Black woman from the words of poets like Jamila Woods, Jericho Brown, and Fatimah Asghar. The apparent contradiction between my interests always left me with a tiny itch, somehow, but I couldn’t quite put my finger on what the feeling was trying to tell me. I went on improving my coding skills while amassing poetry collections until one day, during a routine dive down some random internet rabbit hole, I stumbled upon precisely what I needed. I’d discovered the solution to that peculiar itch: code poetry. The tools for a robust engineering and artistic medium were right in front of my face, and I had finally found the connection!

Reprinted from

Code poems are a type of writing that combines traditional poetry with computer code. These poems, written in various coding languages, may or may not run as executable programs. This discovery filled me with excitement, both because I understood the challenge of learning to code as an adult, and because my previous career had involved educating girls and gender-nonconforming youth in technology and engineering. I immediately recognized the familiar pairing of art with science, technology, engineering, and math (STEM). This pairing is a combination that research shows leads to increased participation, higher racial and gender diversity, and improved retention within STEM fields.

Now that I’m a professional engineer, I can say that writing code poetry has only become more important to me. Approaching coding with a poetic lens sparks my creativity, improves my mastery of coding languages, and helps keep me emotionally grounded in a technical environment where I am a minority of a minority. Plus, it’s just super fun.

Getting started

Before you start writing, take a look at an interactive code poem template here. This poem is written in a JavaScript framework called Node.js. I chose this language simply because it’s my primary coding language at the moment.

To run the poem, click the green “run” button at the top of the page. To interact with this code and make your own changes, simply click the “fork” button to the left of the “run” button. This will copy the poem into an editor where you can make changes to the code yourself. Note that the lines that start with // are comments that the machine does not run.

Let’s walk through a poem

To dive deeper into a code poem, we will use another poem, “Awareness(person)”. You’ll see that the poem itself is 29 lines long and produces 2 lines of output when it is run. I will dissect the components of this poem, which can all be customized and reused as building blocks as you create your own code poetry. is a piece of code for creating output that prints whatever you put in the parentheses. Make sure you use quotes when you want it to print a string of words! This line is what causes my poem to print “Welcome,” as it begins to run.


The first thing we see is a variable. A variable in JavaScript is just like the concept of a variable in math, but JavaScript variables can be equal to more than just numbers. Our variable here is equal to an Object. In JavaScript, if you want to use a variable and then reset it later, you must introduce it with let the first time you use it. After that, you can use just the variable on its own throughout the rest of your code.


This piece of code is called an Object in JavaScript. Other languages have other words for similar data structures, but you can think of it as a “key” and a “value.” The word to the left of the colon is a key, which will give you access to whatever value it has to the right of the colon. The Object can have as many key/value pairs as you’d like. In our example, anytime I want to get the value of conscious, I will type anAndroid.conscious. That notation will give me "I am me."

If this is a little confusing, try adding a after line 29 to see how your program changes. Also, try


This is a function. A function is a set series of operations (sort of like tasks) that are performed on a given input. This input is referred to as a “parameter.” Our example function has a name: Awareness() and a parameter: person. This function has several operations inside of it, so we’ll look at each step-by-step.

We see more variables here. They are all set to empty strings of words because we want to reset their values to other words later on.

Conditional Statements

This part is a little trickier because it is an if/else statement, which is something called a conditional statement. An if/else statement gives a condition, then tells the machine what to do if that condition is true and what to do if not. A breakdown of the template for this is:

if (a condition) {"do this if true")
} else {"do this if false")

In order to understand the conditional statement in our poem, you must know that && means “and” and || means “or.” So we’re saying, “if the person Object that is given to our function has the keys machine and conscious, or if it has the key human, do one thing. If it doesn’t meet either of those conditions(else), do a different thing.”

If our condition about our person input is met, we reset our variables from before, then add them together to make a phrase.

If our condition is not met, we return what we were given as input: person.

Make sure you close your function with a final };

Almost there!

Now we create another variable to hold the result of our function. We give the Awareness function an input of our anAndroid Object. It will perform the operations that we laid out then set the result to equal our freedom variable.

Lastly, we print out the result!

Play Around

Try renaming the variable anAndroid throughout the code and see what happens. Play with making changes to different words, but remember that you have to change the name of a variable or a function anywhere that it shows up in order for the code to run properly! For example, if I only change anAndroid on line 3, but not on line 29, I will get this error when I try to run my code:

If you come up with any other errors, copy and paste them into a search engine to find solutions to your error! This is a valuable problem solving tool that coders use every day.

You did it!

Yes, that was a lot for a beginner code poem, so congratulate yourself for getting through it! Now have fun playing with these examples and using the pieces to craft your own poem. The example poems run, but the most important thing to remember is that you do not have to make poetry that runs in order to be a code poet!

You can search through the documentation that I referenced throughout this article to find pieces of code that inspire you and put them together to form your poems. Please post links to any poetry that you create in the comments. I’d love to see what you all come up with!

The Startup

Medium's largest active publication, followed by +588K people. Follow to join our community.

Steffany Brown

Written by

Software Engineer // Social justice advocate // Lover of afro-futurism // Dog-mom to Turing 🐶 //

The Startup

Medium's largest active publication, followed by +588K people. Follow to join our community.

More From Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade