Hands-on Activity: Simulating the Bug

Contributed by: IMPART RET Program, College of Information Science & Technology, University of Nebraska-Omaha

A screen capture image shows the pattern of disease transmission generated using a mobile Android app.
Screenshot showing who was infected.
Copyright © 2012 Douglas Bartelsen, University of Nebraska


Students modify a provided App Inventor code to design their own diseases. This serves as the evolution step in the software/systems design process. The activity is essentially a mini design cycle in which students are challenged to design a solution to the modification, implement and test it using different population patterns The result of this process is an evolution of the original app.
This engineering curriculum meets Next Generation Science Standards (NGSS).

Engineering Connection

Engineers follow a design process to solve problems. The software/systems engineering design process includes the steps of analysis, design, implementation, testing and evolution. This activity focuses on the evolution step, which is often overlooked by practitioners.

Epidemiologists track the spread of diseases using data from doctors, hospitals and other sources. With enough data, they can develop models that predict the speed and breadth of an epidemic. With these models in hand, software engineers create programs to display and analyze current and past data. Software engineers collaborate with epidemiologists to improve or adjust the models as necessary, as new data suggest changes. These models enable public health officials to track infections and more importantly, attempt to prevent or reduce the impact of diseases on individuals.

Pre-Req Knowledge

A working knowledge of App Inventor, which can be gained by completing many of the tutorials on the MIT website listed in the Additional Multimedia Support section. Several other lessons in the TeachEngineering collection use App Inventor. For example, Program Analysis Using App Inventor is an excellent lesson for students or teachers to learn the ins and outs of App Inventor.

Learning Objectives

After this activity, students should be able to:

  • Follow the design process to modify an App Inventor app.
  • Analyze data collected by an Android app manually or by developing an algorithm, and identify how this analysis compares to the same data analyzed by the application.

More Curriculum Like This

Passing the Bug

Students apply concepts of disease transmission to analyze infection data, either provided or created using Bluetooth-enabled Android devices.

High School Lesson
Curiosity Killed the App

Students gain experience with the software/system design process, closely related to the engineering design process, to solve a problem. The lesson culminates in a hands-on experience with the design process as students simulate the remote control of a rover.

Middle School Lesson
Program Analysis Using App Inventor

In this lesson, students learn about, design and create flow charts for different scenarios, including a game based on the Battleship® created by Hasbro©. In the associated activity, Flow Charting App Inventor, students apply their knowledge from this lesson and gain experience with a software appli...

Storing Android Accelerometer Data: App Design

Students work through an online tutorial on MIT's App Inventor to learn how to create Android applications. Using those skills, they create their own applications and use them to collect data from an Android device accelerometer and store that data to databases.

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

  • Use a computer simulation to model the impact of proposed solutions to a complex real-world problem with numerous criteria and constraints on interactions within and between systems relevant to the problem. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • Use computers and calculators to access, retrieve, organize, process, maintain, interpret, and evaluate data and information in order to communicate. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • Medical technologies include prevention and rehabilitation, vaccines and pharmaceuticals, medical and surgical procedures, genetic engineering, and the systems within which health is protected and maintained. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • evaluate published reports that are based on data by examining the design of the study, the appropriateness of the data analysis, and the validity of conclusions (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • Identify questions and concepts that guide scientific investigations. Students should formulate a testable hypothesis and demonstrate the logical connections between the scientific concepts guiding a hypothesis and the design of an experiment. They should demonstrate appropriate procedures, a knowledge base, and conceptual understanding of scientific investigations. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • Use technology and mathematics to improve investigations and communications. A variety of technologies, such as hand tools, measuring instruments, and calculators, should be an integral component of scientific investigations. The use of computers for the collection, analysis, and display of data is also a part of this standard. Mathematics plays an essential role in all aspects of an inquiry. For example, measurement is used for posing questions, formulas are used for developing explanations, and charts and graphs are used for communicating results. (Grades 9 - 12) Details... View more aligned curriculum... Do you agree with this alignment?
  • Make inferences and justify conclusions from sample surveys, experiments, and observational studies. (Grade 12) Details... View more aligned curriculum... Do you agree with this alignment?
Suggest an alignment not listed above

Materials List

Each group needs:

For the teacher's use:


The world around us is very complex with large numbers of variables and objects, even in some small-scale systems. Scientists and engineers use models to simplify the task of understanding how these systems function or designing software and hardware to solve problems involving these systems.

One such complex system in biology is a population. Tracking each individual would be time-consuming and calculation-intensive. Epidemiologists develop models to predict how diseases spread in populations; then they test the models and improve them as more data is collected and compared to predictions.

A circular diagram shows the steps of: Requirement Analysis, Design, Implementation, Testing, and Evolution. In the center: SDLC: Software/System Development Life Cycle.
The steps of the software development cycle.
Copyright © 2012 Cliffydcw Wikimedia Commons http://commons.wikimedia.org/wiki/File:SDLC_-_Software_Development_Life_Cycle.jpg

In general, disease transmission models can be applied to different areas, but when drilling down to the specific neighborhoods or individuals, models often fail in their predictions. Thus, the models for small, isolated populations are different than those for large, dense urban populations.

In this activity, you will play the part of an epidemiologist and software engineer by collecting data and writing an algorithm to help you analyze it. You will design a modification to a disease (provided) by modifying an Android app using App Inventor. In doing so you will apply the software/systems design process, which is cyclical with all steps being equally important. The activity will focus you on the evolution phase in which a solution (in this case an Android app) will be modified to make it apply in a different way/situation. This is similar to how software engineers collaborate with epidemiologists to analyze large amounts of data and make predictions on the spread of diseases. Then you will discuss ways of reducing the spread of disease.

Diseases often evolve and change into different strains that require different medical treatments. An example of this is influenza, which continually has different strains enter into existence or disappear, only to re-emerge later. These new (and old) strains must be tracked and simulated. The well-known breakout of the H1N1 flu is one instance in which a new strain emerged and great effort and expense was employed to simulate the spread of the disease in order to develop a treatment.

In this activity, you will simulate part of the job of a software engineer. Software engineers produce models that can be used to predict patterns in disease transmission, determine lethality of the disease, and learn the origins of the disease. These models are critical for the development of cures. Biomedical engineers work with doctors to discover how the disease spreads, how it affects the human body and develop cures. How do you think these models are developed? Does one model fit all diseases or do they need to be customized?


communicable: Able to be passed from one organism to another.

epidemiology: The study of the patterns involving health events such as disease.

host: An organism that is infected with a pathogen.

immunity: The ability of an organism to resist infection.

infectious disease: A disease that is caused by an organism such as bacteria or viruses invading another organism.

pathogen: An organism that causes a disease.

transmission: The process of transferring a pathogen from one host to another.

vector: A different species of organism that can move a pathogen between hosts.


Teacher Background Information: App Inventor Attachment Information

  • App Inventor base app source: Simulating the Bug Empty Algorithm Source (zip) - This is the source code for the algorithm designers that students may modify in App Inventor. It requires App Inventor.
  • App Inventor base app binary: Simulating the Bug Empty Algorithm Binary (apk) - This pre-built App Inventor app has no algorithm; it is provided to show/test default behavior. It requires an Android device or emulator.
  • App Inventor example app source: Simulating the Bug Full Algorithm Source (zip) - This is the source code for the bare-bones algorithm that students may modify in App Inventor. It requires App Inventor.
  • App Inventor example app binary: Simulating the Bug Full Algorithm Binary (apk) - This is a pre-built App Inventor app that will apply the bare-bones algorithm to a given dataset. It requires an Android device or emulator.

Before the Activity

  • Install App Inventor on the computers that student groups will use to modify a disease and then track the results. They will also need the apk and zip files mentioned above.
  • Make copies of the Disease Transmission Tracking Worksheet (which students use to manually record contact events to manually analyze or to help with algorithm creation) and the Disease Transmission Tracking Results (which students use to manually track infection events from the tracking worksheet or to check algorithm results). Instructions for using sheets: Students can use the tracking worksheet as a practice exercise to help develop an algorithm for checking and passing on the infection. You may simulate a small-scale study with them in the classroom and using physical proximity (closer than arm-length to designate a contact event) before using the application with Bluetooth. They may then use the tracking results sheet to assist them in data organization.
  • Review the App Inventor Cheatsheet, which outlines how to create a bare-bones algorithm with App Inventor. The cheatsheet is intended to inform the teacher on what constitutes a working algorithm, but may be used with students who have not been exposed to designing algorithms. This algorithm can also serve as a skeleton on which to add more functionality, such as disease immunity or recuperation. Customize its use to the needs of your students.

With the Students

  1. Divide the class into groups of three.
  2. Direct student teams to use App Inventor to design their own diseases with unique transmission characteristics by altering the full algorithm version (use the Simulating the Bug Full Algorithm Source and Simulating the Bug Full Algorithm Binary) through step-by-step procedures for calculations that take into account different disease properties such as ease of transmission, length of contact required, and possibly accounting for immunity.
  3. Next, have groups test the disease algorithm's success using the Android data collection app or by using some of the pre-loaded examples that may be selected from the "Analyze" screen (general movement patterns provided) from the app, or by using data that was collected in class using the associated lesson's disease transmission app (apk) during the Passing the Bug lesson.
  4. Direct groups to record the success of their diseases for different population movement patterns. The simplest way to do this is to run the analysis program and record the maximum number of infected individuals or by determining the amount of time it takes to infect a given fraction of the population to become infected. Graphing the number of infections as a function of time can perform more detailed analysis of the transmission pattern. As an example, constraining contact patterns in a hallway often give different results than those in an open gym. Typical patterns:
  • mall, compact group: steep-sloped linear or sigmoidal
  • individuals in a linear pattern: flatter-sloped linear
  • small groups with traveling infected: stepped increase as new groups are infected
  1. Depending on infectiousness and minimum number of contacts, some diseases may transmit better if individuals are in contact for longer periods of time rather than brief contacts with wide-ranging movement.
  2. As time permits, further activities include comparing with other students and/or customizing their diseases for different simulations. For example, you can change the infectiveness of your disease and test how a disease progresses in the different population structures (urban, rural, world-traveler) if it is highly infectious or more difficult to spread.
  3. Conclude with a brief writing assignment, as described in the Assessment section.


Troubleshooting Tips

A description of the different methods in the App Inventor code is available by clicking on the question mark on the algorithm block in App Inventor.


Pre-Activity Assessment

Questions: As a quiz or discussion questions, ask students about how the design process relates to creating and testing software.

  • What are the steps that software engineers follows in the software/systems design process? (Answer: Problem analysis, design, implementation, testing and evolution.)
  • Why is the evolution phase so important to software engineers? (Answer: This is the phase when solutions can be applied to fit different problems. Past experiences and solutions can be used to help solve different problems. By beginning with a similar solution, new solutions are easier to develop.)
  • Why does the design process work well in the evolution phase? (Answer: Evolving a solution is a logical conclusion for the designed solution. To properly complete the evolution phase, similar problems must be analyzes, solutions designed, implemented and tested.)

Post-Activity Assessment

Writing: Assign students to complete the following writing prompts:

  1. Explain how you applied the design process in this activity. (Example answer: The design process was applied in two ways. First, it was partially applied by focusing on the evolution step. To accomplish the evolution step, a second mini design process was completed when I analyzed the changes I wanted to make. I designed a solution and implemented it. Analysis of the results of the modification was like the testing phase.)
  2. Explain how you modified the disease that is simulated in the App Inventor app in this activity and the results of your analysis. (Answers may vary widely from the example answers. Example answer 1: I required that my disease was only capable of being transmitted to users having an odd number. This simulated a population in which half of the members were immune to the disease, which resulted in it being much more difficult to transmit. Example answer 2: My algorithm counted the number of contacts between infected and uninfected users and only passed the disease on after three contact events. This made my disease easier to spread in groups with little movement and more difficult to spread to users moving quickly through an area.)
  3. Relate your experience in this activity to the real world. How important do you think software engineering and the development of these models and simulations are in the research and prevention of diseases, spread of diseases, epidemics? (Example answer: The development of these simulations and models is critical to understanding how diseases are transmitted and how diseases will likely progress. If the medical community has a glimpse, albeit an educated guess, they are able to determine if quarantines are needed, how to educate the populace and to hopefully develop cures more quickly.)

Additional Multimedia Support

See additional resources at the MIT App Inventor website, http://appinventor.mit.edu/, including instructions and tutorials for installing App Inventor (see http://appinventor.mit.edu/explore/setup-mit-app-inventor.html).


Douglas Bertelsen


© 2013 by Regents of the University of Colorado; original © 2012 Board of Regents, University of Nebraska

Supporting Program

IMPART RET Program, College of Information Science & Technology, University of Nebraska-Omaha


The contents of this digital library curriculum were developed as a part of the RET in Engineering and Computer Science Site on Infusing Mobile Platform Applied Research into Teaching (IMPART) Program at the University of Nebraska-Omaha under National Science Foundation RET grant number CNS 1201136. However, these contents do not necessarily represent the policies of the National Science Foundation, and you should not assume endorsement by the federal government.

Last modified: August 29, 2017