Monday, July 19, 2021

Pluses and Minuses of the Unary increment Operator

There has been a conversation on Twitter about the unary increment operator (++) and related (+=, –, etc.). I tend to gloss over these when teaching beginners. Especially those in a first programming course. A friend of mine disagrees. It started with:

Would you ever write, or teach a beginner, a = a + 1 if your language supports a += 1 If so, why?

Now obviously professional programming and beginner programming are not exactly apples and apples but we should probably be teaching best practices. Right? On the other hand, there is thing called cognitive load. There are really  at least four ways (in most C-style languages) to ad one to a variable.

  1. a = a + 1
  2. a += 1
  3. a++
  4. ++a

I generally teach options 1 and 3. I mention the others but don’t really expect students in a first class to use them all. Cognitive load. It’s enough for students to remember two ways to do something and they don’t need all four.

The first one has an advantage that it follows a general form. A value is added to a variable and saved in the original variable. This works for a lot more than adding one. Now arguably a += 1  does the same thing but the other format is a building block for more complicated  assignments with out the complexity of figuring out where += fits into the order of operations.

Now the pre and post increment (and decrement) operators are sort of special. It makes a difference which one you use;

foo = bar[I++] and foo = bar[++I] give very different results.

Personally I don’t want beginners using either except as a standalone statement. So I teach it for incrementing loop control values but don’t talk much about using it other places. Now obviously there are cases when using these operators in other places is a good idea. But I think beginners have enough trouble as it is without adding some unneeded complexity.

As time goes on and students become more comfortable with the language and the art of programming, by all means, show them the cool stuff. But remember that code should be readable by people as well as computers. When I was doing code reviews as a professional developer I always looked to readable and easy to maintain code. That’s how I want my students thinking as well.

Agree? Disagree? Jump in in the comments below.

Friday, July 16, 2021

Observations on #CSTA2021 Virtual Conference

The CSTA 2021 Virtual Conference is in the books. I really did enjoy it and I learned a lot. Virtual conferences are different from in-person conferences and I plan a post on that. But for now I want to talk about this year.

First off, the conference program was pretty awesome if I can say that as part of the conference committee that selected them. Not only was content good but the presentations were very well done. At  least the ones I sat in on were. I wonder if the experience of teaching online as so many have had to do played a role in preparing teachers to present at a virtual conference. Thoughts on that?

Secondly, the chat feature in Hopin got a lot of use. As one person pointed out, yelling things out in a live presentation is rude but adding questions, comments, or additional resources in a chat windows is not. More than that it adds to the value of the presentation.

Sessions for grades younger than high school are growing in number. This is hugely important in my opinion. This year, Nifty Lessons had a lesson for the very young grades. There were not many teachers of those grades to hear it though. I would love to see more nifty lessons for younger grades. Elementary school and middle school teachers are doing amazing things and we need to share them.

I ran two monitors during the conference. One monitor was on the conference itself while the second was split screen between the Slack channel the conference staff and committee used to handle things behinds the scenes. The other window was following the #CSTA2021 Twitter hashtag. I don’t have data but it felt like the Twitter stream was less busy than most years. I suspect two causes. One the aforementioned chat activity in Hopin and the other the fact that computers and phones were occupied with attending the conference rather than social media. Is this god, bad, indifferent? I don’t know. Being virtual we had many more people AT THE CONFERENCE so maybe we don’t need as many Tweeting for the people not there?

There was a clear theme of equity in CS education in this year’s conference. Given the last few years, equity is and will continue to be an awfully important topic. The keynotes were all on that topic and at the risk of taking criticism, was that necessary? I love people talking about how they bring equity into the teaching. I will listen to Amy Ko again in a heartbeat for example. The last keynote at CSTA 2021 had some inspiring stories. It was great to hear the success of students from students. We can probably all do even more to bring equity to teaching CS. I would just have liked a little more variety in the keynotes.

I have been thinking about what else I would like to see in keynotes for next year.

One is talk about the need for ethics in CS education. I am not sure what form this keynote should be given or who should give it but ethics in computing is a critical topic in my eyes.  We’re seeing ransomware and cracking into systems all the time. We need to make sure we are bringing ethical thinking into our teaching. Students need to ask “should I?” as often as they ask “can I?”

The second thing I would like to see is pure inspiration. At this point in the year teachers are tired, drained  and most of us could use some excitement. The future of technology is amazing and hearing about the possibilities and ideas that we can share with students to encourage them would be a great thing. Again, I am not sure who is the person to bring it but I want to hear a positive and exciting message about the future. I want energy!

So what do you think? How was the conference for you? What was great or not so great? What do you want to see next year?


BTW, my daily notes on the conference are at:

Notes on Day Three of #CSTA2021

No morning help desk duty for me today so I watches the whole “Morning Java” session. For those of you not at CSTA, Moring Java was an introduction to the day with our conference chairs and guests. Today.Michelle Lippoli, Senior Operations Manager (Events and Membership) for CSTA, talked about all the work that goes into running a conference like this one. And it is a lot of work! Next year CSTA will be in-person in Chicago. There is a lot of excitement about being able to meet in-person but I hope we have the virtual option as it makes the conference possible for so many more people.

First session of the day for me was Nifty Assignments. Though I was tempted by Python and Micro:bit…on a Calculator? and I will look for the video in the future. Nifty is a conference favorite. The idea started at SIGCSE (See more on that here) and I have used projects from previous sessions at CSTA and SIGCSE.

Michele Lombardi - Unplug the Internet!  9-12
Review internet vocabulary, how messages are sent, and introduce potential cyber attacks using this unplugged internet simulation.

I’ve done something similar but I love the forms she uses and the other information about things to do.

Cindy Gonzalez - Bring your 3D world to life!  K-5
Design a 3D design in Tinkercad, upload your design to Cospace, code your design & enter your 3D world using the DoInk Green Screen app

Talk about making students creators and not just consumers. I love the cross curriculum opportunities.

Roger Jaffe - RSA Encryption Without the Math  9-12
How to teach RSA encryption without having to teach the math

I struggle with teaching public key encryption so this set of resources looks very exciting to me. I can see using this lesson in Advanced Placement Computer Science Principles.

Learn more about CSTA Nifty Assignments at: https://sites.google.com/site/cstaniftyassignments/

After Nifty Assignments, I attended Teach Cybersecurity. Change the Future/ (Slide deck here) Did you know that there are guidelines for what to teach about cyber security? There was a lot of discussion about teaching cyber security in the chat. A lot of teachers are, not unreasonably I think, worried about students misusing the knowledge. The Teach Cyber program, and every other program I have looked at, included ethical thinking integrated into the curriculum. This is a curriculum worth looking into if you are thinking about adding a cyber security course.

Last mini session of the day for me was My CSP Experiment – teaching Advanced Placement CS Principles with two different programming languages at the same time (JavaScript/AppLab and Python) This teacher developed a detailed scope and sequence with dates and time and then mapped the concepts to unites from different curriculum programs (code.org, CodeHS and others) Concepts were taught largely with pseudo code and unplugged activities. That was a lot of work. I really admire her skills. (Slides are here)

Well, that’s a wrap for me. It’s been a great conference and I learned a lot. I’m glad I don’t have to travel for hours to get home.

Thursday, July 15, 2021

Notes on Day Two of #CSTA2021

Today started, for me, with help desk duty. While I was there no one needed any help which I suppose says good thi8ngs about the HopIn platform CSTA is using. The other committee member on duty, the amazing Myra Deister, and I spend most of the time catching up. We’ve known each other through CSTA for a long time. It was just like a “hallway track” time for us. I’d love to see tools specifically for that sort of thing.

First session of the morning I was bad. Well, fidgety I guess. I hoped in and out of a number of sessions the whole time.

I started with Misconceptions as Learning Opportunities (slides here) and learned some good things about assessment. An area I frankly need to learn more about. I will be watching the whole session when the videos are available.
I next hopped in to Introduction to Micro:bit with MakeCode just to see what they were presenting. I did pick up a couple of links to related research that I  read later.

https://aka.ms/MakeCodeResearch ,https://aka.ms/PhysicalComp, https://microbit.org/research
Release notes: https://makecode.com/blog/microbit/2021-release

BirdBrain Technologies dropped in to the session to say that they “ loved the micro:bit so much that [they] based the newest version of [their] products on it! US educators can try a free demo of [their]micro:bit based robots: at https://www.birdbraintechnologies.com/demo

I spend most of the rest of the time at Block-Based Machine Learning and AI with mBlock  “ mBlock is a powerful programming environment that combines the familiarity of Scratch with cutting-edge technologies like Google’s Teachable Machine and Microsoft’s Azure Cognitive Services.” (Slides here) I should have started here and I will definitely be watching the full video when available. BTW,
If you are looking for resources about teaching AI check out https://ai-4-all.org

Next up was the keynote by Dr. Amy Ko. I have been familiar with her work from both social media and published papers so I was really looking forward to hearing her speak. Follow her on Twitter (https://twitter.com/amyjko) and read her blog posts (https://amyjko.medium.com/) Dr. Ko gave a great talk which showed all of the levels involved in where things can go wrong in encouraging students to take and continue in computer science. Talks like this are a reminded for me of the many forms of diversity that I have to be aware of and how I need to adapt to meet the needs of people who are not like me. Dr. Ko posts her talks on her web site. This one should be there soon if it is not there right away.

Updated: with links to Dr. Ko’s talk:

Video: https://youtube.com/watch?v=p7IzFIDfyKY Slides: https://faculty.washington.edu/ajko/slides/CSTA2021Keynote.pdf

CSTA Keynote

After the keynote, I hopped into Teaching Exciting Computer Science Frontiers in High School for some ideas about advanced courses and students. The talk introduced me to NetsBlox which is a visual programming language and cloud-based environment that enables novice programmers to create networked programs such as multi-player games. Network programming, yeah! The system also connects to a variety of databases online. So a lot of possibilities for data science or cross curricula projects.  I need to look into this a lot more.

Next up was Selecting and Supporting a New CS Teacher. (Slides here) This mini-session was part of the administrator tack. Love that there is an administrator track BTW.  In any case, there was a lot of good information for administrators including some helpful links in the slide deck.

Teaching with YouTube with Oscar Velizin was next for me. Oscar Velizin has a YouTube channel with videos that mix math and CS. No surprise. One of the takeaways for me was the idea of providing access to the code that is demonstrated via GitHub or some other online system.  (Slide deck here) He had some good reasons for using PowerPoint compared to some other presentation tools.  Specifically the ability to screen capture, to rerecord individual slides, the built in Equation editor, and the ability to easy export videos.

Don’t tell anyone but I skipped the Birds of a Feature. Enough screen time and I wanted to be rested for the last keynote of the day.

The afternoon keynote as Zaretta Hammond who talked about Changing the Complexion of Computer Science Education. Yes, equity was a big focus at this year’s conference. I that that was wonderful. As we look at the events of the last few years we can see that a lot of work needs to be done to promote Computer Science for everyone.

A note of process. Yesterday I took notes in a text document. Today I took my notes in Open Live Writer which is my blogging tool. I filled things in during breaks between sessions. That made it easier for me. I like having my notes in blog form both to share with others and to return to for my own follow-up on sessions.

Wednesday, July 14, 2021

Day One–#CSTA2021

Today was the first day of the Computer Science Teachers Association conference. All online of course. It was a pretty cool day. I got myself set up with a two monitor system, headphones, and a notepad for notes. Being on the conference committee I had some specific commitments. The two monitors made that easier. I spend the first hour working the help desk so I missed some of the opening keynote and welcomes. It felt good to be able to help out that.

My first session of the day was AI and Machine Learning with Code.org with Daniel Schneider , a Code.org Curriculum developer. His Slides are at https://bit.ly/csta2021-aiml. One expects a high level of production quality from Code.Org and this program seem to have that. The curriculum can be used several ways as a stand alone or modules can be used in a larger course. If you are looking to teach about artificial intelligence and machine learning this is a great place to look for materials. Code.org AI/ML Curriculum

Next you was Secret Coders Teach Computational Thinking with Dr. Rachelle Haroldson and Dave Ballard Slides at  https://bit.ly/2UUPDUf They started with an introduction to as 6book set of books for younger students called Secret Coders. Now K-5 is not my usual thing but I have a grandson who just finished kindergarten who is already interested in computers so … After introducing the books they presented some good exercises to go along with the stories. Some were offline like the one at Fun-with-Coding.pdf which I can totally see adapting for older students as well. And some were online interactive. Overall, I thought it was a pretty good program for younger students.

The mid-day keynote was from Tim Bell, the man behind CS Unplugged, You know its going to be a good talk when the presenter starts by playing a huge  pipe organ. Dr. Bell is a great presenter. He had a lot of good things to say. For example, "We write programs for people to use. There may be a few people that need that memo."  The big learning for me though was him saying  that Combining unplugged activities with coding activity works better than unplugged along. Having students do an unplugged activity should be followed with some actual coding activity. Makes me think a lot about how I use unplugged activities.

Next up for me was  a session on the Carnegie Mellon University (CMU) CS Academy curriculum  Link to presentation slides. CMU has several courses of different lengths and for different levels of complexity. Course are Python based and have been developed and well tested in actual classrooms. The demos show some great production values with a lot of thought given to teacher tools.Courses start at the middle school level and into high school. Some of the modules will fit nicely into the coding parts of Advanced Computer Science Principles. And its all FREE!

Last session of the day for me was Coding with Scratch Junior in the PreK–2 Years. Looking for ideas for my grandson again. This session provide a slide deck of resources and a Slide deck. Scratch Jr is an Android tablet app that look crazy easy for students in PreK to grade 2. I think my grandson will like it. There are many ways it can be used cross-curriculum as well. Pretty cool stuff.

There were a bunch of sessions I would have liked to attend but one can only be in one place at a time. Thank goodness that all sessions were recorded and I will be able to watch them come August.

Tomorrow I will be back in the Help Desk at 10:30 Eastern US time. I’m looking forward to a bunch of great sessions after that.

Tuesday, July 13, 2021

Learning My nth Programming Language

They say that the second programming language is the hardest to learn. That’s mostly because one learns how to program using their first language but each language has its own idiom.  I was lucky in that before I completed my BS degree I had learned enough of at least six programming language to write usable programs. So when at my first professional programming job they handed me a language reference manual and a functional specification and asked me to develop on a new (to me) operating system I got on fairly well.

I continued to learn new programming languages over the following years and have lost count of them all. But having a project, a good reference manual, and usually some good sample code I had a lot of fun learning.

This spring I had to reconnect with Java and learn the Processing system. To be honest I used the code students had written before I took over the class for some of how I learned Processing. Syntax is new but concepts change a lot slower and experience (in this case with XNA) was very helpful. Having a wide range of experience sure does help. And I used Bing a lot

These days I am attempting to learn Python. I have a number of Python books written for beginners. They look great for beginners but for me they just don’t work. There is to much about how to program in general and finding what I need becomes tedious. Programming language documentation has changed over the years. For the most part that’s probably good. For me, well, let’s just say I miss the old dead tree simple language reference manual.

Finding good sample programs for what I want to learn has been a struggle as well. Search engine AIs are not as good as we need them to be yet. What to do? Well, this is were community comes into play. I asked for samples on the Computer Science Educator group on Facebook. Some brief conversations and Lisa Hines, a CS teacher from Canada, shared two wonderful samples that look like they should give me a real start. The Internet sure has made for some great community building for computer science teachers.

Monday, July 12, 2021

Avoiding Tour De Force Sample Code

Sample code is a wonderful way to teach and learn coding.  The problem with a lot of sample code is that it is just too complicated and to fancy. I call it tour de force code because it seems like the authors are trying to show off how awesome their coding skills are. That’s probably a bit harsh but I feel like using 1,000 lines of code to show off every single feature of a concept/API/Class or what ever is overwhelming. It is the sort of thing that sends beginners a message that things are over their head.

I’ve always tried to avoid over complicated examples that I write for students. Far too many of the samples one finds from major vendors are either too complicated or leave out important information that beginners are not likely to have. Of course most samples on the internet are written for professional developers so that’s understandable. Beginners (students) requirements are far different from those of professional developers.

It doesn’t have to be that way though. The Phidgets website (see my post on Phun with Phidgets for context) has a sample code generator that I really like. (https://www.phidgets.com/?view=code_samples ) There are a number of options depending on how much a developer wants to do themselves and how much they want generated. Any way you do it there will be lots to do to make your final program. The samples are very basic but they do let one test a device and see some of its features. I wish more companies did things like this.

Over the years I have written some code generators myself. In fact, one of my masters degree projects was a simple “compiler” that generated code in multiple languages to work with a user interface library.  It generated very basic code that handled the most repetitious and tedious parts of the code so that a developer could focus on the interesting parts of code. It had the advantage that it used as input the markup language for the documentation system. It’s a shame that commercial systems like that don’t exist today.

I’m starting to think that writing code generators might be an interesting project. Something like a user interface that asks for variable names and things like loop parameters and generates code snippets. Some provisional IDEs, Visual Studio for example. provide help with generated snippets but I think that coding a generator might help students understand the code they use better. It’s just an idea at this point but I want to think more about it.