Posted: Tue, 04/26/2022 - 8:48 pm EDT
Blank code file scaring your students? Try these strategies for brainstorming programs as shared by Michele Lombardi, CS for All Teachers Community Ambassador.
Beginner programmers are often intimidated by a blank code file. In their English language arts classes, students spend time learning brainstorming techniques and pre-writing strategies. However, we don’t spend much time on planning out your code when teaching programming, and organization is imperative. While I don’t necessarily teach these strategies outright (though you could!) I make it a point to model them or use them as scaffolds.
Following are some strategies that may help students organize their code:
- Graphic organizers: Below, I’ve included two versions of the graphic organizers I give students who are challenged to get started on a program. These have undergone many iterations over the years and some students may require more leading questions than oters. I’d highly recommend encouraging students or working with students to create an organizer that works for them. For example, if a student is challenged by loops, we might work together to create an organizer for the sentinel value, what values change inside the loop, and what values are initialized before the loop.
- “Act out” the code: Early coding platforms like Scratch and basic programmable robots lend themselves well to acting out the code. Recently, I tried it with my CS1 class who was trying to write a game where you guess a word one letter at a time (think Wheel of Fortune). While playing the game on paper, we kept track of which variables we were using, what algorithms we used repeatedly, and what we asked the user for. From there, we were able to match each task with the appropriate coding structure.
- Planning goals and subgoals as comments: When given a problem statement, it may be helpful to first organize the goals of the program and the steps you need to get there as comments in your code. Once you start coding, you can move or add goals as needed. If you teach AP CSA, the provided labs do a nice job of providing a goal for each activity in the comments. I scaffold this for all classes in a variety of ways.
- Modeling when completing a program as a class or soliciting steps from the class
- Providing goals and subgoals in starter code for assignments
- Working as a class or small group to plan goals and subgoals before working independently on an assignment. Here’s a sample of subgoals we wrote as a class for a recent homework assignment in Computer Science I:
- Flow charts: Flow charts are a classic organizational strategy for programmers. This strategy I do usually teach formally by introducing flowcharts with the “Branching and Looping Statements with Starburst Candies” activity from Dr. Coffman-Wolph and various xkcd flow charts for laughs. In my experience, students have needed a lot of practice organizing their thoughts for flowcharts so we start with examples of daily algorithms they follow before getting to algorithms they’ll turn into a program.
Starting a program from nothing can be very intimidating, especially for a beginner coder. Encourage students to keep these strategies in their “toolbox” of options and before you know it, they'll be incorporating them on their own! For a classroom visual, here's a handy graphic!
This material is based upon work supported by the National Science Foundation under Grant No. 1836310. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.