Inquisitive Programming
There have been many calls in recent years for the introduction of computer science into the US K12 school system. Code.org is one of the well-known organizations advocating for computer science in our schools. They describe themselves like this:
Launched in 2013, Code.org® is a non-profit dedicated to expanding access to computer science, and increasing participation by women and underrepresented students of color. Our vision is that every student in every school should have the opportunity to learn computer science. We believe computer science should be part of core curriculum, alongside other courses such as biology, chemistry or algebra.
President Obama, in his 2016 State of the Union address, said:
We agree that real opportunity requires every American to get the education and training they need to land a good-paying job…. [T]ogether, we’ve increased early childhood education, lifted high school graduation rates to new highs, boosted graduates in fields like engineering. In the coming years, we should build on that progress, by providing Pre-K for all and offering every student the hands-on computer science and math classes that make them job-ready on day one.
The Computer Science Teachers Association (a division of the ACM, a professional society for computer scientists and software engineers) has this to say about computer science in K12 education:
Over the past few decades, computers have transformed both the world and the workforce in many profound ways. As a result, computer science and the technologies it enables now lie at the heart of our economy and the way we live our lives. To be well-educated citizens in a computing-intensive world and to be prepared for careers in the 21st century, our students must have a clear understanding of the principles and practices of computer science. No other subject will open as many doors in the 21st century as computer science, regardless of a student’s ultimate field of study or occupation.
I chose these three particular quotes not to single out code.org or the Obama administration or the CSTA, but because they seem representative of our current national discourse about computers in schools. There is a lot to unpack and critique in the quotes, but first, for readers who are not themselves computer scientists, let’s define some terms.
Some Definitions
Computer science is not actually a science like physics, biology or psychology. At the undergraduate level, computer science is primarily an engineering discipline, and at the graduate level it is also a field of applied mathematics. Some working computer scientists do a lot of computer programming, and some spend very little time actually programming.
Software engineering is the professional practice of programming computers to create robust, high-quality computer software that is embedded in products, installed on servers, used by customers, or otherwise “deployed” out into the world. Software engineers have often studied computer science, but this is not required and many enter the profession without formal training in computer science.
Coding is an informal synonym for computer programming. Both programming and coding describe the craft of translating ideas into “code”–a set of instructions, expressed using the formal syntax of a computer programming language, that make a computer perform the desired computations. Coding is the primary daily activity of software engineers, but this craft of writing computer programs is also useful in other fields to crunch data, model systems, and perform repetitive or complicated calculations. An astrophysicist, for example, might use coding to simulate the lifecycle of a star, a social scientist might use coding to perform a statistical analysis on data, and a mathematician might use coding to numerically test a conjecture. (These are all examples of coding for computational inquiry, a term that I’ll be using much more later in this essay.)
The Cult of Computer Science
With those terms defined, let’s take a closer look at the proposals quoted above for integrating computer science into K12 education. Code.org says “computer science should be part of core curriculum, alongside other courses such as biology, chemistry or algebra”. It makes sense for high schools to offer at least one actual computer science class for college-bound students who are planning to study computer science. But code.org also says that “every student in every school should have the opportunity to learn computer science”. So they’re not just interested in high schools, and since it doesn’t make sense to teach college-prep classes in elementary and middle school, code.org obviously isn’t talking about actual computer science. It is pretty clear from their online offerings (and from their very name) that what they really mean is coding. They’d like every student at every school to have the opportunity to learn to code. That’s great, and I agree, but let’s not call it “computer science” when it is not.
President Obama also advocates for computer science in schools, but he calls it “hands-on computer science” by which I think he can only mean coding. But he goes on to say that this is about being “job-ready”, so perhaps he is actually advocating for software engineering in our schools. The sentiment is a good one, but the idea that K12 education can educate “job-ready” students for professional software engineering jobs is a pipe dream. The most advanced programming class in today’s high schools is typically the AP Computer Science class, which teaches students to write program fragments; sadly, most graduates of AP CS would be hard-pressed to actually write a computer program. Professional programming skills are developed over time and there are simply not enough hours in the school day or days in the school year to teach these skills. That is like asking the high school marching band to train musicians who are ready for professional orchestra jobs. Exceptionally dedicated young people who spend thousands of hours outside of school working on programming (or music!) may be job-ready by the time they graduate from high-school. Within our schools, however, there is no place for software engineering except perhaps in the context of vocational-technical programs that serve specialized niches in the tech industry.
President Obama also called for math classes along with “hands-on computer science” as a way to make students “job ready” upon graduation. He’s obviously not suggesting that high school grads be ready for jobs as mathematicians, so I think he’s not suggesting that they be ready for software engineering jobs either. Instead, I believe he’s suggesting that students who graduate from high school with math and coding skills will be better prepared for the modern workplace. I’m not sure that many jobs that require coding skills will be available without a college degree, but I more-or-less agree with President Obama and will argue below that coding skills are a necessity for STEM jobs, even those unrelated to computer science and software engineering. Again, however, let’s use precise language and not confuse the craft of coding with the academic discipline of computer science. If I can belabor this point a bit, it is also true that 21st century jobs require strong written communication skills. This does not mean that we need more literature classes in high school; it means that we need to teach students the craft of writing.
Code.org and President Obama misuse the term “computer science” when they really seem to mean coding, but if we switch the words around then what they’re proposing seems pretty reasonable. The quote from the CSTA, however, is a different matter. It begins with an obviously true statement: “computers have transformed both the world and the workforce in many profound ways”, but from there, the CSTA launches into pure hyperbole, and I’d like to take the time to rebut the next three sentences:
As a result, computer science and the technologies it enables now lie at the heart of our economy and the way we live our lives.
It is true that our society is utterly dependent on computers today. And without computer scientists, software engineers and other professionals in the “tech industry” it might all come crumbling down. But our society is just as dependent on the electrical grid, the transportation network, medicine, agriculture, refrigeration and water supply and sewer systems, and if we lost all of our civil engineers or farmers or power grid operators society would break down just as quickly. No one is arguing for the addition of civil engineering, power engineering or agriscience to the K12 educational system. What makes computer science more essential, more valuable, than these other professions?
To be well-educated citizens in a computing-intensive world and to be prepared for careers in the 21st century, our students must have a clear understanding of the principles and practices of computer science.
This is just an insult to well-educated citizens everywhere. If all educated people must understand the principles and practices of computer science, then they must also understand the principles and practices behind our other essential infrastructure. I understand how internal combustion engines and refrigerators work, but I have only a fuzzy understanding of the principles of thermodynamics behind those technologies. I can discuss the vulnerability of our electrical grid to solar flares, and explain the differences between primary, secondary and tertiary treatment at sewage treatment plants, but I certainly don’t know the principles and practices of power engineering or civil and sanitary engineering. Does that mean I am not a well-educated citizen?
No other subject will open as many doors in the 21st century as computer science, regardless of a student’s ultimate field of study or occupation.
Computers have changed our society in profound ways (as did the automobile and television in the last century). And our educational system should certainly adapt in response. But this idea that there is a single subject called “computer science” that we can just tack on to the K12 curriculum is absurd. One obvious question is what do we take out of the curriculum to make room for this new subject? Music? Literature? Geography? Long division? But more fundamentally, we need to recognize that the societal impacts of any technological revolution lie primarily outside of the discipline that created the revolutionary technology. To be well-educated citizens in a world transformed by computers, we don’t need to study the math and science and engineering behind the computers; we need to study the transformations they have caused:
- Computers have transformed our modes of formal communication, and schools have adapted by teaching students to type, to send email, to use word processors, to create presentations and even to edit video.
- The internet and social media have transformed our social networks and our modes of informal communication. Some schools have adapted by hosting assemblies each year to teach students about cyberbullying online safety.
- The advent of digital photography and creation of powerful photo editing software have transformed the relationship between photographs and reality. Schools should adapt by updating their health curricula to cover the impact of Photoshop and fashion magazines on teen body image.
- The digitization and computerization of our communication networks have made our phone calls easier to intercept and record in bulk and the adoption of digital encryption has made our secrets easier to conceal. Schools should adapt to these changes by revising their civics curricula to include discussions of privacy, the fourth amendment and surveillance.
These are all important educational responses to the computer revolution, but none of them is computer science.
The Value of Coding
Once we reject the misguided clamor about computer science, we’re still left with many well-intentioned proponents of and proposals for exposing school children to coding. I’m one of those proponents, and for me, there are four primary reasons that schools should teach basic programming skills:
First, computers and networks have become essential infrastructure for modern society. Computers are complex enough, however, that without educational intervention they will just be mysterious and ubiquitous black boxes. So I believe that we should teach students about computers for the same reasons that we take students on field trips to farms and water treatment plants: so that they learn about the infrastructure that our civilization rests upon. And furthermore, I believe that the best way to demystify computers, to teach students what they really do, is to show students how to control them with code.
Second, students who go to work in STEM fields (or study those fields in college) will likely need to write simple computer programs as part of their work. We should not teach programming as job training or because we anticipate a need for more professional software engineers, but because a large sector of the future workforce will need basic programming skills for their daily work. Just as word processing is a skill needed by most white collar workers today, coding is a skill that will be needed by most STEM workers in the future.
Third, teaching programming enables powerful new approaches for teaching math and science through computational inquiry, and enables students to understand these topics in new ways. I’ll have much more to say about computational inquiry below, but my essential point is that teaching students to program will open important new avenues to learning in other fields.
Finally I’m convinced that programming teaches and develops our capacity for rigorous, analytical, algorithmic thinking, and does so with an intensity that other disciplines do not. That is: learning to program requires students to learn and practice an important and valuable mode of thinking. I believe, for example, that an exposure to computer programing will help lawyers be better lawyers, doctors be better doctors, and scientists be better scientists. And more generally, I believe that students who have access to this focused, rigorous, analytical mode of thinking will be better citizens. In my experience, computer programming is a particularly effective way to provide that access. This is a controversial idea however (one that computers-in-education pioneer Seymour Papert explicitly rejected) and the main points of this essay stand, even if you reject this final reason for teaching programming in our schools.
Code for Code’s Sake
Any discussion of coding in schools should start with the realization that teachers already have a full school year of material mandated by state educational standards, and there is simply not time to add entirely new topics, except in the form of for cursory, one-off exercises like an annual “hour-of-code”. Even if we accept that programming teaches thinking and that coding is good in and of itself, I don’t believe that it is an effective use of teacher’s time to teach coding in isolation. Unfortunately, the most accessible programming curricula today tend to teach code for code’s sake.
Get David Flanagan’s stories in your inbox
Join Medium for free to get updates from this writer.
Here’s code.org’s elementary school “code studio” programming environment, for example:
The student’s task is to write a program in this visual programming language to guide the zombie to the sunflower while avoiding the zombie-eating plant. This is a very common approach for teaching young students about instruction sequences and loops in code. But this exercise is purely about the mechanics of the code: the student has to figure out the puzzle of how to position the code “blocks”, but does not learn anything about geometry, for example. And because it is a purely mechanical exercise, and not intrinsically interesting in its own right, the programming environment tries to keep the student’s interest by making creepy zombie sounds when she runs the program.
Apple makes a learn-to-program app for iPads that also takes this approach of asking a student to write a program that will navigate a character through a maze or puzzle:
Like the code.org example, this is code for code’s sake. It is a lesson in conditionals and boolean operators, which is necessary in any coding curriculum, but there is nothing larger here for the student to learn. Presumably the student remains engaged because of the sophisticated graphics and gameplay, not because there is anything engaging about the code itself.
Note that in both of these labyrinth puzzle examples, the programming is completely divorced from computation. Students are not learning that computers are for computing things. The programming environment (where simple commands move complicated graphics around the screen) is so abstract that it must be hard for students to see much connection between what they type and what appears on the screen in response.
Khan Academy’s learn-to-program environment looks like this:
The student is challenged here to modify an existing program to use a symbolic name for the diameter of the bunny’s eyes. This example includes lots of numbers and satisfyingly concrete geometric objects, which is an improvement over the puzzle exercises, but it is still code for code’s sake.
It may seem unfair to criticize Khan academy and Apple and code.org for these examples. If we want to teach programming, we have to teach variables and conditionals and loops, as these examples are doing. At some level, code for code’s sake is required because we have to teach the syntax of the underlying programming language. But if we look at how these curricula develop as the student progresses we’ll see that they are just coding exercises that lead to more advanced coding exercises. Students learn that coding is just a series of puzzles to solve, not a problem-solving skill with a purpose.
Code for Computational Inquiry
The computer revolution has radically transformed the practice of science and engineering (and mathematics to a lesser extent). The massive computational power of today’s computers allows scientists and engineers to collect, analyze and visualize huge amounts of data and to model complex systems with unprecedented precision. These are the sorts of tasks that I call computational inquiry. Schools have not kept up with this transformation. Graphing calculators, decades out of date, are one of the only signs of the computer revolution visible in our math and science classes. Students can use those calculators for simple computational inquiries in math classes, but that is a far cry from what is possible with modern computers.
Computational inquiry is not just for working scientists–it has revolutionary applications in the classroom as well. Elementary school students are often asked to repeatedly roll a pair of dice, adding the numbers that appear on the dice and drawing a histogram to show the frequency of each sum. If a student does this 25 times she’ll have a blocky-looking histogram that might look something like a bell curve. With computational inquiry, though, she could simulate 100 dice rolls, or 1000, or 100,000 and see how that affects the shape of the histogram. She could modify the program to roll 10 dice at a time, or to roll 12-sided dice. The figure shows a rough prototype of what this inquiry might look like.
Another obvious use for computational inquiry is for simulation of physical systems like projectiles and planetary orbits. Typically, a careful exploration of systems like these is deferred until students are studying calculus so that they can do the required math symbolically. This pedagogical approach is out of date, however, since we can now use computational inquiry and simulate the systems numerically. (Inquiries like these can also be done as a spreadsheet.)
A final example of a computational inquiry is Bret Victor’s essay Up and Down the Ladder of Abstraction. This is a beautiful and professionally done inquiry that involved significant programming effort to create the custom visualizations involved. I include this here as an inspirational example of computational inquiry only–the ability to create dynamic documents this complex is beyond the scope of what I’m proposing here.
In order to perform computational inquiries, teachers and students have to be able to express their inquiries using code (even if they start with spreadsheet formulas as their code). This is a mundane skill that scientists and engineers use daily, and students should learn this skill so that they can learn science the way it is actually practiced. Schools teach students to type and to use word processing software because those tools help them to craft effective written documents. Schools teach students to use presentation software like PowerPoint because it is a tool for organizing their thoughts and enhancing their oral presentations. In exactly the same way, schools should teach students to use coding software as a tool for computational inquiry in their math and science classrooms. This is the context that is missing from current coding initiatives. By teaching coding in math and science classes we avoid the trap of code for code’s sake.
Let Teachers Teach
Note that these the coding exercises from code.org and Apple and Khan Academy are designed for students to complete on their own, with no teacher required. This may be perfect for advanced students who need classroom enrichment, or for learners who are teaching themselves outside of the classroom, but it isn’t a curriculum that we can expect teachers to adopt for their entire class since there is no teaching for them to do.
Our current generation of teachers were not taught to code when they were in school, and we can’t expect them to teach coding for coding’s sake. Coding without context means coding without teachers. But if we teach coding as a tool for computational inquiry in math and science, then every coding lesson is in context and the teacher has something to teach.
If we want students to learn to code, we need teachers to teach them. And if we want teachers to teach coding, we need them to learn to code themselves. But what busy teacher has the time to learn a new skill when the only purpose of that skill is to navigate an annoyingly noisy zombie through a series of mazes? Instead, let’s show teachers that coding can be a tool for eliciting deeper understanding of math and science concepts from their students. If we do that, I believe that teachers will engage and be much more motivated to learn coding themselves because they will want to design computational inquiries of their own and use them confidently in the classroom.
I’ve been criticizing code.org a lot in this essay, so I should point out that code.org’s “CS in Science” curriculum does just what I’m advocating here: teaches coding in the context of middle-school science classes.
Inquisitive Programming
I used a word processor analogy above: schools teach students to use word processors because they are important tools for written communication, and they should teach students to use coding software because it is an important tool for mathematical and scientific inquiry. In the world of software engineering, we use the term IDE or “integrated development environment” instead of “coding software”. An IDE is an application (like a word processor or spreadsheet), specially designed for coding. I envision an IDE–let’s call it Inquire–developed for use in schools and and designed not for general purpose coding, but specifically for computational inquiry. In this final section I want to describe my vision for this Inquire application.
An IDE for use in schools has to satisfy some strict design constraints:
- Different schools have different types of computers, so our IDE must be cross-platform, so it can run on any kind of computer.
- Schools districts often have security policies that make it difficult to install new software on school computers, so our IDE must be zero-install: that is, it must not require software installation. In practice, this means that it must be web-based (just as code.org and Khan Academy’s offerings are).
- Teachers must be able to run student code safely without fear that the code can harm their computer in any way. In programming terms, we say that the code must be sandboxed, so that it cannot do things like create or delete files. JavaScript code that runs in web browsers is sandboxed, so by making the IDE web-based and running code in the browser, we guarantee that the the IDE is safe.
- School districts never have as much money as they like, so the IDE should be free. This means that it should also be open-source software so that volunteers are willing to contribute to its development.
- Since this IDE is aimed at programming novices, it should be easy to use. The goal is not to enable software engineering, but to support computational inquiry with real coding. As a first approximation to making the IDE easy to use it must be simple, with a minimal set of features. Students should not have to learn a complex new program while they’re also trying to learn the syntax of a new programming language. Note also that although this IDE must be web-based, it is not a goal to enable web programming (which is anything but easy).
It is straightforward to think about the design of an IDE for schools and to come up with a list like the one above. It is more difficult, however, to design an IDE for computational inquiry because computational inquiry is not a programming paradigm that most software engineers are very familiar with. In order to make it clear that we are, in fact, talking about a new programming paradigm here, I’m going to go ahead and propose a name: inquisitive programming. My thinking about inquisitive programming is influenced by other systems and paradigms:
- The web: documents on the world-wide web are public by default and are shareable across the globe. Inquisitive programming should adopt this shareable, document-centric approach. Programs (or “inquiries”) should be web documents automatically saved in the cloud and assigned a unique URL so that users can access, edit and run them from any computer in the world, and can share them with others simply by sharing the URL. Websites like jsfiddle.net and codepen.io have pioneered this “shared programs in the cloud” approach for web programming, and I’d like to follow their lead with inquisitive programming.
- Literate programming: computer programming languages always have some kind of “comment” syntax for including arbitrary prose within a program. The idea is that programmers can use comments to document and explain their program, making it easier for others to understand, modify and maintain. In the 1980s, software pioneer Donald Knuth proposed a programming paradigm he called “literate programming” that inverted this relationship between code and comments. In Knuth’s system, the explanatory prose is primary and there is a special syntax for including arbitrary code within the prose. This has always seemed like a brilliant idea to me, and I consciously chose the term “inquisitive programming” to echo Knuth’s “literate programming”. The point of computational inquiries is to ask questions, to explore and explain complex systems in an educational context, and this is not possible with code alone. When a student writes a program to simulate a physical system, for example, we need prose to tell us what the system being simulated is, to justify the choice of constants and initial conditions, to enumerate the system’s state variables and to explain how those variables will be updated over time. And just as importantly, when the program produces visualizations, we need prose to explain what those visualizations show and to draw appropriate conclusions. In a very important sense, inquisitive programming is a form of technical communication. An IDE that puts explanatory prose first and embeds code within that prose seems ideal for this kind of programming.
- Interactive notebooks: the professional math application Mathematica and the web-based Jupyter software have pioneered a new form of programming that is growing increasingly popular for scientific computing. This style of programming is interactive, so that instead of typing and then running a complete program, the user can type a single command and see the results of that command immediately. And it uses the organizing metaphor of a lab notebook in which all previous commands and results are retained on the page so that you can scroll back and see what computations you performed in the past. Another key feature of these notebook-based systems is that they include powerful graphical tools for visualizing the results of your computations. Notebooks are popular with professionals and at the university level, but I believe that they are too complicated for K12 use. There are two features of notebook-based programming that I would like to borrow for inquisitive programming, however. The first is the visualizations. When coding for computational inquiry, the numeric results of the computation rarely stand on their own. For understanding and insight, those numbers must be visualized graphically. So an IDE for inquisitive programming must have rich and intuitive visualization features built-in. The second, more fundamental feature that I’d like to borrow from the notebook paradigm is the idea that code and the results of running that code can and should be interleaved. In traditional programming a program and the output it produces are two entirely separate things. In notebook-based programming and in inquisitive programming, the code accompanies the results. That code may be secondary to the explanatory prose and visualizations that accompany it, but it is still a critical part of the inquiry, and must be included in the document that is the finished work product of a computational inquiry. The process of coding transforms complex ideas into a sequence of simple, universal computational steps; code is the distilled essence of the coder’s thought process. Code can be checked for correctness and it can be re-run to replicate computations. Code is the ultimate form of “show your work” and I believe that both students and practicing scientists should all be held to a “show your code” standard in their documents and publications.
To summarize, I’m proposing a free, open-source web-based programming environment called Inquire that empowers science and math teachers and their students to create code-based computational inquiries. A program, or inquiry, in this environment combines prose, code, and the visual results of running that code into a single document that can be shared on the web. Further, I’m proposing that we use this environment and the new paradigm of inquisitive programming to teach coding and to modernize the teaching of math and science in US middle schools and high schools.
I’ve posted a very early stage prototype of Inquire on github and you can see and experiment with example inquiries here and here.







