Structure of my Computer Science Classes


Comp Sci 20 (grade 11) is usually the first time a student has programmed. Comp Sci 30 (grade 12) is their second course, in which we get to delve a bit deeper. This post describes the overall structure and resources used in each course, and a bit about why I choose to teach it that way. I’ll be adapting my structure to fit with the new curriculum that will soon be implemented in Saskatchewan, but I’m hoping to stick with something quite similar.

##Comp Sci 20 (grade 11)

###Scratch – about the first 3 weeks A gentle intro to the “big ideas” of CS20. One of the things I really like about starting with Scratch is that we can get into interesting problem solving really quickly. By day 4, we are exploring the effects of nested repeat blocks on the tempo variable of a simple beat. After the first week, they are working on a rock, paper, scissors game. I’ve pilfered a number of activities and demo ideas from the Beauty and Joy of Computing course offered at Berkeley.

Concepts covered: event-driven programming (broadcasting in Scratch parlance), loops (repeat and repeat until), variables (numeric and string), conditionals (if/elif/else), functions (defining their own blocks).

###Guido van Robot – about 2 weeks A Karel the Robot clone. GvR helps transition the students from the drag-and-drop blocks of Scratch to actually typing the code themselves, and allows them to make syntax errors. It is essentially a minimalistic language students use to solve visual problems, where the language constrains the number of commands available (move, turnleft, pickbeeper, putbeeper). Despite the limitations on the language, it really encourages the students to stucture their thinking when attempting to solve some interesting problems.

Concepts covered: sequencing, conditional branching, looping, functions.

Note: there are a huge number of similar platforms (CodeHS version, NClab version, Reeborgs world, etc.), and GvR is an old relic. I have kept using it because I’ve found it does a great job of getting the students ready for “real” Python, as it is built in Python itself. The other options either use poor syntax (if you are moving on to Python), or are not free.

###Python – around 8 weeks Diving deeper into the concepts already touched on in Scratch and GvR. How to Think Like a Computer Scientist is an excellent free, online textbook. Although I don’t actually go throught it step by step, I do point the students toward it for additional explanations, and I really like quite a few of the exercises.

After some preliminary text-based assignments, I use the Python turtle module (essentially gives you Logo in Python) in for a couple assignments. We do some classwork with the students trying to code the turtle in the most elegant way possible to draw a bunch of different shapes. I tend to have them try a more involved string manipulation assignment as well, which has sometimes been is a classic Pig Latin translator. Near the end of our Python unit, I like to do a walkthrough of how to create an interesting game with basic AI (I’ve been using this nifty assignment for the past few years).

When using Python at school, it’s handy to have a portable installation (so you don’t need IT to do anything for you). I used to use Portable Python, and am transitioning to WinPython. I’ve customized WinPython to use PyScripter instead of Spyder, and to have a bunch of the modules I like to use pre-installed. I’ll zip that up, and put a link up to it sometime soon. The online Python visualizer is an excellent resource whenever a student gets confused, which is especially handy when we start doing more complicated string manipulation.

Concepts covered: data types, looping, conditionals, functions, string manipulation, lists (arrays), file IO.

###HTML/CSS – 2 or 3 weeks The intent with this unit is to give the students a basic understanding of how the web works. I show they some basic theory videos from the Code.org video library, as well as teaching them basic HTML/CSS. I use HTML Dog and w3schools as the primary resources, and do a fair bit of demo-ing using CodePen. I used Codecademy for one semester, but found the skill level of the students suffered quite a bit when they did this as a self-directed unit. They use Notepad++ as their text editor on the school machines. I avoid tools like Dreamweaver, as the whole point of the unit is to pull back the curtain on how the technology actually works, so relying on software to generate the code seems a bit counter-productive. Some of the students end up embedding their Python projects onto their websites using Trinket.io.

Another topic I sneak in here is having a passing idea of how version control works. I have every student sign up to Github, then have them publish their site using Github Pages. All the students really have to do is create a repository called theirUserName.github.io, commit their HTML/CSS into it, and their page is then available to the world. They really like that.

###Major Project – 2 or 3 weeks The goal of the project is to have the student choose a topic related to computer science that is of interest to them, and create the best product they can (or do a more tranditional research paper). In addition to creating a product, I also have them present their project to their peers.

The tools the students most often choose to use include pyGame, Ren’Py, Stencyl, Unity, Unreal Engine, GameMaker, Kodu, App Inventor, Touch Develop, LMMS, Sonic Pi, any number of hardware type investigations.

##Comp Sci 30 (grade 12)

###CodingBat – 1 week I have the students do selected problems from the Python section as a review of a bunch of the concepts from CS20. They write a quiz at the end of the week to show me (and themselves) that they know enough of the CS20 content to do well in CS30.

###Processing – rest of the semester

Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology. There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping (Processing.org)

The online reference is REALLY good, and allows students to dive into topics they are interested in, even if we haven’t covered it in class (or won’t cover it at all). My primary resource is Learning Processing. For the really strong kids, I use Nature of Code for extension stuff (particle systems, cellular automata, fractals, etc).

Major topics covered in class: review of all the CS20 material in a new language, plus a larger focus on 2D arrays, nested loops, object oriented programming, inheritance, polymorphism and recursion. We hit OOP at about 5 weeks in, and use OOP exclusively from then on. Additional topics (not a lot of time spent on them, but the brighter kids use the ideas in their projects): importing XML data from web sources to affect their program (change background based on current weather, say), using JSON files to save game states (just a layer overtop of basic file IO).

I can’t recommend Processing strongly enough. It is excellent.

###Random Theory stuff – interspersed throughout the course Number system conversions (binary and hex), sorting algorithms (bubble sort, quick sort, merge sort), compression algorithms. I use a bunch of Computerphile videos to introduce many of these topics. I’m not a big fan of doing long sections of theory, so I find showing some short videos, then talking about it for a few minutes that day or another day is a really nice way to do it.

I also like to use the Java section of Coding Bat to have the students practice with simple recursion examples before they attempt to implement it in a Processing sketch.

###Major Project – 2 or 3 weeks For CS30, I insist they code me something using OOP. The options I give them are either Processing or Unity. There’s usually a couple of kids that go with Unity, but the vast majority stick to Processing, as they feel really comfortable with it by the end of the semester.