Learn to Code: read poetry

two piles of books on the desk. On the left poetry books, on the right "Eloquent Ruby"

Yesterday was the anniversary of Wisława Szymborska’s death. She was one of the most acclaimed Polish poets. In 1997, she was awarded the Nobel Prize for Literature. It was a HUGE deal. I remember I was 8 years old, and newspapers were proud of her. I was astonished!  At that point, I hadn’t heard about anyone from Poland getting any international recognition. The closest to fame was Edyta Górniak, who came second at the Eurovision Song Contest in 1994. Ach those 90s! What a time to be a kid! When I got a bit older, I read Szymborska’s work during Polish classes. She wrote many great poems. How beautiful and touching Cat in an Empty Apartment is! Or the Nothing Twice. They are clever, and often use humour to run away from pompous tones. The Joy of Writing, anyone? At school, I read quite a lot of poetry and when it came to answering the immortal question What did the poet think of when they were writing this piece?, teachers knew no mercy. My classmates and I had to analyse every line word by word. We searched for metaphors, allegories, symbols, rhymes, rhythms, you name it. The point was to find hidden meanings in poetic texts.

But wait a minute, this blogpost is meant to be about learning how to code, isn’t it? Yes, you’re right and poetry can help you with it.

Humanities

The stereotype of a programmer is simple: a guy who graduated with a degree in computer science. Bonus points, if he has always been into computers, or at least played video games from the age of 6. To a certain degree, this stereotype is correct, I’ve met many wonderful programmers who fulfil it. However, the stereotype doesn’t paint the whole  picture of the industry, and its future.

Many women enter the tech industry later than men. Usually, after earning a degree in humanities (philology, law, psychology, sociology, journalism, music etc.) or gaining professional experience in a different industry. These are the women I’ve met over the years at workshops, meetups, RailsGirls, conferences etc. They hear that Oh, learning to code will be difficult for you because coding requires analytical thinking. Or I’d like to learn to code but I’m not good at maths.

Analytical thinking is a skill

Analytical thinking can be developed in different ways. When you read a poem for the first time, you may understand it because you know the meaning of the words. But to achieve a deeper understanding you need to search for it, recognise what expressions and rhetorical devices were used. Which parts correspond with each other, which negate each other? Maybe there are allusions to the times the poem was written in? Or maybe there are references to other poems, novels, myths? It is not exactly like searching for dependencies between classes in a codebase, but the skill is pretty similar.

My course at the university, human-computer interaction, included classes from computer science as well as Polish philology. From programming in C to rhetorics. I struggled so badly with learning how to code I could write another blogpost on how not to learn but at the same time I loved analysing literature. And then I started using the tools I used there to understand scripts in C and Python.

Reading poetry taught me how to code. No doubt about that.

Reading as a part of coding practice

In the conversation about learning to program and working as a software developer, there is a lot of stress on the writing. Without a doubt, coding is an active process. Coding is doing. However, as much as we write, we read much more code than we produce. Not only do we add code to an existing code base but also you read while reviewing the work of your peers, documentations etc. Reading comprehension is a key to success. Think about a code review, one usually appreciates a question more rather than just a quick “LGTM!”. Of course there is a difference between reading a script in Python versus reading The Waste Land by T.S. Elliot but I would guess that a person who can understand the latter will have it easier with Python. (No shade on T.S. Elliot’s work)

Read code like you read poetry

Any codebase can seem overwhelming. Especially at the beginning. If you’re dipping your toes into programming and happen to be a so-called humanist, don’t be afraid. It may seem dim but you already have the skill you need, analytical thinking. Treat the code as if it was a poem, study, essay, article, novel etc.

1. Read code line by line. Take your time. It’s a new kind of text in a new language.

2. Search for the definitions. Where are functions, variables etc defined?

3. Draw how it works, draw the data flow. It doesn’t have to be pretty, it should just help you understand.

4. Ask: what? where? when? why? how?

5. Think about how a function could be written differently? Could you paraphrase the code?

Why does it matter?

Thank you for staying long enough to read this sentence. You may ask why I decided to write this bizarre post. Well, I've seen many people doubting their abilities because their path to software engineering was different than the stereotype I mentioned before. I strongly believe that women tend to undervalue the skills they already have. I used to be one of them. Also, as an industry, I think we will stop evolving if we keep our teams away from people who choose different paths, or as Robert Frost called it, the road not taken.

Thank you for reading! Share your opinions with me on Linkedin or Twitter.

PS. If you know someone, who is learning how to code, please share this blogpost with them. It is something I wish I had known when I was at the beginning of my learning path.