Wednesday, December 30, 2020

Looking Back on Computer Science Education in 2020

What a year it has been. I was reading my start of the year post from January. The closing was “2019 has some serious potential.” I had no idea what was to come in 2020. By the middle of March I was teaching online to students who were doing their best to learn from home. It really changes a lot for teachers and students.

So what changed? Well, there was some serious growth in online development tools. Teachers moved to or increased their usage of tools like GitHub, Repl.it, and other online IDEs.  I still like the solution my school used (and continues to use now that they are mostly in-person) of a cloud based virtual machine. That the big cloud companies (I’m looking at you Microsoft and AWS)  haven’t jumped on this means they have missed a huge opportunity in my opinion.

Plans for a lot of physical computing went by the wayside as schools either didn’t have equipment to send home with students or didn’t want students sharing devices that could not be easily sterilized. I suspect emulators got a lot of use.

Along with school, conferences went virtual in 2020. It looks like that will continue into 2021 as SIGCSE will be virtual. It’s still uncertain if CSTA 2021 will be virtual or in-person.  CSTA 2020 went pretty well online. I enjoyed presenting virtually. Though to be honest it wasn’t quite as much fun as presenting in-person. I couldn’t hear people laugh at my jokes for one thing.

For myself, the biggest change of the year was retiring from the classroom at the end of June.  So I have missed most of the crazy on the fall of 2020 school year. I have been watching what my friends have been going through though. I guess I picked a good time to retire. I do miss the kids though.

Friday, December 18, 2020

Pythagorean Theorem Day Programming Project

I’ve been doing little programming projects for my own amusement. I thought about doing Advent of Code like the cool kids are (Looking at you Mike Zamansky who among others is blogging about those challenges) but I just can’t get into them. I need to scratch my own itch as it were. The other day a friend posted on Facebook that the date was a Pythagorean Theorem Day – 12-16-20 because a right triangle with a height of 12, a width of 16 has a hypotenuse of exactly 20. It’s a cute idea if we ignore that the year is really 2020 not just 20.

I commented that calculating the next Pythagorean Theorem Day would be a fun little programming project. Today I thought I would try it myself. The set up is pretty easy. Nested loops for month and day and using the usual math.

There are two issues. One is that not all months have the same number of days. The other is that we want an exact whole number for the hypotenuse.  The first was solved by creating an integer array with the number of days in each month and using those values in my equation.

The second took some thought. There are probably some really cool mathematical ways to do this. I thought about this and decided to cheat a bit. I converted my floating point result into a string, cast it into an integer, converted the integer value to a string, and then did a string compare. The result of the compare determined if I displayed the result or not. There are 12 such dates in case you are interested. Only two of them are after 20 though.

I leave figuring the rest out as an exercise to the interested (or assigned) programmer.

A few things make this a nice student project in my opinion. Nested loops of course, using an array to simplify the programming, and what ever you use to determine if the hypotenuse result is an integer or not. And it is short so you can use it as a demo or an in-class project.

What do you think? How else would you determine if the result was an integer or not?

Thursday, December 17, 2020

Musings on the Goals of High School Computer Science Education

Recent conversations on Twitter and Facebook have had me thinking about the goals of teaching computer science in high school. There is no single goal and it probably varies some by teacher, school, and student population. My goals were basically:

  • Give students a basic understanding of computing and computer science to better understand the world around them
  • Create an interest in computer science so students are willing to learn more.
  • Create in students the idea that they can “do computer science.”

I would rather not prioritize them. I think I did a pretty good job with the first goal. That’s probably the easy one though. But it is pretty important. Helping students better understand the world around them is at the heart of a lot of education. We don’t expect every student to be a novelist, a biologist, a chemist or a professional mathematician. So we are not (usually) expecting HS CS students to become professional programmers.

The second listed goal is pretty hard to measure objectively. I hope I made my classes interesting and the subject itself interesting. A number of students did go one to major or minor in CS so there is that. I hope I didn’t turn too many off.

The last listed goal is also hard to judge objectively but it’s really important. People don’t continue to invest time if they don’t thing they can succeed. Any one can learn computer science. Anyone can learn to program. Some may have to work harder at it than others and some will find it more interesting than others. Student have to know that they can do it if they choose to try.

If students choose to study more CS I want them to have a solid base to build on. I think that is a given. Right? Unless I succeed at the three listed goals above there is not much point in anything else though. So I made the course rigorous and I try to teach the concepts and ideas and good habits that I learned over the decades. I do it with a goal of building success, interest, and understanding of computers in the world today. I’m not just trying to teach the computer science nerds, no matter how much I love then, but all of the students in my class.

Monday, December 14, 2020

Dreidel Game–A Chanukah Programming Project

If you’re anything like me, you like to assign projects that have some relationship to what is going on in the world. Holidays are one such thing. December brings the Jewish holiday of Chanukah – usually right before Christmas. The Dreidel game is a game traditionally played during the Chanukah celebration. It is played with a top that has four flat sides. Each side has a letter of the Hebrew alphabet.

ש Shin ה Hey ג Gimmel נ Nun

The game has multiple players each of whom is given the same number of tokens. Players all place one token in to a “pot” and spin the dreidel to see who goes first. The player who spins the highest value starts. Note: nun is highest, then gimmel, hey, and shin. If there is a tie, the players who tied spin again.

Each player takes turn spinning the dreidel and taking an action depending on what letter they spin.

* Shin: put one more token in the pot
* Nun: do nothing
* Gimmel: take all tokens from the pot
* Hay: take half of all tokens lying in the pot.In case of an odd number of tokens, round up.

The game ends when one player has all the tokens or after some set period of time or mutual agreement.

There are lots of ways to program this of course. Normally, at this point in the semester I have been teaching students how to create simple classes. So when I wrote my solution I created a dreidel class. There are some reasons that this makes for a nice class to create. There is the usual protected data – the face value of the dreidel. And there is the obvious spin and get value methods. I also over loaded the ToString and CompareTo methods.

The ToString method allows for displaying the name of the face value of the dreidel. CompareTo is particularly useful for selecting the high spin at the beginning of the game.

I also added some public const values for the face values so that I could use them in calling programs without the programmer needing to know what the actual values are.

if (player.Value== Dreidel.Shin)

Here we have a fairly simple game to program with a class that lets the programmer do some interesting overloads and activities without too much complexity.

Inspired by a project idea posted on the AP CS Teachers Facebook group group (https://www.facebook.com/groups/APComputerSciencePrinciples/permalink/1873272652824371/)  Thanks to Lee Whiteley for sharing with the community..

Thursday, December 03, 2020

New Resources for Teaching and Learning about Artificial Intelligence

Earlier this week I was a guest speaker in a computer science class (via Zoom of course). It was fun to be back into a class and interacting with students. The students were asked to prepare questions for me and many of the questions were about artificial intelligence. That’s not surprising as AI has really jumped into the public in ways it hasn’t before. That’s why it is timely that code.org has created a new resource for teaching and learning about AI.

The main resource page for this is at https://code.org/ai There you will find a bunch of short videos of 3 to 5 minutes that cover various aspects of AI. Several of the videos explicitly focus on getting people to think about the ethics involved. Satya Nadal, Microsoft CEO, in his introduction makes one of my favorite points right off the bat. It is not enough to think about what computers can do but we also need to think about what computers SHOULD do. Ethics are woven into all the videos and not just the once focusing on ethics.

The videos are typical code.org videos. That means high production values and a diversity of impressive speakers. Presenters represent a variety of ages, races, and colors. They are all impressive and are practitioners in the fields of AI. There are academics and there are people from industry. They really highlight a broad cross section of people involved in AI today.

Besides the code.org videos there are links to videos from other organizations, lesson plans, and activities powered by artificial intelligence and machine learning. And more. It’s a great place to start building the set of curriculum that will work for your course and the age group you teach.

Tuesday, December 01, 2020

Why Do I care About This Program I am Coding?

Why do we program? Well, for some of us it is because we get paid to write code. For some it is part of our learning experiences. For a few it is the fun of it. There are a lot of motivations and they are different for different people. A couple of posts have been thinking about this lately.

Mike Zamansky has bee posting about the Advent of Code event. (Mike’s initial post here Advent of Code 2020)  Today I replied to his post about the first puzzle with the following.

I struggle with these problems a bit. Not because of the technical issues but because of motivation. Or perhaps relevance.  Why would I need to do this? What interesting or important problem does it solve? I guess the issue for me is that solving a problem for the sake of solving a problem, proving that I can did it basically, is not motivating to me. Maybe I have been programming too long to feel like I need to prove anything to myself. OR anyone else for that matter. I get that for some the challenge is enough motivation and that they get satisfaction from the effort. The journey being more important than the destination I guess. And that is fine and if people enjoy doing it that is wonderful. I'm happy for them. It just doesn't motivate me.

As I thought about it, this also related to a post by Mark Guzdial recently. Purpose-first programming: A programming learning approach for learners who care most about what code achieves: Katie Cunningham’s Defense I hope to be able to hear Katie’s defense tomorrow. And look up her papers.

When we as educators assign projects or do demos, what is the purpose of of the code? And does anyone care about it? Students work harder and longer, it seems to me, on projects that they care about. Not just for the grade though that motivates some. Do they want to see the program work for themselves? I always found that the hardest working most motivating projects were the ones students selected or decided upon on their own. Projects that solve problems that are meaningful for them are much more effective than projects that are more about “just do this to learn how this concept works.

I’ve been playing with code myself lately. Each project has taught me something but I was motivated more to solve a problems that was interesting to me than to learn the new concept/algorithm/language feature or what ever I learned. This is what we as educators need to bring to our students in my opinion. They have to care about the problem and not just the grade.