May 01, 2016

Whose Country?

When Trump said today "we can't allow China to rape our country," it reminds me of my conversations with folks on an airplane to Tennessee a few weeks ago, which is deep Trump territory.

No matter how often I reminded my airplane seatmates that I grew up in New York, I am an American citizen, I work for an American company, I went to school in America, I do not speak Chinese, that my family has been in America for more than 100 years, that my ancestors served in the U.S. army, that I do not like China or the way their government is run, it did not matter.

I look Chinese. So the Trump supporters kept referring to China as "your country," telling me how terrible "your country" was (meaning China) and telling me what they thought of "your people" and "your leaders". Watch the pronouns "us" and "them" when you chat with a Trump supporter: they can't help it. It doesn't matter how American I am. I am "them." I am the bad guy.

The Trump supporters proudly reminded me they do not believe anything in "the media." They also did not believe anything I would say unless I happened to agree with them. That conversation was frightening in so many ways.

How to Mobilize a Mob

I hate how dishonest and corrupt the Chinese government is, and I hate the direction China is bringing the world: they have built an economy on exploitation, pollution, poor safety, and lack of ethics, and they have gotten the world to follow suit. But when Trump talks about China "raping" the U.S., he is not making the same economic argument I make when I criticize China. He is using racist code to mobilize the mob against the Chinaman. He is turning his supporters violently against me. Because of the way I look.

My father is a Massachusetts Republican and just returned from the GOP caucus where delegates get picked. He says the depth and strength of the feeling of support for Trump should not be underestimated. All these white guys think Trump is very interesting, that his language is just colorful. They think it will be great for him to "tell it like it is," and that it's "time for a change." They are incredibly defensive if you criticize Trump.

But they are wrong. Trump's game is not honesty and it is not change: his game is conflict.

First he went after Mexicans. Then the Muslims. Now he has started on the Chinese.

Who is Raping This Week?

If you are a wealthy white male BMW-driving Catholic highly-educated engineer living in the suburbs, you might not understand the problem. But make no mistake: Trump is not on your side. Trump only operates by turning people against each other, which means that eventually it will be your turn to be the minority.

There is something about you that the mob does not like. It might be your religion, your job title, your education, your weight, your bank account, your travels, your child's condition, or something your parents did. You won't anticipate it because your offense has nothing to do with who you really are. But Trump's skill is to find that reason that you are the "other." When he comes after you, it will be too late for you to speak up. The mob will already see you as the enemy, and nothing you say will matter. I experienced that in Tennessee.

This is how the Cultural Revolution played out. This is now Nazi Germany worked. We remember the Nazi's rounding up the Jews, but a mob under the spell of a despot will round up anybody they find disgusting: professors; landowners; church-goers; the infirm; the elderly; the Polish; the leaders; the unemployed; the writers; or the people who seem too sympathetic to all those disgusting people. Being white does not make you safe: it just means that you are not first.

Please do not support this monster.

Posted by David at 11:43 PM | Comments (1)

September 17, 2015

Starting at MIT

A couple decades ago I never finished a CS PhD at Cornell (really, I barely got off the starting block - I left with a masters soon after passing quals). So I've decided to go back to school. This September, I'm starting work on a CS PhD at MIT. It's been almost 20 years since I've taken any classes, and computer science has gone through several sea changes in the intervening years.

I am taking two classes at MIT this term: 6.858 and 6.869. That is, a systems security class, and a vision deep-learning class.

I've devoted the last few years of my life to the idea that it's important to teach people how to program and that the key is to learn how to program intentionally, to understand how to make things with software.

But the takeaway from security and deep learning so far seem to be (1) even if you do your best to make things intentionally, they can be defeated (we're learning a whole spectrum of security exploits); and (2) there are ways to build systems without detailed intention that outperform intentionally designed systems (deep learning is winning).

In this new world, how to people put together software on purpose? How are we supposed to improve, collaborate on, and evaluate what we're doing?

Anyway, it's very fun to go back to school. Lots of interesting stuff going on to learn.

Here is my academic homepage at MIT.

Posted by David at 03:50 PM | Comments (0)

September 06, 2015

When to Sell

I guess a good time to sell is when I start writing blog posts about the stock market, down about 8% since I posted.

I do think that the big problems haven't in China haven't hit yet, though: a pile of (difficult to discern) bad debt related to government influence over the banking system's investment in state-owned enterprises.

There is an overhang of bad investments in China which is on a scale which perhaps the world has never seen before. Entire ghost cities in plain view. When will the bad debt behind these projects unwind?

Posted by David at 01:00 PM | Comments (0)

August 12, 2015

One-Off Depreciation

On vacation in Greece, reading about the big economy that is even more screwed up than here: China. It is interesting to read about how the yuan depreciation is related to markets as far and wide as copper and corn.

Here is the most interesting reading for the day, a discussion of the Chinese copper carry trade written a couple months ago.

The copper carry-trade is a mechanism that western banks use extend loans to Chinese companies at high Chinese interest rates, while denominating the loans in dollars instead of yuan. It is a way of circumventing Chinese currency controls and make a pile of money for very little risk.

Did you know that China holds about 40% of the global copper stock in warehouses, due to this banking trick? That number doesn't include ongoing consumption, by the way. All this copper is held as collateral for financial transactions that circumvent Chinese currency controls, supplying foreign capital to Chinese business, making up about 31% of the short-term capital in China.

The carry trade has only been possible because the Chinese government has pegged the yuan to the dollar. Suddenly today the game has changed: a rapidly dropping yuan means the copper carry-trade is no longer a guaranteed money-winner.

From the carry-trader's point of view, the yuan drop looks like an attack.

"It is a lot of leverage and we may be just at the beginning of the unwind.... The PBOC can transfer the pressure offshore, they are saying you guys, foreign demons, have to foot the bill."

It is doubtful that China really has it in for London commodities traders, however. The real concern, from the point of view of China, appears to be a weak banking system plagued by nonperforming loans to government-run enterprises. From the other article:

... It actually gets directly to one the puzzles of Chinese monetary policy. That is, if Chinese banks are flush with cash as the PBOC claims and loan demand is low, why does the PBOC continue to release cash into the system via reserve rate cuts rather than cut interest rates when even the best SOE is facing real interest rates of approximately 10%? This would seem to have a much larger impact on the economy...

There appears to be a couple of reasons. First, China is still heavily dependent on capital inflows to finance its continued development.... The PBOC appears to be making the tradeoff of trying to continue to attract capital by keeping interest rate high even if that risks choking off businesses with absurdly high real interest rates...

Second, despite all public pronouncements to the contrary, this implies that banks are weaker than is believed... Given the PBOC and government mandate to buy up low yielding government bonds and continue lending to LGFV whether they are paying or have any prospect of paying, banks already appear weaker than public pronouncements. Slowing the capital inflow or giving reason for capital to flow out could really create problems for China's major banks.

So basically, China has been pumping cash from its huge foreign reserves to prop up the yuan and keep domestic interest rates high, to attract foreign capital and prop up its weak banks.

But Chinese investors have been using the opportunity to move money out of China. And rather than shoring up Chinese banks, the high interest rates enable the copper carry trade that siphons Chinese reserves into copper holdings by western banks. The declining foreign reserves in China are a measure of the drain of yuan-denominated capital from its economy, and the high cost of borrowed yuan is making it hard to do real business in China.

Now that China has let is currency drop, it seems to be giving up on private capital: no more copper carry trade, no more foreign capital, and no more holding the line against capital flight. The shift would seem to goose China's real economy at the expense of its bankers. But it is not clear if the strategy will work, because it will also rob China of its major source of capital. China is in a pickle because it doesn't have a very healthy internal banking system. It depends on the strength of foreign banks. We can now see if capital flight with a declining yuan "could really create problems for China's major banks," and if this is a situation that will cause real problems for the Chinese economy.

In the next couple days we will see how China responds to an estimated $1.1 trillion of US denominated carry-trade debt being sucked out of the country. How quickly will the capital take flight?

Yesterday, China promised that the 2% devaluation was a "one-off depreciation" only. But they lied, and they repeated it again today. How many times can China repeat its "one-off" currency devaluation before causing a bit of panic? One estimate is that the dollar peg has resulted in a 16% overvaluation in the yuan, and that China will have to depreciate more than that amount if it wants a cheap currency that will bring back the pricing advantage it saw a few years ago.

Posted by David at 08:38 AM | Comments (0)

July 29, 2015

Confidence Games

This month I have been re-balancing my retirement savings, but it is a sobering exercise.

If we have money to save, where do we put it today? Let us review the major asset classes.

You get the distinct feeling that the wealthy-powerful class in Asia, Europe, and North America have steered capital into their own pockets for so long now that there is a huge imbalance in the distribution of capital in the world.

  1. Every asset class globally is experiencing a bubble simultaneously.
  2. So much capital has been idled that real economic activity is being starved.

So... if we have money to save, it seems like this situation is of our own making. What the heck are we doing to ourselves?

Where would you invest today?

Posted by David at 06:32 AM | Comments (1)

October 17, 2014

Making a $400 Linux Laptop

At some point, every programmer should learn how to use the Unix command-line.

So I started teaching Piper a bit about how to use a command line shell this week. We installed crouton on her Chromebook, and we used it to look at a couple files and build little shell script. That continuing adventure is a story for another time.

But crouton was the surprise for me. I immediately fell in love it. The Linux-on-chromebook setup was so great that a few days later, I made another one. It's an amazing deal: for about $400, I got a lightweight linux box with 4GB RAM, 128G SSD mostly empty, 8 hours of battery, and a touchscreen! Here is what I bought:

The new C720P with 4GB ram, but the cheap configuration with a 16G SSD

MyDigitalSSD SC2 Super Cache 2 42mm SATA III 6G M.2 NGFF M2 SSD Solid State Drive (128GB)

It was a terrific little project, very easy. The basic idea is to follow the SSD upgrade instructions here

There are only a couple gotchas. One is at the start: you want to begin by burning a recovery image on a USB stick, which should just take a couple minutes. But the instructions above say to use the URL "chrome://imageburner" to make this, and it doesn't actually work on the c720p (it runs, but then it hangs). Instead, go to the Chrome App store and search for the Chromebook Recovery Utility. That will make a recovery image quickly.

Then you're ready to upgrade the disk! Piper and I unscrewed the laptop and followed the instructions here - it was a great chance for us to take a look at all the innards of the computer, and it was a very easy upgrade.

The only other gotcha is that he M2 SSD card doesn't go in either way: there is a "right" and a "left" - one side with four gold connectors and the other side with five. The big brand-name sticker on the new SSD we got was on the opposite side as the old one, which confused us; it just needed to be flipped upside-down, sticker down.

Then we reassembled and rebooted the computer, stuck in the recovery USB drive, and then followed this page's advice on how to enable developer mode. In short: ESC-F3 and Power. Then control-D, and then wait. Apparently converting the huge 128G SSD to developer mode, takes a little while; but there is an ASCII art progress bar at the top of the screen.

Finally, we downloaded crouton from, and then we used ctrl-alt-T to bring up a crosh tab; entered shell; then ran the crouton script to install a command-line-only debian.

It's terrifically functional - I used it to build a current build of node.js and some other things. It's not terribly secure, because anybody who can log into the machine can get root access. But for student work, it's great!

Posted by David at 08:27 PM | Comments (0)

October 03, 2014

Teaching About Data

How do you teach beginning programmers about data in the internet age?

  • Teach the kids how to learn on their own: for example, can you find and use technical data sources using Google? Self-teaching is a key hallmark of successful students.
  • Teach using real-world mainstream idioms: Javascript, jQuery, HTML5. This lets kids directly apply code examples from the web. We take advantage of Pencil Code to make this easy.
  • Keep things real: it is more meaningful if we use real data to answer real-world questions!

It is a real pleasure to see students learning to learn independently this way.

Last week I taught a class about data that went very well. It was interesting enough that maybe others might want to try to do the same.

Using Google to find a Technical Article

The class started with an acronym: JSON. A lot of data on the internet is made available using a technology called JSON, so we began by searching Google for code ideas by using the query [Using JSON to get public data]. That query lead us to a few articles, including a blog post by Mark Lee....

Continue reading "Teaching About Data"
Posted by David at 12:54 PM | Comments (0)

July 10, 2014

Code Gym

At the first Google I/O Youth program this year, we used a new open-source website, the Pencil Code Gym, and it was a smashing success!

The website is a place where beginners can create open-ended creative projects in graphics, music, or interactive fiction, all using a little bit of simple code.

It is based on Pencil Code, which means that you program in CoffeeScript with the Pencil Code editor and turtle library. It comes with lots of ideas, hints, and a nice on-line reference. The students who came through to use it had a wide range of backgrounds and knowledge, with many first-time coders and also a few experienced code-jockeys.

The kids were bold and tried every project we had to offer. I was surprised by the musical talent of some of the kids (check out the projects), and I particularly enjoyed working with the deaf kids who attended - some of the deaf kids even did musical projects.

You can see the projects put together by code gym students here, at the Code Gym Stage.

Posted by David at 05:18 PM | Comments (0)

May 23, 2014


Here is musical.js, which is a small (less than 17K minified) javascript library that can translate from ABC notation into WebAudio, for playing simple tunes on any modern browser. It has no dependencies, and it can be used as a plain script, an AMD module, or as a node.js module. It also includes a simple synthesizer for creating your own instrument, including a basic electric piano sound.

The library is really simple to use. Basically, include the script musical.js, and then:

piano = new Instrument('piano');'ccggaag2');

Then with any WebAudio browser, you will be Baahing with the Black Sheep, Twinkling with the Stars, or singing your ABCs with me. The notation used is called ABC Notation, and it is used for a lot of simple sheet music online.

Less-simple music can be played just as easily. Here are some short examples: Minuet, September, Sonata and Moonlight.

The library comes out of work from beefing up music support in Pencil Code. The WebAudio sequencer in that library has improved enough that it deserves to be a separate library.

You can also play with it as part of the turtle library on pencil code here: that example is a simple interactive piano keyboard where you can see the keys.

Have fun. Let me know if you encounter any problems, or if you have any ideas for improvements. Always looking for open-source contributions.

Posted by David at 03:39 PM | Comments (1)

January 31, 2014

Pencil Code at Worcester Technical High School

I spent a day last week at Worcester Technical High School with all their CS students, using Pencil Code as a teaching tool.

Vocational students are motivated by real-world applications, and the teachers at WTHS are amazing. They bring their entire group of students through four years of rigorous CS classes, ending with AP computer science in their Senior year. "There is a difference," the teachers explain, "between offering CS exposure and teaching mastery. We teach mastery."

For this group of CS-focused students who have been learning Java, ASP.NET, and HTML, Pencil Code is a terrific tool. The instant feedback lets them apply and experiment with difficult concepts quickly. And because it is so open, Pencil Code is lets them assemble concepts from varied areas.

Here are the worksheets we used in Worcester:

Combining Three Languages using HTML
Exploring Recursion with Fractals
Using Subclasses to make Moving Sprites

In all three of these lessons, the turtle is a starting point, but it is just a stepping stone into real-world applications and deeper concepts.

The day was terrific. We found that we taught some unexpected lessons. The teachers pointed out that the indent-based syntax of CoffeeScript (and the instant-error checking in the IDE) connected with several kids for the first time who now could really "get" how scoping works. Some kids never indent their blocks, but with CoffeeScript, they have to! And surprise - once it is indented, they can see clearly how it works.

After the day, the AP students in the group suggested "We should start with Pencil Code!"

I am holding hackathons to build more lessons and materials that take advantage of the Pencil Code environment, and to improve the tool itself based on what we are seeing in classrooms. The first hackathon is on February 14 - sign up at

Posted by David at 08:56 AM | Comments (0)

January 19, 2014

A Bad Chrome Bug

The latest version of Chrome has a bad bug that seems specific to the GPU in my (Samsung series 9) laptop. It actually took me a couple days to notice the problem and realize it was Chrome's fault and not the fault of the underlying website.

Here is the bug: when you visit a fast website that has no images (and no javascript-rendered changing content), Chrome does not render anything. It just leaves the page blank. It will render as soon as you scroll or cause something to redraw.

My laptop does not have an exotic configuration - it is a 2012-era windows laptop with a very vanilla Windows 7 setup, so I suspect many people may be affected by the bug.

The funny thing, the bug is something you may not have noticed because almost every webpage we might visit day-to-day contains an image. And pages that do not have images - well, as soon as you scroll, they render, so you might have thought that the webpage was slow and then popped in when you scrolled.

If you use Chrome, try it out on your computer. Does it happen to you? To test, here are a couple links to webpages that have no images. If they render for you, try pressing "refresh" to see if they render once they're cached and fast:

If you see the problem, put in information about your hardware, and vote for the bug to be fixed here:

(Update: found an old issue that appears to have reported the same problem in beta -

Posted by David at 10:58 AM | Comments (1)

January 09, 2014

PhantomJS and Node.JS

I'm setting up a guide for contributing to PencilCode.

There are now integration tests. In about 20 seconds, the "grunt test" command starts a local development server, starts a headless webkit, and tests most of the core functionality on the website, including browsing users and directories, loading, editing, running, saving, and deleting programs, and using passwords to log in. You get this all for free by just installing node.js and the grunt build tool, and building the source.

The integration tests look like this: edit_code.js - they are low-level but surprisingly clean and quick. The tests are designed to be run by mocha (a command-line javascript test runner), and they depend on node-phantom-simple, which is the lightest-weight headless webkit I could drive from a node.js build environment. The Gruntfile sets up everything. One of the curious things is that the development server actually runs as a proxy server. This allows it to intercept test-browser requests to full DNS names even though it doesn't own the DNS name.

Why Tests are Awesome

The test setup is designed to maximize developer productivity: the default test target runs tests very similar to production, with all the code compiled and minified, but the "devtest" target runs the same tests directly against unminified unoptimized source code, for easier debugging.

The beauty of a good integration test is that the code can now be aggressively changed without fear that the change will break something important. If some change breaks something, we can know in 20 seconds.

Right now my integration tests run quickly, because my test matrix is small. As the test matrix grows larger, many open source projects use jquery-turtle as well; then it will be time to refactor the code so some interesting features can be added.

Posted by David at 07:29 PM | Comments (1)

January 03, 2014

Integration Testing in Node.js

What's the best way to run integration tests on an AJAX-heavy website?

I have been toughening up the deployment environment. (git repos here.) While the pencilcode server is an nginx webserver backed by a small python-uwsgi app server, the pencilcode development environment is 100% javascript, with a node.js and npm and grunt-based build, and a small express.js test server that proxies backend calls to the production server.

If you think that's just a lot of hipster coder buzwords, wait... there's more.

This morning I broke due to a code change: while refactoring the editor source code to use proper require.js organization, I messed up by bringing in an old version of seedrandom that wasn't compatible with AMD loading. Seedrandom is my own library, and so it was doubly my own fault! The result was that all password checking was broken on the site for a few hours. The bug took about 10 minutes to fix: I just had to use bowercopy to upgrade seedrandom to its latest bower package, then run the requirejs optimizer, then redeploy.

But the real bug? I don't have any integration tests on I should have never pushed broken passwords in the first place. While I have some little unit tests, I really need end-to-end integration tests that bring up the whole website, browse it with a headless browser, and click around authenticating and editing and running and saving, to make sure it all works as expected.

The 2010 way of doing this used to be a big system like Selenium. But it feels like in 2013 I should be able to do this in lighter-weight way. I have seen that grunt-phantomjs works pretty well with QUnit unit tests. But almost all the javascript-based tools I've seen are designed for tiny unit tests.

How do I run tests that exercise the whole system end-to-end? Maybe something like travist's jquery.go.js? Has anybody found the right way to do integration tests in the node.js world?

Posted by David at 06:52 PM | Comments (0)

December 20, 2013

Second Edition of Pencil Code

The best parenting advice: before your children grow up, teach them something. They will remember it forever.

So in that spirit, here is an activity to do with your daughter or son over the holidays: give and play with the second edition of Pencil Code (just released). Teach them how to write little computer programs.

The new edition adds a 20 page appendix with a CoffeeScript tutorial, which is particularly helpful if Mom and Dad do not create software for a living. If you already got the first edition and you wish you had the tutorial, do not worry - get the tutorial on the web here and print it.

While you are playing with Pencil Code, also be sure to look at the extra free materials on - there are handy printable protractors, reference sheets, activities, and videos. And almost all the material in the book is available online for free. If you do not want to use paper, you can just go to and play for free.

Still, the book makes a terrific present. Children show their incredible sense of wonder when leafing through a little handbook of examples of magical code, each one illustrated in color. Each page is a map to a little adventure, a puzzle and a discovery waiting to unfold.

The book has more than 100 little programming projects, and they range in depth and ability from 1st grade up to 12th grade. The first page hows how to make a webpage that draws a simple line. The last one shows how to make an artificial intelligence that will beat you at tic-tac-toe. In between, draw a flower, make a game of tag, or draw the Mandelbrot set.

It is a little book crammed with ideas, designed to last for a decade. As long as it is in your house, it is a reminder: there is something much cooler than playing computer games: making your own.

(Also, while you're getting the book - Amazon didn't bring the reviews of the first edition along to the second edition, so leave a nice review!)

Posted by David at 12:22 PM | Comments (0)

December 18, 2013

Learning to Program with CoffeeScript

Is CoffeeScript a good first programming language to learn?


I have written a new tutorial for beginners to learn to program with CoffeeScript.

Like Python, CoffeeScript has a punctuation-light syntax that is easy to type so that beginners can get straight to the essential concepts instead of fiddling with semicolons and matching curly braces. And yet it is a real language used by pros, so you can learn the essential concepts that you will see in other languages: variables, algebraic expressions, control flow, functions, lists, objects, classes, closures, exceptions, and (if you use Iced) even continuations.

The big advantage of learning CoffeeScript over Python is that you can start right now in your browser, without installing anything! Although CoffeeScript doesn't have the same full-featured standard library that Python has, jQuery makes a fine standard library. To help beginners, I have put together jQuery, a turtle graphics plugin jQuery-turtle, and a syntax coloring editor on

The tutorial teaches you how to program in CoffeeScript by building a game of hangman from scratch. It takes a couple hours to learn enough programming to make hangman. You will learn about:

  • Memory and naming
  • Computer arithmetic
  • Using functions
  • Simple graphics
  • How to make a program
  • Input and output
  • Loops and choices
  • Delays and synchronization
  • Connecting to the internet

At the end we will have a game we can play.

Here is the tutorial: Learning to Program with CoffeeScript.

Posted by David at 10:30 AM | Comments (0)

December 16, 2013

Teaching Math Through Pencil Code

How young is too young to teach programming?

I have been using Pencil Code with children from 1st grade to 12th grade over the last few weeks. All ages have a lot in common: they all need to learn the same programming concepts at the beginning. Even before learning control flow, they need to understand sequencing, debugging, and how to think about the state of the computer. However, there is one big difference between younger kids and older kids: the younger kids have not yet learned a lot of math fundamentals.

Using Programming to Reinforce Math Curriculum

When a fourth grader asks "what is the command to make the turtle go that way?" it is really a math question. The idea of estimating degrees for a turn seems perfectly concrete to an older student, but if you are a 4th grader, measurement of angles is a new idea that is hard to grasp. The fourth grader wrestling with the turtle's direction is really asking, "how do I measure the angle that I want?"

The problem of getting the turtle to turn the right way is a valuable math teaching moment. Do not give away the answer. Instead, give the student a protractor, and the student will align it with the turtle on the screen and pick out the angle they want.

Pointing the turtle requires an extra level of care beyond math class, because the student will need to note not only the degrees, but also whether they want a "right turn" or "left turn." But once the proper angle is found and the student has entered "rt 60," they they are rewarded with a working program as well as an insight: angle measurements are pretty useful!

When teaching classrooms of fourth graders, I have been using handouts with paper "turtle protractors" that illustrate the turtle in the middle of a compass rose. The printable measurement sheet also includes a "turtle number line" so that younger kids can do the same exercise with linear measurements. These paper supplements are invaluable.

Programming Motivates a Range of Math Curriculum

Computers speak the language of math, so learning to program your computer is a good reason to learn a bit of math.

Math topics that tie directly in with Pencil Code include:

Programming is a good way to learn about to the importance of precision in measurements and the use of numbers to quantify many things. Normally this is hard-won knowledge, gained through years of teachers marking mistakes on math homework. But in programming, the purpose of math is not to get a good score on a test. The purpose of the math is to get your program to work. It is a self-teaching lesson.

Programming Motivates Advanced Concepts

Programming draws kids in to playing with concepts that would normally be considered too abstract and dry for math class.

For example, kids particularly love creating programs that draw circles and curves. However, since arc measurements are (sadly) considered an advanced High School concept, they will not have been covered before most beginning programmers try Pencil Code.

With Pencil Code we have been introducing arcs using an arc-measurement sheet that is similar to the protractor sheet. Kids can hold it up to the screen it to visualize (for example) the fact that the bottom of a "U" is 180 degrees of an arc of a circle. Fourth graders enjoy measuring arcs as part of their programs: arcs make it possible to create beautiful flowers and sports cars and inscriptions.

Perhaps when these Pencil Code fourth graders arrive in high school geometry class years from now, arc measurements will be less of a mystery and more of a "cool" topic.

Posted by David at 03:37 PM | Comments (0)

December 09, 2013

Hour of Code at Lincoln

Lincoln classrooms participating in the Hour of Code 2013.

Today I spent the day at Lincoln public school, helping grade school classes participating in the Hour of Code. We were hosted by teachers Cindy Matthes and Terry Green, who both have a long history of championing technology education for young kids. Terry literally wrote the book on teaching engineering to K-2 kids.

Here are some of the fourth-grade creations - as you can see, at this level, coding is mostly about learning about quantities and careful sequencing.

Several of the fourth grade girls were the natural leaders their Hour of Code classes: they had a ton of ideas of what they wanted to draw. They wanted to know how to get the colors they wanted, how to draw curves, how to draw text, and how to make the turtle wear a different colored shell. There were very few preconceptions about what they could or could not do with a computer at that age, and they were persistent in getting things to work.

The middle-school group was self-selected (and, in an odd contrast with the experience in the fourth grade group, they were mostly boys). They were able to speed through Lesson 1 at in 30 minutes, and we did a bit of Lesson 2 as well. In middle school, there is a pretty broad spectrum of styles - some kids wanted to try small experiments of their own invention, and other kids wanted to type in a complicated ambitious program from the book to see if they could get it to work. The book of 100 example projects was a useful tool for this older group. Continue reading "Hour of Code at Lincoln"

Posted by David at 05:32 PM | Comments (0)

December 08, 2013

Hour of Code at AMSA

Families participating in the AMSA Hour of Code 2013.

Yesterday I participated in a wonderful Hour of Code event at AMSA. The AMSA and Marlboro teachers there are absolutely amazing, dynamic teachers. I brought some new Pencil Code materials and books to use. Within 15 minutes they had things copied and stapled together; they had reviewed the new materials; and they were ready to roll.

Here are the materials we used yesterday.

Attendance was terrific, overflowing the reserved classroom. So they opened up a second classroom and divided kids by level. The higher level kids went through "Lesson 3", which covers topics such as variables, control flow, arrays, randomness, synchronization, and network requests.

The beginner kids started with "Lesson 1", which gets you going with basic sequencing and turtle drawing. At the 30 minute point, they were doing well, so I showed them the video for "Lesson 2", which is a nudge to get you to be thoughtful and creative. Lesson 2 also demonstrates arcs, which are a great tool for students to use to make beautiful things.

A few creations from the rank beginner kids - a lot of understanding in just one hour!

Posted by David at 11:35 PM | Comments (0)

May 2016
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

Recent Entries
Whose Country?
Starting at MIT
When to Sell
One-Off Depreciation
Confidence Games
Making a $400 Linux Laptop
Teaching About Data
Code Gym
Pencil Code at Worcester Technical High School
A Bad Chrome Bug
PhantomJS and Node.JS
Integration Testing in Node.js
Second Edition of Pencil Code
Learning to Program with CoffeeScript
Teaching Math Through Pencil Code
Hour of Code at Lincoln
Hour of Code at AMSA
A New Book and a Thanksgiving Wish
Pencil Code: Lesson on Angles
Pencil Code: Lesson on Lines
Pencil Code: a First Look
CoffeeScript Syntax for Kids
CSS Color Names
For Versus Repeat
Book Sample Page
Teaching Programming and Defending the Middle Class
TurtleBits at Beaver Country Day
Book Writing Progress
Lessons from Kids
Await and Defer
Ticks, Animation, and Queueing in TurtleBits
Using the TurtleBits Editor
Starting with Turtlebits
Turtle Bits
No Threshold, No Limit
Local Variable Debugging with see.js
Mapping the Earth with Complex Numbers
Conformal Map Viewer
Jobs in 1983
The Problem With China
Omega Improved
Made In America Again
Avoiding Selectors for Beginners
Turtle Graphics Fern with jQuery
Learning To Program with jQuery
Python Templating with @stringfunction
Party like it's 1789
Using with jsonlib
Simple Cross-Domain Javascript HTTP with
Dabbler Under Version Control
Snowpocalypse Hits Boston
Heidi's Sudoku Hintpad
Social Responsibility in Tech
The First Permanent Language
A New Framework For Finance
Box2D Web
Lincoln School Construction
Stuck Pixel Utility
Fixing the Deficit
Cancelled Discover Card
Tic Toe Tac
Toe Tac Tic
Tutorial: Root Finder
Wiki Javascript at
What SAT Stands For
Computer Club
Tutorial: Cannon Game
Tutorial: Pascal's Triangle
Tutorial: Custom Poem
Tutorial: Concentration
Tutorial: Histogram
Tutorial: Maze Maker
Tutorial: Tic Tac Toe
Tutorial: Mastermind
Tutorial: Polygon Drawing
Tutorial: Caesar Cipher
Tutorial: Guess My Number
Tutorial: Ten Followers
Tutorial: Fifteen Puzzle
Handheld Glasses-Free 3D
Making a Time Machine
The Next Grand Deception
There is Brilliance in this Language
Minimum Hint Sudoku Hunt
Collected Hacks
Python Spigot
The Mystery of 355/113
It's Not About The Answer
Solid Geometry
Teaching is Hard
A Mathematical Notation Question
Second Coming of Wyden-Bennett?
Reading JQuery Sources
Random Seeds, Coded Hints, and Quintillions
Xinhua: We Report, You Decide
My God, What Have We Done?
Older Writing