3 ms·
This post is nice, but I think it misses one of the key ways in which code is art: the structured expression of creative thought. When I have thought long and
by n4r9 2y ago
This post is nice, but I think it misses one of the key ways in which code is art: the structured expression of creative thought.
When I have thought long and hard and really truly understand how to implement a solution to some tricky problem, I have often broken it down in my head into conceptual functions that make it easy to understand how it works. These conceptual functions often map on to functions in the code. Physically writing out the code is equivalent to saying to someone (and the computer!) "hey, you can think about this problem like this".
It's similar in nature to a mathematical proof. Sometimes when I'm reading someone's code, I see a seemingly difficult task accomplished in a few simple lines. When I pore over those lines, I have a lightbulb moment. The same can happen when reading a mathematical proof. In Lockhart's brilliant essay A Mathematician's Lament[0], the author talks about teaching the formula for the area of a triangle to school students. There is a brilliantly simple and pretty proof of the formula (in the case of unslanted triangles) on p.3. Looking at this diagram is like looking at the code implementing an ingenious short algorithm for solving a thorny problem.
I see a lot of discussion about readability in the sense of making the code as easy as possible for another person to understand with as little thought as possible. And that's very valuable. But I think there's also a lot of value in occasionally encouraging the reader to think in a new way.
[0] https://worrydream.com/refs/Lockhart_2002_-_A_Mathematician%27s_Lament.pdf https://worrydream.com/refs/Lockhart_2002_-_A_Mathematician%...
- WCSTombs 2y agoThanks for expressing this. When I hear "code as art," I think of code that is itself poetic, which I think is the same thing you're saying here. Like natural language, computer code can be prosaic or poetic.