Ruby Grading 2.0

I just recently posted my experiment with making a Ruby program that you can use for doing your own grading. I have since made several improvements upon the first draft of the code, so I present to you Ruby Grading 2.0.

The changes:

1) I converted the code to incorporate classes, which was a huge learning process for me that involved lots of troubleshooting. I think I am starting to get the hang of classes and understand their importance. The conversion process was nightmarish, but they allow you to be a lot more flexible when trying to include new tasks. Plus, I learned a lot from the ordeal.

2) I made it so that you can now input your entire roster into the grading program and calculate all your final grades there. You only input the syllabus parameters once, at the beginning. The program saves these and then applies them to all the students on your list. At the end it will spit out a nice little list of students’ names and their final percentage grades.

3) I also tweaked several small things as I went to account for differing input situations. Before the program couldn’t account for certain types of input. For example, if you typed in “three” and not “3” when prompted for the number of assignments, the program would break. I still am not quite sure how best to deal with those sorts of situations; I couldn’t really find a satisfactory test for whether or not input was convertible to an integer or not, so I think I invented one that seems to work (see lines 136-141 of the code). My test:

I cast the input string to an integer. If the integer is greater than one the code works. If not, something has gone wrong (who assigns fewer than one assignments), and it will ask for the input as an integer. It works, but it feels like a particularly dirty way of doing things. Next up, three things if I should continue: 1) Make it so that quizzes can be dynamically inputted into the program interface, with the possibility to drop the lowest one if necessary. 2) Consider making a version of the program that reads out of other files so that you don’t have to do all your grading in one session. After all, we keep our gradebooks as we go, so this information is all typed somewhere else. It seems like the biggest time save would be to have it open a file, examine its contents, and spit out a calculated final grade for you. 3) Maybe include a method that will convert the percentages to letter grades.

Brandon is Head of Graduate Programs in the Scholars' Lab. His research focuses on modern and contemporary fiction, especially on Anglophone modernisms and the novel in relation to sound studies and musicology. Before coming to the Scholars' Lab, he was Mellon Digital Humanities Fellow and Visiting Assistant Professor of English in the Washington and Lee University…


  1. Awesome! I also had some fun using Ruby to calculate my grades at the end of last term. One thing I found very helpful was the ruby ‘csv’ library to parse those csv files that the Collab gradebook will export and import. That allowed me to quickly slurp in all the grades I’d been entering throughout the term, then upload the calculated grades from my script keeping them matched-up with the student records. Using a script to calculate the grades let me do a few things that weren’t possible with Collab (as far as I could figure out anyway!) like automatically dropping the first two absences in the attendance scores.