Sunday, September 30, 2018

My Favorite Bug

A beautiful bug!  
I have a couple of butterfly bushes in my backyard, but sadly this year saw only one Monarch Butterfly come through.  There were lots of bees and hornets that enjoyed the flowers, though -- those bugs however are not my favorites!  This is just an aside, and it does give me an excuse to put a nice image into a blog post with lots of boring text.  It also provides a nice introduction to discussing bugs in coding (and teaching).

My Favorite Bug

This week my students finished the if/else lesson in Java for AP Computer Science A.  Several students ran into error messages of "else without if "because they had placed a semicolon after the if clause.  I explained that this is a very interesting bug in code as the semicolon is essentially telling Java that there is nothing to do if the statement is true.  Others ran into another variation of if/else errors with a comparison clause in the else leg and receive the error "not a statement".

On Monday I plan to introduce to my students a variation on "My Favorite No" which I have seen and used many times as a teaching strategy for math intervention (  I plan to use the same idea as "My Favorite Bug".  The idea behind this is that a bug is not necessarily a frustrating thing that needs to be fixed, but rather it can be a learning opportunity to find a type of error that can be shared with others.  Just like there are patterns for coding, there are patterns for bugs.  And once the pattern is learned it can be easily spotted in our code and in others'.  Another favorite saying of mine, "Life is too short to make all the errors yourself, so try learn from others!"

Teaching Bugs of My Own Creation

I had planned on "My Favorite Bug" being the blog for the week, but found the perfect extension for myself while browsing other CS blogs.  Mike Zamansky had a great blog earlier this week, "Not every lessons has to be magic" (  As a CS teacher, it is not only my code that has the bugs, sometimes my lessons have a bug or too!  And just like my students, these are learning experiences for me.

Earlier this year I was walking through the examples of integer and real-number arithmetic along with type casting with my students.  Although I have used this in code and coded student examples and graded student work with this many times, I still managed to totally botch the explanation and introduce several errors in the examples I used.  So, yes, I needed to re-teach this the following day.  Fortunately, my students are patient!  The permanent fix for this was a sticky note in my file folder reminding myself to review this right before teaching it next year and use the planned out examples that are in the Powerpoint instead of making up ones on the fly.
As something of a perfectionist, this bothers me to no end!  As a teaching moment I thought it was valuable for my students to see that we all make mistakes.  When I do a "code together" with my students I make sure to  introduce easy and subtle errors into my code so that we as a class can find them together.  The students enjoy finding these bugs before we compile.  Even better is when they can find an error that I didn't intentionally introduce.

Teaching Bugs of Circumstance

Another type of teaching bug that I regularly encounter while teaching are bugs of circumstance.  These are the things that are out of my control that I still need to address and fix.  On Friday the school network was running so slowly that it was for all practical purposes unusable.  For my APCS, Game Design and Math class it was not an issue, however for my Exploring Computer Science class we were working on the web design unit, and the assignment was waiting for students in Google classroom, the second option was to work on their blogs using Blogger which also requires network access.

This is one of those moments where improvisation is essential.  The part of web design we were working on was adding images to web pages, adding images as backgrounds, and resizing images using Gimp.  I loaded up the images we were using as an assignment on USB drives and passed them around the room and then projected the instructions up on the screen.  It meant that all students went at a fairly slow pace and were not able to work ahead, but we made the best of it.

I can't say that anything wonderful came out of this experience, but we did make it through.  Perhaps this is also a good point with the "bugs" we face as teachers.  Some of these bugs appear ugly but do have the potential to become something beautiful and other bugs are the ones that we have to live with and work around.

Butterfly image taken from


  1. Awesome article.

  2. Valuable info. Fortunate me I discovered your website by
    chance, and I am surprised why this twist of fate didn't came about
    earlier! I bookmarked it.

  3. Hi there, this weekend is nice inn support of me, foor thhe reaso thaqt this
    time i am reading this impressive informative article here at my house.