Monday, September 12, 2011

Computer Programming: Art or Science?

Donald E. Knuth, one of the world’s eminent computer scientists, published hundreds of papers and evangelized computer science through his writings and teachings. His three volumes of ‘The Art of Computer Programming’ are among the most popular books in computer science.

In an interview he said, “When you write a program, think of it primarily as a work of literature. You’re trying to write something that human beings are going to read. Don’t think of it primarily as something a computer is going to follow. The more effective you are at making your program readable, the more effective it’s going to be: You’ll understand it today, you’ll understand it next week, and your successors who are going to maintain and modify it will understand it.”   

Programming is not a mechanical activity. Successful compilation of programs is not the end to programming. Putting your programs through a static analysis tool (for eg., JTest) is just the beginning. Programmers need to understand the errors reported by such tools and develop the ability to pick and choose the right set of fixes that can improve code quality. Also, programmers need to practice refactoring in order to improve code quality.

An interesting analogy is cookery. Those who carry the passion for cooking do not blindly follow a set of instructions or restrict themselves to using state-of-the-art tools. They think of it as a work of art. 

By the way, the full version of Donald E.Knuth's interview is available at the website of Dr.Dobb's journal.

No comments: