Incorporating Coding in STEM Classes

A middle school teacher describes learning to code with her students, and how she now uses coding as a teaching tool in other classes.

January 18, 2022
Courtesy of LEGO® Education

About a week before the start of the new school year, my principal approached me and asked if I would be interested in teaching a robotics course. I was about to begin my 10th year of science teaching, and I said yes, but with mixed feelings of excitement and apprehension. I had no idea how to teach robotics. I was thrown into a classroom with 75 eager students with only a crash course in coding just days before the start of school.

I knew how to use a computer. I could make the cutest Moodle page, navigate unfamiliar software, and troubleshoot like a pro. Coding was a unique experience, though. It felt like I’d been thrown into a foreign country with no idea how to communicate. I was learning alongside my students and making necessary adjustments. “I don’t know,” I had to say several times, or I had to ask myself and my students, “What can we do to figure it out?”

I’ve been teaching robotics for seven years now and recently added a STEM component. To keep up with the ever-changing world of technology, I’ve changed my course, infusing it with what I’ve learned about coding, computer science, and best teaching practices. Here’s what I’ve learned about teaching robotics—and how I’ve used that in my science classes too.

Incorporating Block Coding Into Your Classroom

After immersing myself in the world of coding, I discovered that block coding was the best way to get started. In block coding, students use a drag-and-drop platform to piece together instructions for their creations. The blocks visually represent text-based code. For example, you can drag and drop the “move” block to make your object move, or drag the “hide” block to make your object disappear. There are many block coding websites out there, with Scratch being a popular one among teachers and students.

After I overcame my personal coding fears, I was able to let go and allow students to take on more of a teaching role in our class. I began by showing students a block and asking them what they expected it to do. Students discussed their hypotheses and ideas with one another before putting them to the test. This strategy gave students control over their learning and taught them how to decipher blocks on their own.

Thinking back to that moment, my students taught me so much. They demonstrated how to use new blocks and complete tasks with them. The more students learned about coding, the more eager they were to share their knowledge with me and their classmates. Situating students to teach and support one another has since become an integral part of my practice.

Allowing students to code together broadens their problem-solving skills and allows them to benefit from peer support. For example, in one coding project, students work in pairs and I set a timer for 10 minutes. During that time, one student is in charge of writing code, while the other assists and makes suggestions. They switch roles and resume coding when the timer goes off. This strategy ensures that both parties are equally invested in the project by allowing equal working time.

Using Code in a STEM/Robotics Classroom

Students learn best when they can make connections between disciplines. Keeping this in mind, I have included a variety of subjects in my robotics/STEM curriculum. Here are a few examples of how I use coding to create an interdisciplinary curriculum:

  • Students design their own robotic challenges incorporating equivalent ratios. Challenges were developed with partners and posted in their Microsoft OneNote notebooks in a Collaboration Space. Some examples include having the robot travel to specific points in the classroom and display ratios that are equivalent to a given ratio, as well as having the robot travel to each question posted on the floor and display the answers to those questions. Students voted on which two challenges they wanted to complete after evaluating and supplying feedback on their peers’ challenges.
  • Students created animated projects in Scratch to demonstrate their understanding of net forces. Students were given the task of explaining and demonstrating their understanding of net forces using Scratch in any way they wanted. One student decided to create a story about two animals discussing net forces. Students gave each other feedback on their projects, sharing the code they used to make them and suggesting ways to improve the project’s content or coding.
  • Students learn how to create a Mad Lib to help them practice their parts of speech after learning how to use the coding website Small Basic.

Using Coding in a Science Classroom

Coding was a little trickier to incorporate into my science class. In robotics, I have a lot of leeway, but not in science, where I have to teach a set of standards in a short amount of time. At first, I was concerned that it would take too long, that students would not grasp the concept, and that the projects would fail miserably. I was relieved to discover that I was wrong.

Students quickly grasped concepts and created outstanding projects that showed their comprehension of the standards being taught. I use coding in the classroom in a variety of ways—for example:

  • Using Scratch, students work in pairs to create an animated model of nutrient movement in an ecosystem. Students used X and Y coordinates to move the nutrient across the page while coding. The projects were then shared with classmates in their OneNote Notebooks via a Collaboration Space. By looking inside the code used by their peers, students were able to see how the project was coded.
  • Students created code for their robot to travel to different areas of a coastal mountain range using Lego EV3 Classroom software. Students demonstrated the rain shadow effect as the robot approached each area (windward and leeward sides).

This experience has taught me a few things. I’ve discovered that adding computer science into my other subjects gradually and steadily equips students for success today and in the future. As educators, we must believe that all children can learn.  And we must believe in ourselves as much as we do in our students.

Share This Story

  • email icon

Filed Under

  • STEM
  • Student Engagement
  • 6-8 Middle School

Follow Edutopia

  • facebook icon
  • twitter icon
  • instagram icon
  • youtube icon
  • Privacy Policy
  • Terms of Use
George Lucas Educational Foundation
Edutopia is an initiative of the George Lucas Educational Foundation.
Edutopia®, the EDU Logo™ and Lucas Education Research Logo® are trademarks or registered trademarks of the George Lucas Educational Foundation in the U.S. and other countries.