14 October 2011


Google Code-In is an open source development contest for 13-17 year old students. Similar to Google's Summer of Code, but targeted at younger programmers.

If you know any High School students who are interested in programming or curious to get involved in open-source projects, you might want to point them to the announcement on Google's Open Source blog.

The participating projects haven't been announced yet, but some of the tasks will include: coding, documenting, researching, training, translating and user interface design.

Timeline:
November 9: Announce participating open-source projects
November 21: Google Code-In begins
January 16: All tasks must be complete 

[Repost from: Google+]

13 September 2011

How to explain programming to young children

A recent article on Slashdot had an interesting comment titled Here's my way of explaining "programming" authored by "Sun" (or Shachar) [minor typos corrected]:

Caveat - I have never actually tried it, and I developed it for adults. I still think it might work with 2nd graders (probably too complex).
Ask for a volunteer. Write a bunch of numbers on the board, and tell the volunteer to sort them.
Explain that this is not programming.
Now, cover the volunteer's eyes, write some more numbers on the board, and tell him to tell you to sort them. Allow asking "what is the first number" and such.
Explain that this is, also, not programming.
Now, tell the volunteer to tell you how to sort the numbers before they are written on the board. Explain that once the numbers are written on the board, you will not hear any comment from him. Write the instructions down on the board. When they are done, write down numbers and carry the instructions out. Try to pick numbers that won't work with their instructions. Allow the class to fix the instructions, but any time they do, restart the whole thing.
This is programming.
Shachar

While I agree that it seems a bit involved for a 2nd grade classroom (where making a PB&J sandwich might be more appropriate), this seems like a good approach for middle school and up.

Technically, this is demonstrating how to create an algorithm, but creating an algorithm to solve a task is a big part of programming. Once the algorithm is done, the programmer must then implement it efficiently in a programming language.

A variant of this would be to pair up the students and give each group a set of cards to sort - cards should be a bit easier for the blindfolded student to work with. After each group has created their sorting algorithm, the algorithms can be shared with the class and you can run through examples to improve them collaboratively.

11 September 2011

K-8 curriculum overview for computer skills

From the If-I-Ran-The-World Dept...

So here is a rough outline of my ideal computer skills curriculum for K-8, with a focus on preparing students for programming in middle school. I'm assuming roughly 1.5-2 hours per week and ~32 weeks in a school year. For K-5, the items are more "computer literacy" than "computer science", but that changes in middle school (grades 6-8) where the focus switches to teaching how computers work and how to program.

Note that, when assigning a lesson to a grade/age, I tried to select a grade where the vast majority of students would be ready and able to understand the concepts. Thus, the grade-level specified is meant to be appropriate for a classroom setting.

When homeschooling or teaching an individual, you may find that the student is ready for this material at an earlier age (often 2-3 years earlier). The best learning environments are those that can adapt to the students' interests, so feel free to move things earlier as needed. But note that this request to move the lesson earlier needs to come from the student.

For classrooms, if you prefer to think in terms of Introduce/Reinforce/Master, then the grades listed here are a cross between Introduce and Reinforce.

I'm using US school grades so add 6 to get an approximate age (1st grade is roughly 7 yrs old).

Elementary School

The key lessons here are to learn how to use computers effectively and to be exposed to the underlying math/logic principles that will be used in middle school.

At the end of 5th grade, the students should have the following skills:
  • Know how to interact with a computer using mouse and keyboard
  • Be able to save/load files from an app, and to organize their files in directories
  • Understand non-decimal number systems, specifically binary numbers.
  • Understand basic boolean logic, specifically AND, OR, XOR and NOT
  • Have a general understanding of how things are stored on a computer
  • Be able to use a web browser and perform effective internet research
K - 2nd grade


During these years, the student should develop basic computer interaction skills.
  • Mouse: moving, pointing, clicking, selecting, double-clicking, dragging, ...
  • Keyboard: basic typing skills, 
  • Parts: name the various parts of a computer
3rd grade

Focus on using computers as tools.
  • Productivity apps: word processor, spreadsheet
  • Keyboard shortcuts for common operations: (cut/copy/paste/undo, find/search)
  • Understand file types: txt, doc, gif, png, mp3, avi, ...
  • Understand where files are stored: locally, on file server, in cloud
  • Maintaining an account: passwords, logging in/out, simple security
  • Web browser - using and navigating
4th grade

More work with using computers as tools, but start building the foundation for
computer lessons in later years.
  • Email - etiquette, subject lines, spam & chain-mail, attachments, privacy, To/Cc/Bcc
  • How to perform internet research. How to evaluate a website's reputable.
  • Ethics: copyright, fair use and giving appropriate credit
  • Web browser - uploading/downloading/sharing files
  • Security: viruses, worms, trojan horses
  • Security: passwords, privacy
  • Number systems: roman numerals, tally marks, zero
  • Number systems: positional number systems (decimal, octal, binary, hexadecimal)
  • Curriculum-Link (Math): number systems
  • Curriculum-Link (Math): plotting x-y values
5th grade

Less focus on how to use computers, and more focus on what's going on behind the
scenes.
  • How data is encoded on computers (text/char-sets/unicode, colors/rgb/hsl, digitizing analog/digital, audio, video, ...)
  • Compression/decompression of computer files (zip)
  • Security: encryption
  • Difference between text editors and word processors.
  • Privacy: browser history, cookies, caches
  • Privacy: what happens when personal info (or password) is comprimised
  • HTML/CSS: create a set of linked webpages (on local machine) using a text editor.
  • Learn how to structure a project with many (HTML/CSS) files.
  • Boolean logic: AND, OR, XOR, NOT
  • Curriculum-Link (Science): colors and light, additive/subtractive color models
  • Curriculum-Link (Math): prime numbers (encryption)
Middle School

During middle school, the students should be introduced to programming and learn how computers work. Optionally, they should learn about electronics and robotics (although these lessons tend to require extra equipment, so it's not always possible to include them).

At the end of 8th grade, students should:

  • Understand why computers use binary
  • Have been exposed to the "big ideas" that de-mystify how computers work:
    • How computers perform computation
    • How computers remember things
    • How computers perform actions in sequence
  • Know how to write simple programs in at least 2 different programming languages
  • Be able to construct a small electronic project on a breadboard

6th grade

In 6th grade, the students should be introduced to all the basic programming concepts: variables, flow control, functions, arrays, and so on.

  • Visual programming: Scratch or variant - variables, flow control
  • Choose two languages from: [Python, Javascript, Processing] - functions, arrays
  • Interact with the computer using the shell/cmd-prompt
  • Wildcards and simple regular expressions
  • Internet: How the internet works (to route traffic, overview of DNS)
  • Privacy: where your internet 'footsteps' are logged (routers, ISPs)
  • Security: botnets and why you should apply security patches
  • Algorithms: searching, sorting
  • Curriculum-Link (Science): Write spreadsheet functions for data analysis

7th grade

Continue building programming skills by expanding into more languages. Introduce basic electronics and explain how computers work.

  • Choose remaining language from: [Python, Javascript, Processing]
  • Electricity: very simplified - focus on Voltage - just enough to understand transistors
  • Transistors: what they are and how they work (CMOS)
  • Logic gates: built from transistors (NOT, NAND, NOR)
  • How computers calculate (addition using logic gates)
  • How computers remember (memory latches using logic gates)
  • Negative numbers in binary (2's complement)
  • Basic digital electronics with Arduino (breadboards, LEDs, servos, ...)
  • Optional: Robotics (if you have the resources)
  • Curriculum-Link (Science): Electricity (done properly with V=IR, ...)

8th grade

More advanced programming and managing larger projects.

  • Java (using Greenfoot or BlueJ)
  • Do at least one "large" programming project
  • Project management: divide large task in to smaller subtasks
  • How memory is allocated (stacks, heaps, fragmentation)
  • How functions are called (call stack, recursion)
  • Data encapsulation, classes and inheritance
  • Regular expressions: grouping and matching, greedy vs. non-greedy
  • Floating-point numbers: representation and implication for scientific calculations
  • More data structures and algorithms: stacks, linked lists, hash-tables, trees, graphs, ...
  • Curriculum-Link (Math): Trigonometry
  • Curriculum-Link (Science): Using regexps to process data files
  • Curriculum-Link (Science): Gravity, acceleration (for jumping in a game)


05 June 2011

A Computer Scientist's Lament

Here are a couple of recent articles on learning CS that I found interesting because, rather than focusing on the classroom setting or enrollment numbers, they talked about the challenges facing a motivated self-study student.

In Andrew Binstock's "Lax Language Tutorials", he discusses the current state of programming language tutorials. In summary, most books being published appear to be confused between an introductory tutorial and a treatise on every feature of the language. This leads to absurdly large volumes that may be a bargain in terms of dollars-per-page, but are overwhelming for anyone who just wants to get started and learn the basics.

To paraphrase Messrs. Twain and Pascal:
"I didn't have time to write a concise programming language tutorial, so I wrote this bloated monstrosity instead."
James Somers' article in The Atlantic, "How I Failed, Failed, and Finally Succeeded at Learning How to Code", describes the issues he had with these language tutorials:
For a while I thought I didn't have the right kind of brain for programming. Maybe I needed to be better at math. Maybe I needed to be smarter.

But it turns out that the people trying to teach me were just doing a bad job. Those books that dragged me through a series of structured principles were just bad books. I should have ignored them. I should have just played.
And then continues with an indictment of the AP's CS curriculum:
Nobody misses that fact more egregiously than the American College Board, the folks responsible for setting the AP Computer Science high school curriculum. The AP curriculum ought to be a model for how to teach people to program. Instead it's an example of how something intrinsically amusing can be made into a lifeless slog.
He also makes reference to Paul Lockhart's A Mathematician's Lament (which comments on how uninspiring most math instruction has become) and draws comparisons between math and CS instruction.

Somers persevered with his attempts at programming and found inspiration in the programming website Project Euler, but it's easy to imagine that many of these motivated students simply give up, thinking that programming is too hard for them.

22 May 2011

Minibloq ≈ Visual Programming + Arduino

Minibloq is a Kickstarter project to create a freely-available visual programming environment for the Arduino - something like Scratch for Arduino programming.


The good news is that they've already reached their funding goal so they can go ahead with this project. I'm looking forward to playing with this later this year.

13 April 2011

Arduinos in Museums


Over the past few years, museums have switched from expensive general-purpose computers to cheap (~$30) Arduino microcontrollers to run the exhibits:
 “Hackers and geeks have been doing this for years, building all sorts of cool robots and interactive experiences, but now it’s become so simple and inexpensive that artists and designers have adopted it, too.”
...and students.
“The two most important introductions for art in the past 20 years have been the Arduino and Processing,” explained Paola Antonelli, senior curator in the Department of Architecture and Design at the Museum of Modern Art.
Sounds like an endorsement of Processing for Intro to CS classes.

03 April 2011

How to publish your teaching materials

During this past SIGCSE, I was involved in a couple of discussions about how one finds CS teaching materials on the web. At one point, the conversation turned to how one goes about publishing these materials.

The background for this discussion was base-sixteen.org - a website that I'm working on to catalog (and organize, somewhat) the CS teaching resources that are available on the internet. The question was whether or not this should be a "catalog" (with links to resources that were hosted elsewhere) or a "repository" (which hosts the material on the same site).

There are pros and cons to each approach:

  • Because a repository keeps a local copy, the resource will still be available even if the original site goes away. However, this local copy will be out-of-date if the original site is updated (unless the repository is updated as well).
  • A catalog has the opposite problem. It will always point to the most recent version, but if the site goes away then the resource will no longer be available (unless it was cached elsewhere).

There are other issues as well, such as whether or not a repository has the legal right to host some material, but the main concern in this discussion was for dealing with materials that are here-today, gone-tomorrow.

This is a particular problem for things like syllabuses and lesson plans because these materials are often hosted on a university (or college, or high school) website which is managed by someone other than the instructor creating the materials.  When the new school year rolls along, the webmaster might decide to clean out all the old "outdated" files. Even if the teacher is in control of their part of the website, when they move on or switch schools the materials will go away with the person (hopefully to reappear somewhere else, but the link is still dead).

There are a number of different approaches for dealing with this, but I was interested primarily in the "webmaster deleted my files" problem because this is something that can usually be avoided by simply publishing the documents on the web yourself.

Of course, creating a website to host a few documents is way too much money and work, but there are far easier (and free!) ways to be in control of your published documents. Companies like DropBox and SpiderOak allow you to host and share documents in the cloud, or you could publish directly from web-document editors like Google Docs.

I created a small document that summarizes some of the ways you can publish your documents on the web:

https://docs.google.com/document/pub?id=1QRBBrU9ac8A0SSkhx0HKTtvj21Ja-ynMetY2rj_0hcQ
(Isn't that a great URL? Well, that's one of the downsides of having someone else host your material ^_^)

It's published as a Google Doc (rather than in this blog post) so that I can edit and update it as I discover new services. If you have a preferred way of publishing that I don't mention, please let me know so that I can update the document.

01 April 2011

"Thankfully, for most people, that's a pretty low bar."

In my opinion, one of the best April Fool's Day pranks this year was Think Geek's PLAYMOBIL™ Apple Store Playset. I don't what it says about me that I would probably buy one if it was actually an item for sale.

But the reason why I'm posting this here is because they also made a fake Apple announcement video for this product.  It's 2min 22sec long, but the money quote in this video comes around 1:29:
"Frankly, if something exceeds your ability to understand how it works, it sort of becomes magical. Thankfully, for most people, that's a pretty low bar."
Matthew Chwat — Graphic Design Specialist
Now, this is funny in the video because they're being over-the-top elitist, but the quote also has a "It's funny because it's true" quality to it.

In particular, it reminded me of Arthur C. Clarke's 3rd law, something that I often quote when discussing how woefully inadequate our education system is at teaching students about the basics of how technology works:
"Any sufficiently advanced technology is indistinguishable from magic."
Beyond simply teaching students how to program, we also need to be showing them how computers work at a basic level. I do this in my class by showing them how transistors work, how logic gates can be combined to add numbers, and I also have the students program and build simple electronics projects, often with a microcontroller like an Arduino.

I don't expect these students to become computer engineers, but I do want them to have a general understanding of what's going on inside the "magical" boxes that surround them. This is no different that what we do for other disciplines like Chemistry — we teach the Bohr model of the atom and the periodic table of the elements even though only a very small percentage of students will actually become chemists and need to know this information. We do this because we feel it's good for students to have a basic understanding of the world around us, even if they don't go on and pursue the subject in more depth.

Well, the same reasoning applies to computer technology as well. Especially as we're seeing more and more of it in our lives.

18 March 2011

Using CCG cards to teach computer science

I published a new activity for teaching computer science searching/sorting concepts. It's designed for middle school students, although there's no reason why it wouldn't work for upper elementary or high school students.

Using CCG cards to teach searching/sorting

It introduces algorithms for searching and sorting by using Collectible Card Game (CCG) cards – like Magic the Gathering or Pokemon cards – as objects for the students to search/sort.

An advantage of using these cards is that they are easy to hold and don't take a lot of room, so each student can easily manage 10 cards on a standard school desk. And the activity scales to more or less cards, or students can work in groups if needed. The cards are also cheap (or free) if you're willing to look around, but you can always just go to the store and buy some (convenient if you're traveling and left your teaching props at home).

I've run this activity in a number of classes in different schools and it's a great way to demonstrate how these algorithms work.

Google engineers visit local schools to promote CS

Official Google Blog: National Engineers Week 2011: Classroom visits inspire students to pursue CS

National Engineers Week outreach - Having engineers visit local schools

Recent K-12 outreach where Google engineers go out and visit local schools and talk about computer science:

http://googleblog.blogspot.com/2011/03/national-engineers-week-2011-classroom.html

Yes, that's my byline on the blog post. It was a lot of fun doing these visits (although it required a lot of prep-work in advance to get things set up).

17 February 2011

CS education is important for scientists

Philip Wadler's recent blog post "Scientific programming does not compute" draws attention to a Nature article from last October : "...Error ...why scientific programming does not compute" (Nature 467, pp.775-777 - 14 October 2010)

This article has some wonderful examples of why CS education is important to students interested in pursuing a career in the sciences.
Researchers are spending more and more time writing computer software to model biological structures, simulate the early evolution of the Universe and analyze past climate data, among other topics.
and
As a general rule, researchers do not test or document their programs rigorously, and they rarely release their codes, making it almost impossible to reproduce and verify published results generated by scientific software, say computer scientists.
Although I imagine that computer scientists probably said that they rarely release their "code". Why is it so difficult for writers (and Hollywood) to understand that computer programming "code" is a mass noun (like "water"), and not a count noun (like "pumpkin"). I can only guess that people are confused by things like "secret codes" and think computer code is the same. Anyway, I digress...

So continuing with choice quotes from the article, a Toronto-based computer scientists named Greg Wilson conducted an online survey about the programming habits of scientists back in 2008. He received nearly 2000 responses and reported the following results:
45% said scientists spend more time today developing software than five years ago.
38% of scientists spend at least one fifth of their time developing software.
Only 47% of scientists have a good understanding of software testing. 
Only 34% of scientists think that formal training in developing software is important..
Wilson also added:
"There are terrifying statistics showing that almost all of what scientists know about coding is self-taught," says Wilson. "They just don't know how bad they are."
Why does this matter? Well,. this lack of proper programming skills can lead to data being misinterpreted and incorrect results being published:
As a result, codes [grrr...] may be riddled with tiny errors that do not cause the program to break down, but may drastically change the scientific results that it spits out.
The article then provides a number of interesting real-world examples:

  • A structural biology group at a research center needed to retract 5 previously published papers when they found a bug in the program that analyzed their data.
  • A computational biologist wrote some code based on assumptions that were valid for his work, but another group re-used his code in a different scenario where these assumptions did not hold true.
  • The code used to analyze data from the Large Hadron Collider is so complex and convoluted that it is difficult for new researchers to come in and test or modify the code

What does the article suggest we do about this problem?
In the long tern, though, [software developer Nick] Barnes says that there needs to be a change in the way that science students are trained.
and
Science administrators also need to value programming skills more highly, says David Gavaghan, a computational biologist at the University of Oxford, UK.
In some sense, the article is calling for better software engineering skills (including documenting and testing) rather than raw programming skills. But the programming fundamentals need to come first for everyone.

The crisis in K-12 computer science education is really a crisis for all the sciences.

31 January 2011

Comments for K-12 STEM education


Today is the deadline for submitting comments to the NITRD request for information on strategies for meeting the goals set out in the recent PCAST report: "Designing a Digital Future: Federally Funded Research and Development in Networking and Information Technology" (Dec 2010).

The first 2 comment sections relate to particular industries (health case, energy, transportation, ...) or R&D, but the third section asks specifically about strategies for incorporating computer science into K-12 STEM education.

The rest of this post contains the comments that I submitted:


3. The PCAST report calls for fundamental changes in K-12 STEM education in the United States, including the incorporation of computer science (CS) as an essential component.


a. What CS concepts are important to effective elementary, secondary, and post-secondary curricula? Among these concepts, which are commonly found in curricula today? Which are missing?


Elementary: (3rd-5th)

Currently, elementary schools are likely to cover "logic grid" puzzles and syllogisms, but not much more. Ideally, they should include at least the following:

  • Number systems (specifically binary, octal and hexadecimal since these are the ones that matter for computer science)
  • Boolean logic (and, or, xor, not): boolean variables and expressions
  • Introduce the concept of simple variables (integer) here and relate to boolean values (x = 3 is either true or false)

Including a variety of different logic puzzles (Sudoku and similar) would also be beneficial.

In addition, elementary school should also cover the skills necessary to use a computer effectively and perform common tasks (word processing, web search, ...). This is necessary so that they are comfortable using computers when we introduce programming in later grades.

Middle School: (6th-8th)

In these grades, students should focus on understanding how computers work and learning how to write a basic program.

As part of "understanding how computers work", we need to demystify the operation of the computer. This is important because learning how to program doesn't give a complete picture of how computers operate. This section should include the following:

  • Basic file formats (show how text, graphics, music and video are stored on a computer; explain difference between bitmap and vector graphics, and text vs. rich-text formats)
  • How color is encoded (RGB encoding, compare with primary colors they were taught in elementary school)
  • How computers work (basic description of how computers perform logic and math operations) 
  • Basic boolean algebra (DeMorgan's law, re-writing expressions)
  • Simple electronics (hardwire or programmatically control an LED)
  • Internet: What happens when a website is visited? How does the internet route traffic? 

For "how to write a basic program":

  • Programming constructs: variables, control flow, functions, objects, ... (exact set varies depending on languages chosen)
  • Write simple programs (see below)
  • Explore and contrast various general-purpose vs. special-purpose languages
  • Using wildcards and regular expressions (in a programming language and in a shell/cmd prompt)

When having the student write simple programs, it is important that the core assignments are interesting and engaging. The best way to accomplish this is by having the project require significant creative input from the student. For example, creative writing for a text adventure or drawings for a 2D game. This approach gets the student to invest in the success of the project (since it's their story or artwork), so they are more motivated to learn how to make their characters work they way they want.

Note that rather than arguing about which programming language to teach, we should focus on introducing students to a number of different languages (at least 2 or 3). This is useful because each language has different strengths and weaknesses, and we don't want students to graduate thinking there is only one way to program. Frankly, I would expect the languages chosen to vary somewhat between school systems and the change over time.

In addition, in these grades it is also important to start teaching students about electronic privacy, security and information sharing. It makes sense to teach these subjects in the context of computer science and to give the students programming assignments that (directly or indirectly) explore these topics.

The goal should be for all 8th graders to graduate knowing that they (1) are capable of writing (simple) computer programs, and (2) have a basic understanding of how computers work.

High School: (9th-12th)

High school should introduce advanced programming topics (algorithms and data structures) just like high schools offer advanced chemistry and physics classes. Beyond 9th or 10th grade, these classes don't have to be required for all students, but they should be required for students interested in a science and technology track.

Overall

Overall, we should try to link CS projects to other subjects whenever it makes sense: We can motivate learning about trigonometry by showing how it is used in games to calculate distance and to detect (bounding sphere) collisions. We can talk about the math/physics behind gravity and acceleration when we want to have a character jump realistically on the screen. We can demonstrate the additive color properties of light and discuss prisms and rainbows when we introduce RGB color.

Once we have CS as a core subject, these links will be easier to make and will lead to a much richer learning environment for the students.


b. What do teachers need (including preparation and training, tools, and resources) to be able to deliver CS education effectively?

Training and ready-to-use classroom materials are key for all grade levels. Any materials that are created need to be supplemented with instructions showing how to use it properly in the classroom. Two types of instructors should be targetted here: teachers who know how to manage a class but are not very familiar with programming, and teachers who know how to program but are not familiar with teaching strategies and classroom management. These two groups are likely to make up the bulk of teachers during the first years when we introduce CS to the classroom.

There will also need to be programs offered for teachers to learn how to teach this material. Fortunately, most (if not all) school systems require regular teacher training for "clock hours". This is the perfect venue for reaching the teachers and bringing them up to speed with the material.

c. What factors are important in promoting student interest in CS?

I discussed some factors in the earlier sections, but the most important factor is simply that computer science needs to be included as part of the core K-12 curriculum.

An example which underscores the importance of this happened recently to a friend of mine. His daughter (age 12) had already taken a programming class or two and she was interested in participating in an after-school robotics class. However, even though she was interested, she decided not to sign up because none of her friends were planning to take the class and she didn't want to be "alone". Whenever I think about this, I wonder how many other students are missing out because of (even minimal) social pressures, and how many of her friends would have discovered that this was a subject that was interesting to them, if only they had been forced to try.

And remember, this was for someone lucky enough to have encouraging parents and teachers willing to organize this after-school class. Most students don't have those advantages.

I'm tempted to say that adding CS to the core is the only important factor and that it (almost) doesn't matter what we teach or how we teach it. Once we make CS a core requirement, everything else will (by necessity) follow. Of course, it's clearly better to teach it properly, but as long as we're willing to iterate and improve, even a less-than-perfect rollout will be of great benefit to the students.