Hacker News new | ask | show | jobs
by eru 3625 days ago
> The more I write code the more I realize that the entire purpose of the code is to have some effect on reality, [...]

Perhaps. But there's the effect you get from running the code on a computer. And the effect reading the code has on humans.

1 comments

I'm not sure it's possible to write a piece of software that only you understand, that is of high quality (works reliably). I feel like code correctness (what a computer does with it) and readability (how well a human understands what is written) are two sides of the same coin.

I think I would argue that if someone has happened to write a program that is impossible to understand for human readers (unreadable), and yet it does exactly what it's supposed to do (is correct), at the very least this program will break when the author starts to refactor it, which always needs to be done at some point.

I agree that conveying an idea to another human being through code is useful, but I think the number of times a human being has written a piece of computer code only to convey an idea to someone else is fairly small. If I want to convey an idea to another person I write in words and concepts, but if I want something faithfully executed every time, I need to write the code. And perhaps someone will look at this code later, but the origin of the code was always to get something done, not conveying an idea to someone else.

You can write a program that's hard to understand for humans, but comes with a computer-checkable proof of its correctness.

But aside from that pedantic possibility, I agree with most of the spirit of your comment.

Code can be useful to communicate with humans. In fact, the most expressive programming languages should be better at conveying precise descriptions of algorithms to other humans than natural language.

(Not a lot of programming languages reliably reach that ideal. Haskell sometimes comes close.)

I regularly write code that's meant to convey ideas, eg when explaining concepts, algorithms and data structures to people.