DEV Community

edA‑qa mort‑ora‑y
edA‑qa mort‑ora‑y

Posted on

Should code be like poetry?

"Treat your code like poetry and take it to the edge of the bare minimum." - ILYO

I strongly object to this idea in this week's show. Poetry is intentionally ambiguous, allowing the reader to form their own impression, let their own emotions guide what they see. Code should be clear and equivalent. I do kind of agree with minimalism though.

Listen to hear all of our arguments. Plus, status updates on my food blog programming and Stephane's quest to get a totally anonymous website.

play pause Edaqa & Stephane Podcast

Do you think code is like poetry? Would you like to challenge me, a weaver of verse, with a poetic debate on the topic? :)

Top comments (19)

Collapse
 
moopet profile image
Ben Sinclair

My code's like poetry.

Vogon poetry.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Oh, my...

Collapse
 
alainvanhout profile image
Alain Van Hout

To me, relating 'good' code to poetry is just a fanciful way of saying that code should be pleasant/enjoyable.

Part of why we're having this discussion about the meaning and merit of the quote is because the quote is somewhat poetic, i.e. pleasant to read, but also quite open to diverging interpretations. That is, the quote would be terrible code.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Perhaps that is why the quote doesn't have a real source -- ILYO is all I found it listed under. :)

I'm not sure all poetry is meant to be enjoyable/pleasant. I write a lot of depression/emotional stuff. Perhaps mine is a better reflection of my code than the enjoyable kind.

Collapse
 
alainvanhout profile image
Alain Van Hout

Yeah, I somewhat doubt that most people read that quote and think "indeed, code should take the minimum amount of effort to make you huddle in a corner, sobbing quietly". That said, much code out there does seem to be written with that in mind :).

Collapse
 
szymach profile image
Piotr Szymaszek

Poetry is about interpretation and is often intentionally vague, something you should avoid like the plague when writing code. I get what the author of the quote was going for, but poetry is a bad choice for comparison.

What he implies, I think, is using standards of writing (as in books) in your code - clean, concise and tailored to the way people think.

Collapse
 
gabe profile image
Gabe

You hit some good points. I think I always subscribed to the idea that "Code is poetry" because in a way, beautifully written code - is written art, like poetry?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

There is definitely art in code's creation, but it serves an unambiguous engineering purpose. Like a bridge, or a building, both of which can be visually beautiful, and evoke different feelings in people, yet both have a well-defined structure purpose, and understood principles.

Code can be the same. It serves a specific role, but there may have been many ways to reach that goal. What it does is unambiguous, but there can still be beauty in its form.

Collapse
 
shiling profile image
Shi Ling • Edited

Mm, yes I like the bridge analogy better in expressing how writing software is a artform. I think it takes a lot of skill to masterfully write code to perform complex tasks that is coherent and understood quickly.

I saw this quote today that's really sums it up really well:

Any fool can write code that a computer understand. Good programmers write code that humans can understand. - Martin Fowler, Author of Refactoring.

Thread Thread
 
mortoray profile image
edA‑qa mort‑ora‑y

Yes, good quote. I use it on the chapter "CLEAN CODE AND REFACTORING" of my upcoming book. :)

Collapse
 
simov profile image
simo • Edited

Well, I don't like the word poetry used to describe source code, but at the same time I really do believe that there is a place for art in being software engineer and crafting code in general.

So probably poetry was meant to be used in place of art, which I do agree with.

So art (or poetry) can be used to describe the act of creating:

A good piece of code that you can read without comments and that it's immediately obvious why it's been written, how it's elegant.

Also your podcast is stuck on loading for some reason ..

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

The audio file link has been fixed and it works now.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Yes, coding is definitely an art.

Sorry about the podcast, it did that once before as well. :(

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I think any code with more than a few lines becomes a puzzle. The goal is to keep it a puzzle for children, the 25 piece kind. Unfortunately we at times create 5000 piece puzzles.

Collapse
 
jsrn profile image
James

Yes, in that we're embarrassed by the stuff we wrote in the past, and eventually we'll be embarrassed of the stuff we're writing now.

Collapse
 
adamcosi profile image
Adam
roses are red
violets are blue
errors at runtime
sucks to be you

...yup code should not be poetry

Collapse
 
qluscinski profile image
qluscinski

Is there a difference between high level language programming and low level language programming? Would HLL think that coding is like poetry more? Sorry, luddite newb posting.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

We've fixed the audio file. Sorry about it not working.

Collapse
 
thepeoplesbourgeois profile image
Josh

Name two renowned poems whose meanings, according to their authors, were intended to be ambiguous.