Wednesday, April 18, 2018

Arrays, Loops, and Racing Horses

One of the things I like about using Visual Studio and C# (and Visual Basic for that matter) is the ability to easily create some fun graphical projects. I’ve been using variations of the horse race program for years now. I though it might be fun to share my latest use.

image

Students sometimes have trouble seeing the benefits of arrays because they are used to small projects that can get by without them. I want them to see how the combination of loops and arrays make expanding programs easier.

My students were given a mostly empty project with the objects you see in the image above already part of the project. I don’t want them to get lost in setting up the GUI. There is a “Race” button, a “Reset” button, four picture boxes, and the finish line (a nicely formatted label.) No code though. We’ll create that as a class.

The first thing we do is allocate an array of three picture boxes. Next we assign the value of the existing picture boxes to the array. We talk about how the picture boxes now have two names or two ways of addressing them. This is related to people’s names – formal name, nickname, etc.

public Form1()
{
     InitializeComponent();
     Horses[0] = picHorse0;
     Horses[1] = picHorse1;
     Horses[2] = picHorse2

}

The naming I use (I hope) drives home how identifiers that differ only by a number at the end leads one naturally to thinking about arrays.

We write code to move the “horses” random distances each time a timer fires. Using timers is not absolutely necessary and I have used while loops but timers open some ideas for interesting projects. The “Race” button enables the timer and the horses start moving by changing the Left properties by random numbers of pixels..

for (int index = 0; index < Horses.Length; index++)
{
     Horses[index].Left += r.Next(3, 8);
}

Next we add the code to check to see if the Left property plus the width of the box crosses past the left property of the finish line.

Students are asked to figure out the Reset button on their own and most do so easily. At this point we’ve had a lot of discussion about the code we’ve written so far. Next I ask them to add more horses to the problem. They soon discover that this is a fairly trivial task because of the way we have designed the program.

Since we get to work with interesting arrays and see how setting up loops we cover some important topics. Best of all, students seem to like this project.

There is room for student creativity as well. Some add only a few horses, some add many. Some get fancy with reporting winners. Some explore other images from what I provide. Others decided they wanted that last place horse to disappear before the next race. That involved a lot more work then they expected but they were motivated to try things. But no one, including me, get bored.

Tuesday, April 17, 2018

Training The Next Generation of Computer Science Teachers

The biggest problem in computer science education is training the teachers we need. That seems to be the big thing on my social media in the last few days.

This past week was a major document release in New York of "Priming the Computer Science Teacher Pump: Integrating CS Education into Schools of Ed”. Mark Guzdial wrote about it here. You can also download the actual report here.  Mark also shared the slide deck from the event on Slideshare here. If you don’t have time for the whole report the slides make interesting reading as a sort of summary.

It has been clear to many of us in CS education for a while that we really need schools of education to step up and prepare CS teachers. This report addresses what is needed with some solid recommendations. This being computer science education, others are tossing in their opinions.

Mike Zamansky, who was at the release event, gave some of his thoughts on his blog at - Math For Math Teachers - watering down CS Ed before we even start. Mike comes from a heavy CS background and many years teaching at a highly rated, entrance exam, public high school in New York City. That gives him a particular perspective.

Garth Flint, who teaches as a smaller private Catholic K-12 school in Montana, wrote a blog post on the subject - CS Ed – to water or not to water, that is the question which really covered the situation for a lot of teachers especially those in rural areas and other smaller schools. 

It’s a different perspective from Mike’s. One is not better than another – they’re just different. In a sense those two posts show some of the diversity of educational environments we’re seeing in computer science education.

Preparing teachers for this wide range of needs is definitely going to be part of the challenge. I can’t see a one size fits all CS teacher preparation scheme working. There is really going to have to be some local variation as well as consideration as to different age level preparation. I’m not sure one can easily prepare for the full range of Kindergarten though Advanced Placement Computer Science. Content is one thing but the how to teach is another.

OK, now there is something of a roadmap. Will schools of education move into this space the way we need them to do? We’ll see I guess but I hope so.

Friday, April 13, 2018

Teachers For Now or Teachers Forever?

One really can get a lot out of following Twitter hashtags from conferences and other events. Today I saw the following Tweet:

image

This in a nutshell is the concern with a lot of current efforts to prepare computer science teachers in a hurry. Yes, you can teach a teacher to teach a specific course and you can give them a lot of scaffolding and tools to get by. They may even see great results. But what happens when things change?

My school has something like 20 different courses in the Math department. Can you imagine hiring a teacher who could only teach one of them? Even one that is a soft of default course? Seems like a long shot. We want our Math teachers to be able to teach a range of courses. We want that not just so they can be moved around as needs change or to give them diversity during the day but because we want teachers who know where their course fits into the whole curriculum stream.

Shouldn’t we want that for computer science teachers. The #Home4CS event, from what I can tell from Twitter, was about preparing pre-service computer science teachers in university schools of education. One can easily find Masters degree programs in teaching English or teaching Math or teaching other sciences. A MS is Teaching Computer Science? That’s a bit harder to find. That’s really going to be essential if computer science education is going to grow and mature the way we really need it to develop.

Content knowledge is absolutely critical for teachers to be able to continue as computer science changes. It’s necessary but not sufficient though. Teachers need to know how to teach computer science. It’s not the same as other subjects. Yes, people with deep content knowledge can learn to be good teachers. And teachers can pick up content knowledge and develop into good CS teachers. Learning content AND how to deliver it before starting in the classroom would be a huge advantage. It would be better for teacher and students alike.

It is not going to happen until schools of education start making a home for computer science educators.

Thursday, April 12, 2018

Can We Afford a Digitally Illiterate Congress?

Like many people I found the Zuckerberg Congressional Hearings disturbing on several levels. Yes, there are some serious issues with Facebook and other Internet services with regards to privacy, security, and social impact. We clearly need to deal with them. That is probably a topic for more discussion and blog posts. The lack of understanding of how technology and the Internet works on the part of people who can and likely will pass laws about them was also deeply concerning.

Doug Bergman talked about this at length in his post “The Elephant in the Room.” That’s a great read and I recommend it highly. But I have to stick in my own two cents.

Someone asked me if we required deep aviation knowledge in the members of Congress who questioned Howard Hughes. I think their point was that we don’t expect our Congress people to be deeply technical on all subjects that come before them. That’s a valid point  but at the same time we would hope that they would consult with experts before making decisions. And frankly some of the questions should have been general knowledge and were not deeply technical.

A lot of people who disturbed when Senator Hatch asked how Facebook could maintain a business model where its users didn’t pay for the service. I know I was. Advertising support is a model that predates the internet. It’s a model that allows us free radio and TV for example. To not know that this is how Facebook supports itself is worrying to me.

That and other questions could have been and should have been explained during staff preparation of the Congress people while they prepared their questions.  They are pretty basic.

These hearings were one of the best arguments that everyone needs some computer science knowledge. Not just the computer people. Not just the STEM people. Everyone! And just maybe, with the way things are going,  its particularly important for those planning on a career in politics.

It also seemed that several people had trouble understanding the answers even though Zuckerberg tried to make them simple. It seemed like one Congress person had no real understanding of what an encrypted message was about. That’s not just a Facebook or even internet thing. Though we do often discuss it in digitally literacy units (I know I do.)

Monday, April 09, 2018

Why Programmers Need To Ask Questions

I keep seeing suggestions that people don’t need to learn programming because computers will do it better. I am skeptical. In part I am a skeptic because I have been hearing this sot of thing for scores of years and I don’t think we’re getting close to this that quickly. But more importantly I worry that it will take language processing a long time to get good enough at understanding people and language.

For example you may have seen this old joke:

A wife asks her husband, a software engineer "Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6!" A short time later the husband comes back with 6 cartons of milk. The wife asks him, "Why the hell did you buy 6 cartons of milk?" He replied, "They had eggs."

I like to share that with my students to help them understand ambiguity in language. Today I saw this somewhat macabre version.

write letters

I’m still not 100% sure I want to use this one in class but it does highlight the risks of unclear speech.

One of the things I learned developing applications early in my career was that users use language that works for them and for people in their field but which may not be clear to others. It is important to understand their vocabulary, their understanding of the tasks, and how they work. Without a common set of assumptions trouble is an unavoidable result.

In the first joke above there is no clear connection between eggs and milk and bad assumptions are made. I’ve learned to question my wife closely about the shopping lists she gives me. Things that are totally clear in her head may be totally opaque to me.

Will computers be able to know how to ask the right questions? Or will they make assumptions of their own? I’m guessing this will take a while to work out. In the mean time we, people, are going to have to be very careful about how we instruct computers.

Friday, April 06, 2018

Idealism and Computer Science

Idealism is a good thing. Well, mostly it is. This morning I heard Facebook COO Sheryl Sandberg say that Facebook was too idealistic about somethings and that lead to the current Cambridge Analytica scandal. In another interview she said that Facebook was told by Cambridge Analytica that they had deleted their data which turned out not to be true. But Facebook trusted them.

When people have good intentions they tend to assume that others also have good intentions. The very early computers and Internet had very little in the way of security. Most people had only good intentions and assumed that everyone else had them as well. Why secure things if you are sure that no one will misuse them?

One of the things I learned early in my career is that any program of any size and complexity can be used in ways that the people who created it never intended. We’d all like to assume that no one would using things in bad ways. Alas, this is not the case.

These days we teach a lot about being safe with computers and protecting data. It’s a complex problem and one that I think students don’t always absorb as well as they should. Idealism is strong in the young even though there is evidence of people acting badly all around them.

Many of us get into the field of computing as a way to make the world a better place. Facebook wants to connect everyone in the world to build community. Google wants to index all the world’s information to make it accessible and available for everyone to learn.  Most companies at their core have some ideal of “good” as their mission. This is especially true of many companies, like Google and Facebook, that are founded by young idealistic people.

Somehow we have to get people to understand that there are people who will misuse data and we have to find ways to minimize the negative aspects while enabling the positive. And we need to start with the young so that they can continue their idealism and ideals and at the same time protect the people they are trying to help.

Thursday, April 05, 2018

Thoughts on where CS education tools come from

TouchDevelop is being retired. It’s not the first tool with educational use to be retired by Microsoft. Or from other companies either. While I have used TouchDevelop with my students I was getting ready to move to MakeCode anyway so it is not a fatal move for me by any stretch. I know other teachers who have been using it more extensively who are going to feel some pain though.

I tend to divide CS educational tool sources into four categories.

Professional tools that are useful in education. In this category we see things like Eclipse, Visual Studio, and other development tools that are being used to create real products. These tools are not going anywhere anytime soon. Companies, both those that use them and those who create them, have a vested interest in supporting and improving them.

University developed tools. This includes things like Alice and Scratch but also BlueJ and Snap! and, well, far too many to mention. These are also likely to stay around for quite a while. People tend to build careers around them and use them to attract graduate students who use them, enhance them, and generally want them to be around.

Education companies. Companies like Tynker and Birdbrain are included in this group. As long as these companies can make enough money to keep going their tools will be around.

Industry Research Projects This is often the most state of the art and cool new things. On the other hand they are the least to be around for a long time. AppInventor was originally one such. Fortunately for educators who adopted it, when Google was done with it they were able to hand it off to a major university where it continues. TouchDevelop is another. Hear though, when the researchers moved on to new ideas there was no similar handoff. Both the Touch Develop web app and cloud backend are open source under the MIT license:

There is no indication that anyone is going to take it on though. I always assumed this day would come to be honest. Industry research groups have changing priorities and in some ways that is a good thing. I could argue it is a very good thing in terms of advancing the state of the art in computer science. It’s sad for us in education who aren’t always as quick to adjust as industry is.

As one tool fades another grows. MakeCode is pretty cool and there is a lot there learned from TouchDevelop, the Micro:Bit and educational uses of them both in there. Microsoft is developing a sprite-based game engine for MakeCode and a new course on game programming, in the spirit of CCGA (an interesting curriculum based on TouchDevelop.). One hopes it will be available in some form for teachers to learn it this summer.

I’m not sure where the materials developed by code.org fit into my classifications though. They are a non-profit with industry funding but they are neither industry or academia.  They have some great stuff though. I am using their CS Principles program for example. Chances are I’ll retire before they “go out of business” so I can probably depend on them plenty long enough.

Nothing lasts for ever though and change is the most constant thing in computer science. So we have to learn to adjust and change our tools and our curriculum, probably, a lot more often than educators in other disciplines. At least we’re not going to get bored.

Wednesday, April 04, 2018

Phillips Academy Capture the Flag 2018

Those of you with interests in working on cybersecurity with your high school students this Capture the Flag event will find this to be of interest.


PACTF is back! PACTF 2018 begins Monday, April 16. Like last year, PACTF will work around your schedule and have a challenge for you, whether you’re a seasoned CTF veteran or just beginning. This year, we are proud to offer over $20,000 worth of prizes to the top 150 teams.

Short for Phillips Academy Capture the Flag, PACTF is a computer science and cybersecurity competition for high-schoolers. PACTF is brought to you by Amazon, DigitalOcean, and JPMorgan.

There will be two week-long rounds: from April 16 to April 23, and from April 23rd to April 30, 2017. During each round, you can pick any 48-hour span to compete with your team.

Registration is open — sign up now!

Happy hacking,
The PACTF Team

How To Teach Computer Science

How can I do a better job of teaching computer science? It’s a question I ask myself just about every day. There have been two big influences on my teaching style. The first was my first computer science teacher – Wally Roth of Taylor University. One thing we know is that most teachers tend to teach the way they were taught and using  what worked for them. That doesn’t work for everyone and worse still it ignore changes in knowledge of pedagogy and culture. During my first round of teaching I knew that I was not doing the best job possible. The best I could do with what I knew sure. But I knew I didn’t know enough. Nine years at Microsoft traveling around the country and meeting with other teachers taught me a lot. Much of it I use regularly today.

More recently I have been influenced a great deal by Mark Guzdial. Mark actually researches how to teach computer science. Not just “hey I think this is cool so teach this way” but actual scientific, peer-reviewed research. I use ideas from him all the time. His blog is a must read for me. 

Recently he gave a talk (viewable here https://www.youtube.com/watch?v=N3uCb-95fFE) on a lot of what he has studied. A couple of highlights are:

  • Teaching in context
  • Asking students to make predictions during demos
  • Sub goal labeling
  • Using examples and Parson’s Problems

As I learn more about how to use these techniques and figure out how to fit them into how I teach I am using them more and more. I recommend the video as there is a lot of good information in about 45 minutes of talk.

Tuesday, April 03, 2018

Digital Thinkers?

This message from Brian Aspinall was floating around in my social media the other day and it really resonates with me.

problem solvers

I’ve long said that we don’t need to teach computer science to create more computer programmers (coders). Now teaching computer science or programming does not automatically make people better problem solvers even if we want to really believe it does. But at least it adds another tool to the tool box.

I’m not sure I know what a “digital thinker” is but I am sure we need people who understand computer science. We are depending on computer science to help us solve an awful lot of problems these days. Leaders of the future are going to be in bad shape if they don’t have some understanding of the power and the risks of computer technology.

Monday, April 02, 2018

Is Computer Science Hard to Learn?

It’s been close to 45 years since I took my first computer science course. I really struggled with the first program. OK someone mostly wrote it for me. The third program we worked on together and the third I mostly wrote for the other person. People do seem to learn computer science at different rates. By now a lot of it seems easy. Programming in particular seems pretty easy.

It doesn’t seem to be so easy for students though.  Is it harder now or do I just not remember how hard it was when I started?  Does it take special motivation?

That’s just one thing I started thinking about while listening to Don Wettrick’s podcast with Doug Bergman and his students.

Doug Bergman: The Case for Computer Science in School’

Lots of good stuff in this podcast. Well worth the listen.