|
|
|
|
|
by skermes
5395 days ago
|
|
A lot of people bring up the idea of rigor when I compare prose and code, and I think it's really overemphasized. Just think of English as a language with a really flexible type system that lets you duck type the hell out of everything. In Python, I can write a method that expects a file object, and (at least the last time I used urlopen, which was a while ago) you can pass it something you open from across a network, and a lot of it will still work. Accidentally using a network resource instead of a local resource isn't particularly rigorous, but Python makes it work. English is that, but more so. The key line for me is "... it's hard to use metaphors in writing. It's simply more abstract." I have this working theory that abstraction in programming language is more or less equivalent to metaphor in person language. The core idea behind metaphors is to create a convenient lie that helps expose some aspect of what you're talking about by comparing it to some other domain. Consider my last paragraph. English has no type system. Telling you that it's duck typed is a lie, in the sense that it isn't true. But as a metaphor, it's convenient because lets me unify two ideas (programming languages and regular languages) under one aspect (things that have degrees of rigor). Similarly, having an abstraction over local files and network files lets me take two things that are accessed very differently, and let me pretend they're the same. It's a lie, but it works. I'm not really sure how the abstraction==metaphor relation holds under closer scrutiny. I'm also not certain that it's particularly useful in terms of helping me make better programs, but I like it. |
|
But you can't make leaps with computers. If you forget to tell the computer which file to load, it either crashes, or nothing happens.