Programming

We've all been there:
Student: Teacher, I need help Teacher (comes over) Student (shows screen listing three bazillion errors) The student has just written pages of code and finally decided to try to run it only to end up with pages of errors.
Error messages can at times be hard to read for beginners but to see and truth be told, they frequently don't even read them but over the years I've developed a practice that I've found helpful as a software developer and if students adopt the same practice it can save them a lot of time and effort.
# COMMENTS

Never use global variables Never break out of a loop These are two "best practices" that are frequently touted in early CS classes both at the high school and college level.
They came up a couple of times yesterday. Once in the Facebook APCS-A teachers group and once on Alfred Thompson's blog.
Alfred post was topically on global variables. Actually it was deeper than just global variables. It's also about how students progress - what they can figure out at various stages of progress and how what seems like a good idea early on the path to computer science doesn't seem so great later on.
# COMMENTS

JCS's post on Irreal today brought me back. It was about Brief which was the editing hotness back in the day. I played with it a little really mostly used Emacs clones for real work when I was stuck on MS-DOS systems. Usually either JOVE or Epsilon
In the comments Jon reminded me about the MKS Toolkit which brought most everyday Unix tools to DOS along with a shell and a version of Vi.
# COMMENTS

It's once again time for Advent of Code. That one a day programming competition that's been running now for three years.
Here are some thoughts on day 1. The core of the problem is that you have a large string of digits and you have to calculate a checksum. This is done by adding the sum of a subset of the digits. Only the ones that are identical to the digit to their right.
# COMMENTS

Thks question was posed the other day - how can one get students to truly understand the quicksort algorithm?
I've written a few posts about quicksort. The last time I did a lesson writeup on the subject I wrote about first looking and quickselect and then moving to the quicksort. The class was first faced with the problem of writing a routine to find the Kth smallest item in an unsorted data set.
# COMMENTS

I just read Jeff Yearout's recent post titled The Beginner's Garden of Concepts. Not directly related but it got me thinking about programming idioms.
I've been using the phrase "programming idiom" for years to describe a short useful recurring code construct. I didn't realize that it was officially "a thing" until doing a web search on the phrase years later.
As our students grow from newbies on I think it's helpful for them to see recurring and related patterns and programming idioms gives us a name to apply to many beginner patterns.
# COMMENTS

Over on the CS Educator StachExchange, which is in private beta for a few more days, I saw a post asking about how to introduce the A* search algorithm.
I taught A* as part of the APCS class at Stuy so I thought I'd talk about what I did here.
Some time around mid year, we get to intermediate recursion. This is about the time, give or take, when we talk about the nlogn sorts.
# COMMENTS

I'm spending the weekend up in Michigan. Visiting my brother and is family. We're here to see the UMGASS production of Gilbert and Sullivan's The Sorcerer. Batya also came up from Cornell to join us so the two families are all togehter for the first time in about 10 years.
This hasn't left much time for Advent of Code but I did manage to finish yesterday's challenge this morning.
What took me so long?
# COMMENTS

Today we're looking at Advent of Code 2016 number 2.
To change things up, I thought I'd do a video where I live code a solution.
The solution I present is pretty straightforward - use a 2D array (or technically, an array of strings) to represent the keypad, parse the input, and follow the input instructions to build the code.
One of the things I really like about Advent of Code is that every problem has two parts and depending on how you solved part 1, you may or may not have extra work to do for part 2.
# COMMENTS

I recently posted about Advent of Code - a series of programming problems relseased one a day. While they vary in terms of level of difficulty, a number of them make nice problems for introductory to mid level programming classes.
I thought I'd share some of my thoughts on a few of them starting with the first problem from this years competition.
Take a minute to read it over.
At first glance, it might seem to a young programmer that this problem requires a two dimensional array - all about (x,y) coordinates but then there's a problem - there are no limits on coordinates and we can't make an unlimited size array.
# COMMENTS