Lesson 2. Analyzing the Code Behind the Blocks

Sugat Dabholkar, Philip Woods, Connor Bain, Golnaz Arastoopour Irgens, Kevin Hall
Biology, Self-directed
45-50 min
Introductory High School Biology
v3

Overview

In this lesson students explore and learn the text-based (NetLogo) code behind the coding NetTango blocks. 

Standards

Next Generation Science Standards
  • Life Science
    • [HS-LS2] Ecosystems: Interactions, Energy, and Dynamics
    • [HS-LS4] Biological Evolution: Unity and Diversity
  • NGSS Crosscutting Concept
    • Patterns
    • Systems
    • Stability and Change
  • NGSS Practice
    • Analyzing Data
    • Using Models
    • Conducting Investigations
Computational Thinking in STEM
  • Data Practices
    • Analyzing Data
    • Manipulating Data
    • Visualizing Data
  • Modeling and Simulation Practices
    • Using Computational Models to Find and Test Solutions
    • Using Computational Models to Understand a Concept
  • Computational Problem Solving Practices
    • Troubleshooting and Debugging
  • Systems Thinking Practices
    • Investigating a Complex System as a Whole
    • Thinking in Levels
    • Understanding the Relationships within a System

Credits

Unit designed/developed by Dabholkar, S., Hall K., Woods P., & Bain C.

Acknowledgement

This work is supported by the National Science Foundation (grants CNS-1138461, CNS-1441041 and DRL-1020101) and the Spencer Foundation (grant 201600069). Any opinions, findings, conclusions, and/or recommendations are those of the investigators and do not necessarily reflect the views of the funding organizations.

Activities

  • 1. Analyzing the code behind the blocks
  • 2. Transforming the Ecosystem
  • 3. Wrap Up

Student Directions and Resources


In this lesson you will take a closer look at the underlying code that is generated when you drag the blocks. You will see that there are some parts of the code that are outside of the blocks, but are needed to get the model up and running.

1. Analyzing the code behind the blocks


Now we will look at the computer code produced from your blocks.

  1. Scroll down and click on the triangle next to "NetLogo Code" 
  2. Set up the blocks that you used before to have the wolf move around.
  3. Look at the code that is generated when you recompile.
  4. Answer the questions below.


Question 1.1

Look through the text-based code in the NetLogo code part. What is the copyright year?



Question 1.2

Examine the text-based code carefully. What is the size of a wolf?

  1
  2
  3
  4
  5
  6
  7
  8
  9
  10


Question 1.3

Can you find in the code the maximum number of moose that will be allowed in the model?

  1
  10
  100
  1000
  10000
  100000
  1000000


Question 1.4

Challenge: According to the code, what will happen "if" there are more than the maximum number of moose?



2. Transforming the Ecosystem


Now that you have a more realistic model of wolves and moose, what can you transform to make it more interesting?

Here are a couple of ideas:

1. Try to make it even more realistic

2. Try to change to an extremely alien ecosystem 

Challenge:

Use any combinations of blocks below to make your own world of wolves and moose. Explain your process below.


Question 2.1

Describe your transformed world and what changes you made.



Question 2.2

Copy and paste the text-based NetLogo code produced in your model below.



3. Wrap Up



Question 3.1

Do you think that scientists could use a model like this to study a simple ecosystem?

  Yes
  No


Question 3.2

Explain your answer to the previous question.



Question 3.3

What is one big idea that you have discovered in this lesson?



Question 3.4

What is the benefit of using block-based coding like this NetTango model compared to what you normally think about with coding?



Question 3.5

What other blocks would you want to add to this model?