Software quality would be much better if programmers adopted "literate programming", according to Stanford University's unique professor emeritus of the art of computer programming Donald Knuth.
Most of today's software is buggy because not everyone has converted to literate programming, Donald Knuth, author of the work on algorithmic analysis, "The Art of Computer Programming" and the TeX typographic programming language, told Computer Weekly.
Knuth was in London to give the 2011 Turing Lecture at the Institution of Engineering and Technology (IET). He has just finished two major projects, the final volume of "The Art of Computer Programming", and his eight-volume collected publications.
Literate programming, which Knuth proposed 10 years ago, leads to "beautiful", concise and less error-prone programs that can deal with massively complex problems that are hard or impossible to do with normal algebraic programming languages, Knuth said.
"There is another style of programming which says 90% of it runs kind of OK, so some people are content to let it go at that," he said.
"Programs should be written for human beings to read, not just computers. I consider myself a reporter or an essayist, and this attitude makes my programs better in almost every way," Knuth said.
"They tend to work more correctly, are easier to change, easier to maintain, and just a pleasure to write and to read," he said.
He had given Microsoft's Bill Gates a copy of the book, but it had not become required reading at Microsoft, he said.
He said some of his ideas on literate programming have been taken up by industry. Staff at a Hewlett-Packard engineering and instrumentation division in Boise, Idaho, had picked up his ideas, as had chip designers at AMD. "But not Intel, for some reason," Knuth said.
Knuth said that previously, British programmers had produced much better programs than in the US. He put this down to better familiarity with classic literature.
But the gap was closing. "Not everyone can or wants to write programs," he said, but blogging and social networking were teaching people how to write better sentences and hence better code.
He acknowledged the discipline of writing better sentences did not necessarily translate into better paragraphs or chapters, still less into systems design.
But Knuth's literate programming technique is to break systems down into elementary coding statements that could be re-used. This idea is the basis for service oriented architecture (SOA) environments today.
Knuth became in 1971 the first person to win the ACM's Grace Murray Hopper award. He has since received the Turing Award, the National Medal of Science, the John von Neumann Medal and the Kyoto Prize.