Computing Applications Education

Programming in K-12 Science Classrooms

Introducing students to visual programming as a pathway to text-based programming.
students programming ViMAP-Ants models
  1. Introduction
  2. Transition from Visual to Text-Based Programming
  3. Conclusion
  4. References
  5. Authors
  6. Footnotes
  7. Figures
students programming ViMAP-Ants models
Fourth-grade students in Tennessee programming ViMAP-Ants models in order to conduct simulation experiments and develop mathematical explanations about ecological interdependence. The programming commands were developed for them by 8th-grade students.

Introducing computational modeling as the way of “doing science” in K-12 classes can greatly increase students’ participation in computing.3,4 But, how can K-12 science teachers, who may have little or no programming experience, teach such classes? And, how can teachers adopt computational modeling in a manner that not only deepens science learning, but also supports the development of authentic programming experiences?

Since 2012, we have been conducting studies in which 3rd, 4th, 5th, and 8th-grade (ages 8-10, and 13 years old) public school teachers and students, with no prior experience in programming, use programming as part of their regular science curricula throughout the academic year. The students we worked with were predominantly African American (100% in 3rd, 4th and 5th grades, and 70% in 8th grade), and came from low socioeconomic status backgrounds. The programming language used by these teachers is ViMAP, an agent-based visual programming language and modeling platform (see http://www.vimapk12.net) that uses NetLogo4 as its simulation engine. In agent-based programming, users create simulations by programming the behaviors of, and interactions between, computational agents. We designed ViMAP specifically: to enable yearlong curricular integration of programming as a means for modeling and simulating relevant scientific phenomena in K-12 classrooms using visual programming; and to create pathways to transition from visual to text-based programming in higher grades. Students in 3rd-5th grades used visual programming, while students in 8th grade used both visual and text-based programming.

In our studies, teachers and students built and refined ViMAP models twice a week throughout the academic year. Teachers led the classroom instruction. In weekly meetings, researchers provided ongoing professional support by collaboratively designing the curricular activities with the teachers, based on their state and district-mandated curricular needs. Curricular activities spanned kinematics (3rd and 4th grades) and ecology (3rd, 4th, and 8th grades). For kinematics, students programmed a single-agent NetLogo simulation using ViMAP (ViMAP-Motion), whereas in ecology, they programmed the behavior of multiple agents and agent types in either a bird-butterfly-flower ecosystem (ViMAP-Bird-Butterfly), or ant colonies with multiple levels of predators (ViMAP-Ants).a Students in 3rd, 4th, and 8th grades showed significant gains in our assessments of computational thinking and statewide-standardized tests in science and math. Students’ gains in the standardized tests were significantly higher than the gains in other classrooms in the same schools that did not use ViMAP or any other form of programming with their science curricula.

We found teachers integrated programming in their curricula in the following ways:

Reframing programming as the design of mathematical measures. All of the teachers we worked with told us their students experienced difficulties in interpreting and constructing mathematical measures (for example, units of measurement and graphs) in their regular science classes. Manipulating units is emphasized in statewide standardized assessments, so it is an important learning goal. Our teachers reported that programming in ViMAP helped students overcome these challenges, because the activity of programming the behavior of agents requires the learners to define the event in discrete measures. The state of the simulation, at any instant, represents a single event in the form of spatialized representations of agent actions and interactions. To “run” the simulation, these events are repeated a number of times specified by the user. By engaging in iterative cycles of building, sharing, refining, and verifying ViMAP models, students refine their understanding of what actions and interactions of agents represent an “event,” which are then displayed on graphs. The students are getting the opportunity to explore different kinds of units, and see their simulation measured in those units.

Embodied modeling supports agent-based thinking and programming. Programming an agent involves learning to think like the agent, because it can help students understand the relationship between their code and the simulated output. All the teachers saw embodied modeling as a valuable activity for teaching students how to think like an agent. Embodied modeling introduced the students to the relevant computational rules represented by the ViMAP commands, helped them debug their programs and deepened their understanding of the graphs. For example, in 3rd grade, students first conducted an embodied activity in which they acted as butterflies and foraged for nectar, obeying simple rules that connected the butterflies’ energy to their movement and foraging. Teachers often referred to the students’ embodied modeling experiences while discussing the relevant ViMAP graphs, and while assisting students debug their ViMAP programs.

All the teachers saw embodied modeling as a valuable activity for teaching students how to think like an agent.

Programming commands and code visualization scaffolds help deepen conceptual understanding in science. Some of the programing commands in ViMAP were designed to directly represent scientific concepts. For example, while simulating ecosystems, students can use programming commands such as “make same color offspring” to specify the agents’ reproductive behavior. Similarly, when students are building a ViMAP simulation of acceleration, they can use commands such as “change step-size,” which alters the turtle’s speed—its step-size—by a specific amount. So, for students, reasoning about and discussing their ViMAP model and simulation involves thinking and talking about the relevant scientific concepts. ViMAP also offers scaffolds for code visualization: code-step-through or “highlight” functionality, and time-delay. This means that as a ViMAP program is running, the command currently being executed is highlighted in red, and users can also set a “time-delay” between the execution of command blocks. Students use these scaffolds to deepen their understanding of the relationships between their ViMAP programs and simulated outputs, and they learn the relevant scientific concepts by engaging in discussions with their peers and the teacher about how the commands in their programs affect the simulations and the graphs.2

Fostering a classroom culture of sharing and critiquing models. The teachers periodically brought their classes together by creating a culture of “sharing and critiquing” peer models, that is, their ViMAP programs, simulations and graphs. In this process, the class as a whole, normatively, developed criteria for what would count as a “good” computational model. In the course of four months of modeling motion, the 3rd-grade students and their teacher developed the following criteria: “a good model should accurately represent some important aspects of reality,” “a good model can be approximate,” and “a good model can be used to make good or accurate predictions.” These criteria originated in teacher-led class discussions as socially defined (voted by popular choice), but over time, became progressively more grounded in students’ mathematical explanations of relevant aspects of their ViMAP simulations. This led students to use progressively more sophisticated computational abstractions, such as loops and conditionals, in order to make their models predictive.

Back to Top

Transition from Visual to Text-Based Programming

Although visual programming lowers the barrier for entry into programming, learners who intend to pursue careers in computing may find the drag-and-drop nature of visual programming inauthentic, or find it difficult to transition to text-based programming.1 We designed ViMAP explicitly to address this issue. Visual programming commands in ViMAP are defined as short NetLogo procedures (see the accompanying figure), which students can easily access and modify. In 8th-grade classes, after engaging in visual programming with ViMAP for approximately two months to build simulations of interdependence in ant ecosystems, the teacher and the students wanted to make deeper changes in the underlying text-based NetLogo code. But, given the limited instructional time, the teacher found it challenging to help students create new simulations in NetLogo using text-based programming. This required a lot of “overhead,” because the language syntax was often disconnected from the relevant scientific concepts.

The transition from visual to text-based programming by using text-based programming to create visual programming blocks can take students even deeper into both programming and science.

To address this issue, the teacher then decided to return to the ViMAP-Ants unit, and asked the students to work in small groups to create new ViMAP commands by modifying and extending the underlying NetLogo code (see the figure). For the 8th-graders, this work was motivated by a capstone project of designing and creating a version of ViMAP-Ants in order to teach 4th-graders about food webs, which is a required curricular standard in 4th grade. The teacher introduced the students to relevant “chunks” (procedures) in the NetLogo code pertaining to specific ViMAP commands they were already familiar with. She led class discussions in which the students collaboratively interpreted and explained the significance of the computational abstractions in NetLogo code in terms of relevant scientific concepts represented in the ViMAP commands. Learning the syntax and new forms of abstractions (such as classes) in text-based programming therefore became deeply intertwined with the relevant concepts in ecology (for example, hierarchy of organisms in food webs). While students’ previous work using visual programming introduced them to computational abstractions such as loops, variables, and conditionals, text-based programming further deepened their computational thinking because it involved creating computational objects or classes, declaring new local variables, creating and modifying conditionals, editing and repurposing lists, and using random numbers. Students’ growth in computational thinking was further evident in a post-assessment activity, in which they successfully created new commands for a NetLogo simulation of a different ecosystem without teacher-provided assistance.

Back to Top


Long-term integration of computing in K-12 science is important not only for broadening participation in computing, but also because it can deepen students’ understanding of scientific concepts beyond what is possible in the traditional classroom. At the same time, students develop the key scientific practice of modeling, especially, mathematical modeling. Agent-based computation, in particular, domain-specific, agent-based programming languages such as ViMAP, can serve a powerful role in this regard. Elementary and middle school science teachers with no prior programming experience can indeed successfully incorporate such programming platforms in their curricula by reframing programming as the means for designing, interpreting, and constructing units of measurement and graphs. Furthermore, when programming does become the language of science throughout the academic year, especially in higher grades, it is essential to introduce text-based programming, so that students can take on computational modeling challenges beyond the reach of visual programming. This transition can take students even deeper into both programming and science, by making it possible to use text-based programming to create visual programming blocks for modeling science.

Back to Top

Back to Top

Back to Top

Back to Top


UF1 Figure. Fourth-grade students in Tennessee programming ViMAP-Ants models in order to conduct simulation experiments and develop mathematical explanations about ecological interdependence. The programming commands were developed for them by 8th-grade students.

UF2 Figure. ViMAP-Ant-Foodweb simulation and programming commands developed by 8th-graders. Popped-out images show NetLogo procedures underlying the ViMAP commands created by the students. Left-to-right: Graphs of population and energy; library of ViMAP commands; a sample ViMAP program; and the NetLogo simulation controlled by the ViMAP program.

Back to top

    1. DiSalvo, B. Graphical qualities of educational technology: Using drag-and-drop and text-based programs for introductory computer science. IEEE Computer Graphics and Applications 36, 6 (June 2014), 12–15.

    2. Farris, A.V. and Sengupta, P. Perspectival computational thinking for learning physics: A case study of collaborative agent-based modeling. In Proceedings of ICLS 2014, 3, (May 2014), 1102–1107.

    3. Sengupta, P., Kinnebrew, J.S., Basu, S., Biswas, G., and Clark, D. Integrating computational thinking with K-12 science education using agent-based computation: A theoretical framework. Education and Information Technologies 18, 2 (Feb. 2013), 351–380.

    4. Wilensky, U., Brady, C.E., and Horn, M.S. Fostering computational literacy in science classrooms. Commun. ACM 57, 8 (Aug. 2014), 24–28.

    a. The ViMAP software and associated curricula can be obtained from http://www.vimapk12.net.

    Funding for the ViMAP software and associated curricula is provided by NSF CAREER Award #1150230.

Join the Discussion (0)

Become a Member or Sign In to Post a Comment

The Latest from CACM

Shape the Future of Computing

ACM encourages its members to take a direct hand in shaping the future of the association. There are more ways than ever to get involved.

Get Involved

Communications of the ACM (CACM) is now a fully Open Access publication.

By opening CACM to the world, we hope to increase engagement among the broader computer science community and encourage non-members to discover the rich resources ACM has to offer.

Learn More