星期一, 四月 27, 2009

[Readings] Computer Programming as an Art

钱学森先生的艺术修养是很高的,他夫人就是著名的歌唱家,他在提到科学与艺术的关系时说:"处理好科学和艺术的关系,就能够创新,中国人就一定能赛过外国人"
Knuth在他的这篇文章中更是很好地说明了计算机和艺术之间的关系。

一些摘录:
Computer Programming as an Art
by Donald E. Knuth, 1974

Meanwhile we have actually succeeded in making our discipline a science, and in a remarkably simple way: merely by deciding to call it "computer science."

If we go back to Latin roots, we find ars, artis meaning "skill." It is perhaps significant that the corresponding Greek word was τεχνη, the root of both "technology" and "technique."

the process of going from an art to a science means that we learn how to automate something.

Fifteen years ago computer programming was so badly understood that hardly anyone even thought about ... The point is that when we write programs today, we know that we could in principle construct formal proofs of their correctness if we really wanted to, now that we understand how such proofs are formulated.

Our discussion indicates that computer programming is by now both a science and an art, and that the two aspects nicely complement each other. Apparently most authors who examine such a question come to this same conclusion, that their subject is both a science and an art, whatever their subject is.

The science without the art is likely to be ineffective; the art without the science is certain to be inaccurate.

A scientific approach is generally characterized by the words logical, systematic, impersonal, calm, rational, while an artistic approach is characterized by the words aesthetic, creative, humanitarian, anxious, irrational. It seems to me that both of these apparently contradictory approaches have great value with respect to computer programming. 

Works of Art
My feeling is that when we prepare a program, it can be like composing poetry or music; as Andrei Ershov has said [9], programming can give us both intellectual and emotional satisfaction, because it is a real achievement to master complexity and to establish a system of consistent rules.

Furthermore when we read other people's programs, we can recognize some of them as genuine works of art. I can still remember the great thrill it was for me to read the listing of Stan Poley's SOAP II assembly program in 1958; you probably think I'm crazy, and styles have certainly changed greatly since then, but at the time it meant a great deal to me to see how elegant a system program could be, especially by comparison with the heavy-handed coding found in other listings I had been studying at the same time. The possibility of writing beautiful programs, even in assembly language, is what got me hooked on programming in the first place. 

When we apply our own prejudices to "reform" someone else's taste, we may be unconsciously denying him some entirely legitimate pleasure. That's why I don't condemn a lot of things programmers do, even though I would never enjoy doing them myself. The important thing is that they are creating something they feel is beautiful

I must confess that I really enjoy writing computer programs; and 1 especially enjoy writing programs which do the greatest good, in some sense. 

The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming. 

We shouldn't be penny wise and pound foolish, nor should we always think of efficiency in terms of so many percent gained or lost in total running time or space. 

How did they develop their skill? The best film makers through the years usually seem to have learned their art in comparatively primitive circumstances, often in other countries with a limited movie industry. And in recent years the most important things we have been learning about programming seem to have originated with people who did not have access to very large computers. The moral of this story, it seems to me, is that we should make use of the idea of limited resources in our own education. We can all benefit by doing occasional "toy" programs, when artificial restrictions are set up, so that we are forced to push our abilities to the limit. We shouldn't live in the lap of luxury all the time, since that tends to make us lethargic. The art of tackling miniproblems with all our energy will sharpen our talents for the real problems, and the experience will help us to get more pleasure from our accomplishments on less restricted equipment.

1 条评论:

匿名 说...

Yes indeed, in some moments I can say that I approve of with you, but you may be considering other options.
to the article there is even now a without question as you did in the downgrade publication of this solicitation www.google.com/ie?as_q=who sings somewhere over the rainbow 50 first dates ?
I noticed the catch-phrase you procure not used. Or you use the dark methods of development of the resource. I have a week and do necheg