11 ms·
Knuth: Computer Programming as an Art (1974)
- ajdlinux 11y agoI believe the title should be "Knuth: Computer Programming as an Art"...
- auvi 11y agoI do agree. Initially I thought pg wrote it.
- dang 11y agoYes. We changed the title from "Paul Graham: Programming as Art". Submitters: please use the original title except when it is misleading or linkbait. This is in the HN guidelines: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- deleted 11y ago[deleted]
- Methew 11y agoUnexplained Mysteries....Must read http://goo.gl/1VBTyy http://goo.gl/1VBTyy
- twobuy 11y agoI'm only 3 months into coding but I've already heard about Knuth's books. This is a great intro to his writing, I'd like to read more.
- rdtsc 11y ago> 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." Well not only that but we actually stuffed two misnomers in there. It is not really a science, and it is not really about computers. Chip design, graphics, storage, input devices is more about computers as such.
- deleted 11y ago[deleted]
- eng_monkey 11y agoOf course CS is a (formal) science.
- rdtsc 11y agoIs it though? It can certainly be formal. But so is logic, so is mathemetics. I am not sure there is a clear consensus if math is a science. I can go with engineering (but licensed engineers might object to that), art or craft perhaps.
- TeMPOraL 11y agoCS is a funny beast. It's the first time we're seriously dealing with machines executing abstract math directly. There's nothing to study via experimentation - computing is pure math, and hardware stuff is pure engineering (since computation is not tied to particular branch of physics - you can make computing run on anything, not just electrons and photons). It's best to conceptually split the two, if we want to stay with the original terminology. But I guess now it's kind of too late - it's the definition of the word 'science' that will get relaxed.
- crimsonalucard 11y agoKnuth has a very abstract and fuzzy definition of "Art." Personally I feel "art" possesses a more concrete definition. When the most efficient solution to a problem isn't known we rely on art and design to fill the void. When the path to the most efficient solution of a problem is known we rely on "science" or technical procedures to deduce the best possible answer. For many problems in programming we know the best possible solution. However, for most of the apps we build to solve problems in the name of entrepreneurship or business, no efficient solution is known. In fact, in these situations, the problem isn't even clearly defined. When we don't know the "best" solution we use intuition and creativity to come up with a solution that we only intuitively know to be somewhat efficient. Programming isn't the only area where this occurs. All of engineering relies on art and design to solve problems where the most efficient solution isn't known. For example, what is the shortest distance between point A and point B? The answer is a straight line. There is no design or art as part of this solution because a straight line is mathematically proven to be the most efficient possible answer. The answer, in essence, was calculated and thus no "art" or design was involved. Utilizing art in this case would be as pointless as drawing an artsy squiggly line between point a and point b. Now, allow me to modify the problem to make it a little more complex. Instead of calculating the shortest path between two points, how do I find the most efficient way to transport a person from point A to point B? The most efficient answer is mind boggling complex, you have to account for the personalities and definitions of "efficient" for every possible person you can transport, energy, speed, obstacles etc etc. There probably is a most efficient solution but know one knows it. Here, where it is very hard for us to deduce the most efficient solution we rely on Art. With "art" we can come up with multitudes of solutions to the problem on how to transport a person from point a to point b. Cars (thousands of different models), flying vehicles (thousands of different innovations as well) are two possible examples out of many forms of locomotion. The reason why there are so many models/solutions is because we can never concretely determine which "solution" was the most efficient. This is what we mean when we use the word "Art" in the context of "The Art of Programming" or "The Art of combat." We are essentially describing a problem domain space that is so complex our pathetic human minds our reduced to a sort of aimless wandering (aka creativity) to come up with a solution that isn't even the most efficient one. I use the word aimless because we iterate over our solutions endlessly in an endless quest to arrive at the best solution. The "quest" is essentially endless because our "path" is aimless. We will never ever create the most efficient OS or iphone app of all time because we don't even know what the hell that even means. Instead we are cursed to iterate endlessly over our programs creating version after version for all eternity. The majority of problems in the real world rely on a bit of "art" to arrive at a solution. In fact, most of the problems where an "efficient" solution is known are just theoretical conjectures that only exist in an idealized virtual universe. I see this as a good thing. Art is fun.
- kazinator 11y agoArt can occur when the same person is both the source of the requirements for the program, and the implementor of the program. Much of the art is in the coming up with the specification: that is the concept in the art. The concept can be skillfully rendered into code. Concept + skillful rendering = art.
- sbuttgereit 11y agoI agree with this. Perhaps a way to refine this understanding is to consider a different medium more typically believed to be artistic: film. A director will construct the artistic vision (akin to the requirements/concept) and then work with film music composer to add music (analogous to development). Is the composer and artist practicing art? I would suggest that the word "craftsman" is better suited to the work the film composer does (assuming that they aren't also directing). That doesn't mean that a film composer cannot also be an artist in his/her own right, but in this context their input is arbitrarily limited by the artistic vision of the director... even if the director's vision allows for significant discretion by the composer. Most development work, as you point out, has this separation of creative impulse from the implementing crafts. I do think there is "art" involved in programming, but only when the creative impulse is joined with the craft of development in a single mind.
- crimsonalucard 11y agoWhat about algorithm problems for with the most efficient Big-O solution is known? How can you "skillfully" render code when there is only one best possible way to do it? I would argue that in those cases, programming is not an art because the arriving at the solution is very mechanical and there is literally zero room for creativity. Thus imo this answer isn't broad enough to fully define "Art"
- Someone 11y agoChange the constant. Change the x that the big O is about, for example by using vector instructions. Implement a theoretically less efficient algorithm that is faster (examples: switch to a O(n^2) sort for small data set, or to a linear search for smallish arrays)
- locacorten 11y agoI lived the day to see YC giving credit to PG for an article written by Knuth. What's next? Symphony No. 9 by Paul Graham? Theory of Relativity by Paul Graham? The Bible? :-)
- tim333 11y agoTitle now changed from "Paul Graham: Programming as Art" to Knuth:
- ezequiel-garzon 11y agoOK, but why does PG host this? It's freely available: http://dl.acm.org/citation.cfm?id=361612 http://dl.acm.org/citation.cfm?id=361612
- joslin01 11y agoPresumably same reason why someone re-tweets something and now it's on their profile. Or he just felt like it.
- ezequiel-garzon 11y agoGenerally you somehow point to it.
- gjm11 11y agoThat one is a scanned PDF; its contents don't appear to be indexed by, e.g., Google; its availability is dependent on the continued goodwill of the ACM. Paul Graham's copy is plain HTML, sitting on the open web where anyone can see it and index it, and while for the rest of us its availability is dependent on PG's continued goodwill presumably he likes being able to rely on it staying there as long as he wants unless he's explicitly forced to take it down somehow.
- ezequiel-garzon 11y agoYou have a point. I still find it odd to use a personal domain (other than the author's) for this purpose, with the Internet Archive and other options being available.
- dschiptsov 11y agoIf we define an art as strive to reach an aesthetic global optimum, by balancing form and meaning (syntax and semantics, if you wish, design and implementation) with attention to every single detail, then [some] programming is an art without a slightest doubt.
- crimsonalucard 11y agoAesthetic global optimum can never be reached as it changes with time and differs among people. We are cursed to eternally iterate over our programs in attempt to reach this lofty goal. Let me know if you've seen any program that can be described as aesthetically optimal.
- dschiptsov 11y ago> Aesthetic global optimum can never be reached Do you honestly think that writers, painters or composers doesn't know it, or it stopped them from striving? Millions of little pieces - Data modules from GHC, especially logic, lists, big chunks from Erlang stdlib, lib9, libbio, libutf from Inferno, parts of various Lisps, tons of code from carefully written books (PoFAD, PAIP/ALMA, OnLisp, etc) well-crafted projects like nginx, or even something like this: http://karma-engineering.com/lab/wiki/Bootstrapping8 http://karma-engineering.com/lab/wiki/Bootstrapping8 [shit removed]
- crimsonalucard 11y agoDude, I wasn't even arguing with you. It's a true statement. My response was not meant to be in opposition to yours, it's just a remark. There was no need to say that. Don't start shit. Your comment needs to be flagged.
- dschiptsov 11y agoOK. Sorry. Flag it if you wish. It seems that I should stop reading Russian political forums.
- xixixao 11y agoI take for Science the natural and social sciences (see Wikipedia article on Science). In other words, Physics and all its sub divisions. In this respect, programming is not a science. CS is mostly a sub division of Math (also, not a science). Programming is a mix of engineering (that is finding an optimal solution given a set of known tools to a non-universal problem) and art - anything that allows for creativity in the forming of a finalized product. Most engineering disciplines have an aspect of art in them, but programming is perhaps the most artful thanks to the incredibly wide range of close-to-optimal solutions. But programming is also one more thing: a social process, the process of organising people and their work (which is neither science, nor math, nor art).
- osoti 11y agoLionel Messi wins 5th time Ballon d’Or trophy http://goo.gl/IM6ikr http://goo.gl/IM6ikr
- proc0 11y agoGreat read. Indeed programming is not a 'gentle art', I would say it's a 'brutal art'. There was an article outlining a continuum between art and science, where engineering was somewhere in the middle. Art is the least rigorous of them, while science has the most rigor. Being a science enthusiast, reading on quantum physics, evolutionary biology, etc., I've learned more/less how scientists think. It has a lot to do with coming up with not only good explanations, but explanations that are extremely hard to vary. Explanations that risk falling apart if you try to change any aspect of it. This together with a mountain of evidence supporting said explanation, makes for good science. Art on the other hand, is arguably vague by definition. Art that is doesn't leave room for interpretation is often bland. Art also has a huge human component, whereas science tries to do away with it. In my opinion, programming can easily be both an art and a science. There's no need to constrain it to either one. On one hand, you have the mathematical theory of information, describing a hard-to-vary explanation that is backed up with great math(s). On the other, you have an infinite set of tools from which you can craft whatever your imagination is capable of coming up with. Programming, having its foundations in mathematics, leverages its infinite potential, and with it the possibility of creating both works of art, and scientific facts. It is this universe of possibility that takes only the toughest of minds to venture and explore.
- henrik_w 11y agoOn the subject of art and programming, I really like how Fred Brooks described it in "The Mythical Man-Month": The delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of imagination. Yet the program construct, unlike the poet’s words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. I wrote more on this subject in "Why I Love Coding" http://henrikwarne.com/2012/06/02/why-i-love-coding/ http://henrikwarne.com/2012/06/02/why-i-love-coding/
- cynik_ 11y agoThis was my favourite quote from the mythical man month too: https://www.facebook.com/photo.php?fbid=10151890981137214&set=a.10150393177332214.411194.525117213&type=3&theater https://www.facebook.com/photo.php?fbid=10151890981137214&se...
- ricksplat 11y agoBertrand Russell also had this to say: Mathematics, rightly viewed, possesses not only truth, but supreme beauty—a beauty cold and austere, like that of sculpture, without appeal to any part of our weaker nature, without the gorgeous trappings of painting or music, yet sublimely pure, and capable of a stern perfection such as only the greatest art can show. I think this could equally be said for computer programming, except it is given life. We can see theory animated.
- 2sk21 11y agoNice posting. Captures my feelings very well.
- jim-greer 11y agoProgramming is much more of a craft than it is either an art or a science. Good craftsmanship combines beauty with utility, as does good coding. Programmers work with abstractions, rather than with wood or clay. And their craft is as cerebral and intellectually demanding as an art or a science. But it's still a craft.
- ricksplat 11y agoIf I recall correctly this was Brooks stance - can't remember if it was the mythical man month or one of the related essays. But they're approaching it from different angles: Brooks manifesto was very much in the commercial setting. Knuth perhaps inhabits that more platonic problem domain. For me it's quite a philosophical pursuit and for those programming in an applied scientific context maybe it's more em scientific.
- randomsearch 11y agoI agree, craft is much more appropriate. I think this is a confusing essay, because in everyday speech "art" is employed to mean something very different from "an art" and we get lost in semantics. The continued references to obsolete definitions confuse things further. In practice, the phrase "an art" is usually used in the same way as "an artform", as it is not meant to be taken literally; a commentator may say "there's a real art to mastering the offside trap" in football, but he does not mean that the defender should be put in a glass case in a contemporary art gallery. The whole art/science classification of programming appears to me to be people defending their philosophy or encampment. If you're working in formal methods, you're likely to say "it's about the science", but if you're hacking the last cycle out of a console processor in the games industry you might say "wow, that was really clever, it's really an art this isn't it?" I'd say both of these views are daft. "Science" is usually synonymous with Physics/Chemistry/Biology, which are inescapably different from programming or Computer Science. Similarly, fine arts is not isomorphic to programming. What we usually do is much more like a craft. Sure, it has elements of engineering and maths, and in CS research we borrow some of the scientific method some of the time, but you could probably say the same about any craft, e.g. making jewellery, pottery, etc. All crafts can strive for both beauty and utility, and can borrow from scientific methods and engineering when appropriate, but "pure" science or "pure" art they ain't. There's no ground truth in craft, and there's a strong degree of utility, which precludes it from being science or art respectively. I've heard this discussion dozens of times. Always the mathematicians want CS to be a science, and the hackers want it to be an art or maybe engineering, but I think the argument is counter-productive. Programming is quite unique, but if you really want a relative description, it's kinda like a craft that uses certain maths and engineering in places. I think dropping "science" from "Computer Science" would help immeasurably. Simply renaming a university department to "Computing" might stop students and staff worrying what they are.
- bradhe 11y agoI start having a real tough time with this "code as art" argument when "code" becomes little more than gluing some Rails bullshit together.
- majewsky 11y agoThis fits in well with the "code as craft" argument presented in the comments here. Most craftsmen need to make a living by producing rather boring, functional pieces in a large volume, while occasionally taking the time to manufacture an intricate masterpiece. In this sense, your run-of-the-mill Rails app is the IKEA table of coding.
- pjbrunet 11y ago"According to most dictionaries "science" means knowledge that has been logically arranged and systematized in the form of general "laws."" Ahh yes, the logical arrangement. Programming Law #1: Thou shalt tab to indent. Programming Law #2: Nested loops shall indent deeper to the right. How about the six laws of depth in art? 1. Perspective - 2-point, 3-point... 2. Lower on canvas is closer, higher is further away 3. Atmosphere - clearer is closer, blur is further 3b. Color intensity - higher saturation is closer 4. Chiaroscuro - the next alternation is further (combination of #2 and #5) 5. Overlap - this behind that 6. Scale - bigger is closer Art has plenty of laws, some very complex, but you won't find them in Google. You have to find the artists' artist and mix her color 5000 times, like roll-on-your-head Shaolin Temple skull-hardening. Return to the 36th Chamber and draw with charcoal attached to the end of a long stick of bamboo, then ring the bell, for another style has died.
- _petronius 11y ago> You have to find the artists' artist and mix her color 5000 times, like roll-on-your-head Shaolin Temple skull-hardening. Return to the 36th Chamber and draw with charcoal attached to the end of a long stick of bamboo, then ring the bell, for another style has died. Or, you know, go to art school.
- _petronius 11y agoWhy the downvote aggro for a tounge-in-cheek quip?
- pjbrunet 11y agoIt wasn't me. I think art school should help, but you never know what you're going to get there. A lot of info slips through the cracks.
- camperman 11y ago"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." So true. Robert Rodriguez filmed El Mariachi with almost no resources. It's why the demoscene produced - and still produces - such amazing creations within its self-imposed strict limits. It's one of the reasons why the Raspberry Pi is so popular and why you see the most beautiful ARM assembly on the Gameboy. And conversely I think it's why Web development is collapsing under the weight of too many shiny things. It's lethargic and living in the lap of luxury. I watched a video the other day of AirBNB talking about the evolution of its Web site. The 2008 version was fine: Rails, a database and dynamic page output. The 2015 version was insane: Rails, React, Node, all sorts of dependencies, some stuff I'd never heard of but that the speaker assured was good, complex mobile optimization when you could instead, you know, just write lean and mean mobile-friendly HTML. Limit yourself instead and see what happens - the results might just be awesome.
- picardo 11y agoI think you're mixing up the intended use of the "toy project," i.e. skill development, with the complexity of a real world project with a growing number of use cases, including a proliferating number of mobile devices and features –– just something to keep in mind.
- camperman 11y agoI was stirring :) I think that it's not coincidental that Web development frameworks are collapsing under their own weight and programmers are going mad because there's just too many shiny things.
- scandox 11y ago"A knowledge of the Science of Number is of minor importance; skill in the Art of Reckoning is absolutely indispensible." I laughed out loud at that.
- lionize 11y agoPaul Graham is no Knuth
- scandox 11y ago" 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." I love the way Knuth expresses himself.
- workitout 11y agoLove this part, "In fact, when I first picked up a dictionary in order to study the words "art" and "science," I happened to glance at the editor's preface, which began by saying, "The making of a dictionary is both a science and an art.""
- myth_buster 11y agoAlso "The science without the art is likely to be ineffective; the art without the science is certain to be inaccurate."
- zekevermillion 11y agoWhy is it that "it's more art than science" gets so much use, whereas "it's more science than art" is never used? We use the former to explain why a given process is not deterministic -- for example, appraising artwork, drafting a business plan. Why is it never necessary to explain that a process is deterministic?
- ilzmastr 11y agoBecause deterministic processes are easy to predict and therefore boring? :)
- peter303 11y agoI've always felt writing working software was like creating art. I am pleased when something works and does something interesting after a long effort.
- ilzmastr 11y agoPaul Cronin: Are you an artist? Herzog: Never. All I've ever wanted to be is a foot soldier of cinema.
- laacz 11y agoPractically anything can be performed at the level that it would be considered an art.