Disclosure: I'm not a software developer and I don't really have an opinion on this. I'm just curious what others think. π‘
Have you ever come across or created any code that you felt was poetic?
I've heard folks describe code as being written elegantly. I've also heard folks talk about leaving good guidance via comments in their code. But, I'm curious if anybody has seen anybody take these elements and try to make something creative or artistic out of it β not what the code creates, but the code itself.
What do you think? Can code be poetic or artistic in a writerly sense? Do you have any examples of code like this that you'd like to share?
Top comments (35)
Loving this! I'm trying my best to follow and I think I got it. π
By the way, the whole impetus for this post came about because of our conversation here:
So simple yet profound
pure poetry
Is this from perlmonk website? This is quite poetic.
I don't remember where I've seen it first, I have done Perl programming almost 20 years ago :P
Wow!
That's beautiful β€οΈ
Yes! Even Shakespeare agrees:
Haha, well I'm not gonna argue with Shakespeare!
He has his own programming language called Shakespeare
There is an esoteric language called Rockstar, a Turing-complete language where the code is like a song lyrics. Here is how FizzBuzz looks like:
I guess we can say that it is somehow poetic?
Wow! I'd never heard of this before. It's wild looking!
So many great lines in there. "Whisper my world" sounds quite nice. π
The experiences one creates with code can be poetic but as words without intent can seldom be called poetry nor can code without form.
I tried to make that sound arty, did it work π?
lol, mission accomplished. It did indeed sound arty and the content was enlightening too. So, code without form isn't gonna be poetic code. Gotcha!
One thing I didn't disclose above is that I studied Creative Writing in university (my focus was fiction not poetry, but I had my fair share of classes on poetry) and something that I heard pretty regularly was that if you know the rules, you can break them. There were some pretty interesting pieces where someone would intentionally break the rules for different reasons β to make their work stand out OR because they felt it worked better OR maybe even to take a stand against rules that they felt were confining them. I remember learning about prose poetry at the same time I was learning about short, short stories (generally a page long) and I thought, ughhhh, this isn't poetry, this is just another short story, haha! In the end, I don't think it mattered to the writers β they just thought of it as writing.
Anyway, not sure where I'm going with this, besides just saying that I agree with you! I like that you included "intent" in your explanation because I think that is key to what I was saying in the paragraph above. If your intent is to break the form, and you have thoughtful reasons for breaking it the way in which you did, then you can still probably achieve something poetic.
Ada Lovelace, mathematician and widely considered first programmer, daughter of the poet Lord Byron, would most certainly answer your question with a yes. Her mother pushed her into math and science to try to distance her from her father. And Ada once wrote to her mother as a response something like: "If you canβt give me poetry, canβt you give me poetical science?"
Wow! Thanks for sharing this. I had no idea that she was related to Lord Byron. That is pretty incredible. I just briefly looked it up and it sounds like he was a dirtbag of a dad! Still, super interesting stuff. I also love the quote you shared here. π
She used the word science in the quote, but with all the work she did programming Babbage's Analytical Engine, she almost certainly meant that. It makes me wonder what she would have accomplished if she had access to today's computers.
The link you shared has some interesting things in it. I didn't know that despite how bad a person her father was, and that she didn't know him, that she requested to be buried with him. I also hadn't heard the speculation that her programs for the Analytical Engine possibly included horse race gambling predictions.
Haha, the horse race gambling predictions is so out there and seriously cracks me up because we constantly fight spammers who post gambling content on DEV! Please tell me Ada wouldn't have been a casino spammer... π (Kidding, of course!)
But yeah, there was another Ada Lovelace + horse fact in that article that was also super amusing:
It sounds bizarre and so impractical, but I'm in love with this idea, haha!
The steam engine powered winged horse is awesomely crazy (in a good way), and perhaps an example of what she had in mind by poetical science. Although there are videos on youtube of nearly as bizarre contraptions people actually built in early 1900s in early flying attempts.
code is anti-poetic, so when you write code, you basically write an anti-poem, especially when you're working for the industry, you're anti-poetic, that doesn't mean its non-poetic, because writing code is a creative habit, just as writing a poem is, because existence is non-poetic, and non-existence is poetic, there isnt anything less poetic than the poet himself, but in the aetherical battle of a sleep-deprived individual against the frivolous capitalist system, the machine-leviathan, taming the dragon, befriending him, making him compliant and his endeavor fruitful, his work may feel poetic, but for the reality it is too late, now that he has become a robot. I would also say any poem is an anti-poem, because it means reinventing language and its use, therefore id say there are ways to write poetic code, like an elegant solution is always poetic in sense that it counts for programs as well as for a dance. furthermore a poem isnt more poetic if it is written in another language, it must be like music, always in the right language and tone, that means if you write a poem in code-style it is like noise-music, words are words, vibration is vibration, a rose is a rose.
in summary to clear some things up: written words are subset of poetry, and code is a subset of written words, but those are only the levers of the machine. flattering poems are a way to try program and failsafe the heart of human. but a heart must be free, and a robot must do its duty.
This is a really deep take! I'm probably gonna need to read through it a few times to fully understand, but I think I get the gist and it's super interesting.
You mentioned "especially when you're working for the industry" and I think what you're getting at here is that when you're coding for someone to make money, you're doing a job and that feels in opposition to writing poetry which is typically thought of more as a creative expression that was made for the sake of the expression (and not to bring in cash).
But, if someone is coding for themselves, exploring methods, and creating more for the sake of creation and self expression than for dollars, then that would be more in line with writing poetry.
as a human being I am in-between AI, robotics and nature with its consummation needs, I code therefore I am, which is untrue because more true in robotic language will be, I am coded, therefore I am.
If I can write an AI that writes poems, to get dollars for it, then both the code of this program and its return value will be poems, but it will be a very terrible one to read.
there must be a recipient which probably must have a soul or a conscious. so if you think that a machine has a soul or conscious, every bit of zero and one will be part of a breathtaking poem.... but coding and language is related because it means compression of information on a higher level of abstraction, by AI machines may replace our brains but not our deepest inside. when I write a poem, I ask my stomach about his opinion, if he gulps, then it is good, false otherwise.
I think code can be beautiful and satisfying for its own sake. I know that nowadays there's a lot of focus on shipping quickly, but I take a lot of joy in writing beautiful code - not because it will make the product better for users, but because it makes me happy.
That's also one of the aspects I love about Ruby and Ruby on Rails - they give a damn about developer happiness. You can find some good examples in the Rails Doctrine.
I have a t-shirt that says; "Code is my poetry". Yes, definitely code can be poetry ... :)
Haha, that's a great t-shirt! π
That would be a pretty nice addition to the Forem shop... just sayin. π
A lot of the examples here are either code written to read like English language poetry, or mention programs that output something poetic. I'm not sure this was what the OP was getting at...
I do believe code can be poetic. One sense of 'poetic' is:
It's certainly possible to use language constructs in imaginative and creative ways - often resulting in code that is elegant and unique, sometimes reinterpreting or shining an entirely different light on code syntax and grammar.
Code like this could certainly be considered poetic IMO. All art is subjective
I really like that take, Jon!
Definitely open to hearing everybody's different interpretations and find all of this interesting, but you're right that I was thinking along the lines of writing code that is imaginative or creative in some way and less related to writing in English.
There is an esoteric programming language called Shakespeare In which programs are written as a play.
And then there is a poetic language
Also, you can write poetic code in perl or ruby, There is a community website called perlmonk where people frequently submit piece of code written in a poem. There are few other eso langs which produce quite poetic code, like rockstar, or even Ook! can be quite rhyming.