Saturday, August 6, 2011

Expression

I was at first so disheartened by Luke Plant's little essay:

I feel like a human compiler, translating the Haskell or Python in my head
into a language which is a whole level lower.

Haskell, Python and R are pretty much all I use these days. Will I ever be able to go back to one of those rigid, Industrial Grade tongues?

I think there is hope.

Remember, programming is poetry. When you have written 50 lines of C, don't think to yourself "gee, that would have been 10 lines of Haskell"; think, ah, here are 50 lines in which to express myself.

The program can describe more than the algorithm. You can put your thoughts into it. Make every line count.

Also, be grateful that you have verbs. Haskell doesn't have verbs; it has many nouns and prepositions. Nouns and prepositions can be combined every which way, just like pieces of Haskell code.

Verbs, on the other hand, are rigid. They can occur only so often, and they propagate their structure to the space around them, requiring a subject and inviting an object or complement.

The presence of verbs of course limits C, but it makes it more natural. You spend most of your life speaking with verbs, and you should welcome the chance to use them in code.

I can't tell you that Haskell or Python wouldn't be better. But I can tell you you can use what you have to reflect your thoughts. Maybe just not the same thoughts you would have otherwise.

No comments:

Post a Comment