TITLE: A Program is an Idea AUTHOR: Eugene Wallingford DATE: November 24, 2007 5:43 AM DESC: ----- BODY: Recently I claimed that scientists should learn to program. Why? I think that there are reasons beyond the more general reasons that others should learn. As more and more science becomes computational, or relies on computation in some fundamental way, scientists will build models of their theories using programs. There are, of course, many modeling tools to support this activity. But a scientist should understand something about how these tools work in order to understand better the models built with them. Scientists may not need to understand their software tools as well as the computer scientists who build them, but they should probably understand them better than my grandma knows how her e-mail tool works. Actually, scientists may want to know a lot about their tools. My physicist and chemist friends talk and write often about how they build their own instruments and mock up equipment for special-purpose experiments. There is great power in building the instruments one uses -- something I've written about as a computer scientist writing his own tools. Then again, my scientist friends don't blow their own glass or make their own electrical wire, so there is some point at which the process of tool-building bottoms out. I'm not sure we have a very good sense where the process of a scientist writing her own software will bottom out just yet. Being able to write code, even if only short scripts, puts a lot of power into the scientist's hands. It is the power to express an idea. And that's what programs are: ideas. I read that line in an article by Paul Graham about how programmers work best. But the crux of his whole argument comes down to that one line: a program is an idea. As a scientist creates an idea, explores it, shapes it, and communicates it, a program can be the evolving idea embodied -- concrete, unambiguous, portable. That is part of what I inferred from the presentations of earth scientist Noah Diffenbaugh and physics educators Ruth Chabay and Bruce Sherwood at the SECANT workshop, Programs are part of how the scientist works and part of how the scientist communicates the result. Reader Darius Bacon sent me some some neat comments in response to my Programming Scientists entry on just this point. Darius expressed frustration with the way that many scientific papers formally explain their experiments and results. "Why don't you just *write a program*?" he asks. He agrees that especially scientists should learn how to program, because it may help them learn to communicate their ideas better. I look forward to him saying more about this in his blog. A scientist can communicate an idea to others with a program, but they can also think better with a program. Graham captured this from the perspective of the software developer in the article I quoted earlier:
Your code is your understanding of the problem you're exploring.
Every programmer knows what this means. I can think all the Big Thoughts I like, but until I have working a program, I'm never quite certain that these thoughts make sense. Writing a program forces me to specify and clarify; it rejects fuzziness and incoherence. As my program grows and evolves, it reflects the growth and evolution of my idea. Graham says it more strongly: the program is the growth and evolution of my idea. Whether this is truth or merely literary device, thinking of the program as the idea is a useful mechanism for holding myself accountable to making my idea clear enough to execute. This is one of the senses in which Darius Bacon's notion of program-as-explanation works. A program might be clearer than the prose, "and even if it isn't at first, at least I could reverse-engineer it, because it has to be precise enough to execute" (my emphasis). And what helps us communicate better can also help us to think better, because the program in which we embody our thoughts has to be precise enough to execute. I know this sounds like a lot of high-falutin' philosophizing. But I think it is one of the Big Ideas that computing has given the world. It's one of the reasons that teaching everyone a little programming would be good. There are practical reasons for learning to program, too, and I think we can be more practical and concrete in saying why programming is especially important to scientists. In science, the 20th century was the century of the mathematical formula. The ideas we explored, and the level at which we understand them, were in most ways expressible with small systems of equations. But as we tackle more complex problems and try to understand more complex systems, individual formulae become increasingly unsatisfactory as models. The 21st century will be the century of the algorithm! And the best way to express and test an algorithm is... write a program. -----