Tag Archives: apcs

Preparing for Year 2 of GitHub Classroom

I’ve used GitHub with my AP Computer Science students for a couple of years, and last year I used GitHub Classroom for the first time. GitHub Classroom definitely made version control more accessible to my students. @mozzadrella wrote about my approach with my students in her Teacher Spotlight series.

As I prepare for the next school year and year 2 of GitHub Classroom, I wanted to make sure that I followed the best practices. For example, I read that there should be a one-to-one mapping between organizations and Classrooms. So, I’ve been reading the GitHub Education Community and playing around. Today, I successfully made it through preparing for the first unit of the upcoming school year. There are a series of steps:

  1. Create a new organization for the upcoming school year (NNHSAPCS201718 for my AP Computer Science class). I also created a new organization for the entire computer science department at my school (NNHSComputerScience). This organization will not be shared by students and will contain starter code repositories, old assignments, and sample solutions for teachers to reference. Previously, I was using the same organization that I used with GitHub Classroom last year.

  2. Request that the new organization be upgraded to have free unlimited private repositories. My request was approved in minutes!

  3. Create a new GitHub Classroom associated with the new organization for the upcoming school year.

  4. (Optional) Transfer the repositories from last year’s GitHub Classroom organization into the new department organization. I will use this organization indefinitely and want everything sourced from here.

  5. Make any changes to the repository on which your first Classroom assignment will be based.

  6. Push the repository from the department organization to the organization for the upcoming school year. (This also pushed the branches. Is there a way only to push the master branch?)

  7. Squash commits for the repository in the organization for the upcoming school year. In the interactive mode for rebase, leave the first commit as pick and change the rest from pick to squash. Then specify a single comment (e.g., “prepared for 2017-2018 school year”).

    git rebase --interactive --root
    
    git push --force

  8. Create a new GitHub Classroom assignment based on the repository in the new organization for the upcoming school year.

  9. Repeat 4-8 for each repository (e.g., unit).

I am not sure if this actually follows best practices, but it seems pretty good so far and is based on the comments of others with more familiarity with GitHub and git than I.

If you have any suggested improvements or questions, please comment!

Twitter Mapping Lab

Background

For the past four years, we’ve done a Game of Life lab as part of the Decisions and Loops unit in AP Computer Science. I love that lab for many reasons. However, after four years and not using GridWorld anywhere else in the curriculum, I’ve decided it was time for a change. I’ve wanted to incorporate data analytics and visualization into a lab. After some research and ideas from a couple of labs developed by others, I’m excited to try a new lab this year: Twitter Mapping.

Introduction

From what I provide students:

Your application will allow the user to search Twitter for a particular word or phrase in tweets located in each of the 50 US states and then display on a map of the US the degree of positive or negative sentiment associated with that search term in each state. For example, if the search term is coding, the following map may be displayed.

Twitter Data Visualization

  • This lab has several goals beyond the immediate concepts of decisions, loops, and unit tests in this unit:

  • Exposure to data analytics. In this lab you will search a large data set (tweets on Twitter) and analyze that data to derive a new understanding (the sentiment of tweets containing a given keyword in each of the 50 US states).

  • Experience using an API (Application Programming Interface) within the context of an unfamiliar software application. In this lab, you will use the Twitter4J API to access Twitter and write code within the partially implemented Twitter Mapping Lab application.

  • Exposure to data visualization. In this lab you will visually represent the average sentiment in a map of the 50 US states.

Details

Feel free to read the entire lab document and check out the GitHub repository with the starter code. If you would like a sample solution, please contact me.

Credits

GitHub, Canvas, and Computer Science

There are certain software development techniques or tools that are not strictly part of the AP Computer Science curriculum that I think are valuable for students to learn about and practice in my class. Two years ago, I incorporated pair programming. Last year, I added test-driven development and JUnit. This year, I made [GitHub](http://github.com/) an integral part of the course.

I want students to be aware of and appreciate the value of source control management. GitHub was the obvious choice as they are [supportive of education](https://education.github.com) and is mostly likely the specific tool that students will encounter.

After consulting with a couple former students more familiar with GitHub than I, I decided to create a [repository for each unit in the course](https://github.com/nnhsapcs201415). At the start of each unit, students fork that unit’s repository and clone it to their desktop. They perform these operations through the GitHub web site.

Throughout the unit, I encourage students to put all of their code in their forked repository and frequently commit and sync. This provides students with all of the typical advantages of source control: they can more easily work at both school and home, and they can revert to an earlier version of code if a project goes astray.

At the end of the unit when students have completed their summative lab, they issue a pull request to submit the lab. They then submit the URL to this pull request via the [Canvas](http://www.instructure.com/k-12/) assignment that I created for the summative lab.

I created a video tutorial that captures the student workflow:

The student workflow works well except when they accidentally generate merge conflicts by not keeping home and school synced.

While exposing students to GitHub is enough of a benefit, this particular workflow is extremely efficient from the perspective of me evaluating their summative labs.

I [still use Canvas’s SpeedGrader](https://pedagoguepadawan.net/216/greatest-benefit-of-canvas/) to keep track of who has submitted the lab and to provide detailed feedback to students. In previous years, I had students submit a zip file of their entire project folder. The link to their pull request is much more efficient. My workflow for evaluating their lab is the following:

1. Click on the link in SpeedGrader to open the pull request page in another tab.
2. Click on the “Check out this branch in GitHub for Mac” icon which does exactly that.
3. Open the BlueJ project file for the summative lab, read the code, read the docs, run the project, and provide feedback via SpeedGrader.
4. Close the pull request.
5. Run the following script which switches back to the mater branch and removes all traces of the student’s pull request:


	git reset --hard
	git clean -xdf
	git checkout master
	

6. After evaluating all of the labs, I list all of the branches that I checked out: git branch --list
7. I then delete each of these branches: git branch -D pr/xx

While the above may seem like a lot of steps, there is very little overhead and it is much more efficient than my previous workflow.

I’m embarrassed to admit that there is another advantage of these GitHub repositories for each unit that I didn’t utilize until this past unit. While making notes to myself about where we had stopped in one class period where I was modeling how to write a certain algorithm, it struck me that I can create branches for each class period. I now create a branch for each class period and, when I demonstrate how to write some code, I commit and sync that branch with some helpful notes to myself at the end of each class period. The next day, I switch to the corresponding class’s branch, read my notes, and we start right where we stopped.

If you have any suggestions on how I can improve my students’ workflow or my workflow, please share. If you have been thinking of incorporating source control management into your computer science class, I encourage you to take the plunge. Your students will learn a very valuable skill!