Archive for the ‘Uncategorized’ Category

A Word on Programming Education and SpaceChem

Tuesday, March 6th, 2012

I have a lot to say about the game SpaceChem, and have lately been organizing thoughts and educational materials surrounding it. But because the question of “how to teach programming to the kids of today” came up on Slashdot, I posted a comment there about it.

But I’m not interested in having a Slashdot account for all the usual reasons people don’t jump into that fray. That makes me an “Anonymous Coward” in their lingo, so my comment starts out with a score of 0 where it won’t be shown to people. I’ll cache it here so that the whims of moderation on an aggregator site that’s yesterday’s news (both literally and figuratively) won’t censor my thoughts. :)

The question I was responding to was this:

I have been wondering lately if there are any kids interested in programming for its own sake anymore. When I was my nephew’s age, computers were still fascinating: There wasn’t a laptop on every table, facebook wasn’t splattered on every screen, and you couldn’t get any question answered in just a couple seconds with Google. When I was 10, I would have done anything for a close programming mentor instead of the 5-foot high stack of books that I had to read cover-to-cover on my own. So I was happy when my nephew started asking about learning to do what “Uncle Jay does.” Does the responsibility now shift to us to kindle early fires in computer science, or is programming now just another profession for the educational system to manage?

Here’s my response:

There is no turning back the clock. You can’t bring up a blinking terminal with [10 PRINT “HELLO WORLD”] [20 GOTO 10] and expect the average kid to feel motivated. Also, you will not learn much…all the while being frustrated by their reactions.

But I have a suggestion. First sit down with him and the two of you can watch “The Karate Kid” (the original one) all the way through. Afterward go back and review the entire “Wax on, wax off” / “Paint the fence” / “Sand the floor” scene, and what Mr. Miyagi says about “Karate Do” vs. “Karate Don’t”. Make sure he groks that getting your fundamentals right can have profound effects on reaching your goals, even if they *seem* unrelated. Remind yourself of that fact as well.

Then open up your wallet and spend ten measly bucks to buy SpaceChem, which the creator of Team Fortress has called “Pretty much the greatest game ever made”. I’ve known for a long time that such things would be *possible* to create, but hadn’t seen it done in a way that satisfied me…until now. I’m hopeful it is a prelude to many more such teaching tools:

(Note: Some real non-tutorial gameplay illustrates some of the amazing machinery you make in this game…

…it’s not much of a spoiler as there’s lots to see in the many levels. Though if you spend too much time watching YouTube videos you will take away from the experience of playing!)

There have long been games that gave the appearance of indoctrinating one with “programming”, merely because they gave you automatons that act independently to solve problems (such as “The Incredible Machine” or even pared-down systems like Logo). But SpaceChem blows them away. It has the requirement to build “stable reactors” and pipeline them to build something that works…but must do so iteratively…it is self-testing. Your solutions might turn out to be complex or inefficient, but the production quotas keep raising the bar to keep you from being sloppy. Plus the leaderboard for “elapsed cycles” and “symbols used” creates an incentive to go back and hone the craft.

I cannot say enough good things about this game and the direction it’s pointing. Your nephew won’t be the only one enjoying it, either.

I’m hoping to have a lot more to say about SpaceChem in the future. But for now I just want to tell people to give this game a fair shot. It’s not 100% user-interface polished at this point, there are some rough edges…but for me it’s been very inspiring.

Virtual Machines and the *Very* Genuine Windows Dis- Advantage

Friday, June 17th, 2011

Over the years I have come a long way toward a close philosophical alignment with the Free Software movement. Yet I’ll shamefully admit that my two computers are an iMac running OS/X and a Acer running Windows 7. Of course, nearly all of my projects are undertaken in Linux virtual machines which I fire up in the host environment. I just didn’t want to cope with issues of finding drivers for the proprietary hardware of machines that were already “working”.

This week I took one more token step toward a free software stack, by migrating from proprietary-ol’ VMWare over into open-source VirtualBox. Although they use different virtual disk formats (VMDK vs. VDI) it is possible to convert between them using a free tool, just like this:

VBoxManage clonehd image.vmdk image.vdi --format VDI

Yet the format of the virtual disk file is a minor hurdle in the scheme of things. The real problem with switching from one virtualization system to another is that all the “virtual hardware” changes. You basically have a whole new video card, processor, BIOS, sound device, keyboard, ethernet interface—everything changes. There can be problems booting after the switch if the operating system tailored the installation for only the hardware you had at the moment you ran the setup.

Fortunately modern operating systems were designed to roll with such punches. Manufacturers and users alike will pull parts out of the computer and put new ones in. So there’s enough of a “lowest common denominator” lingo that even super-futuristic graphics cards can go into a 640×480 mode long enough to let you see the dialog boxes for installing a smarter driver designed for it. My Linux installs came through just fine.

But I keep a VM for Windows XP too, that I pull out in those circumstances when I need such a thing. Predictably…Windows had some esoteric trouble on VirtualBox with agp440.sys and intelppm.sys. A helpful article I found suggested to essentially delete them and it starts working. I did a little reading and agp440.sys is related to a deprecated standard called the Accelerated Graphics Port; it seems that removing it does not seem to prevent the Virtual Machine from having accelerated 3D services. intelppm.sys is related to power management and turns off the processor if the CPU is effectively idle, so it is likely superfluous to a virtual machine.

(Note: I did have to turn on the VirtualBox setting for enabling “‘IO APIC” to appease mup.sys but did not see the CPU utilization bug mentioned in Ticket #638. So I decided not to follow the convoluted process of using SysPrep to rewire things so that I could turn that check box off.)

So after a couple hours of tinkering, my Windows VM came up under VirtualBox…though it gave me a warning. My hardware had changed sufficiently that its “Genuine Windows” status was invalidated. It told me I would have to activate it again within 3 days.

“Or what?”, you may ask.

In this case the “or what” is “we won’t let you into your system”. You type in your password and it announces that you’ll be going into the activation process right now, else no soup for you. It didn’t even give me the 3 days it claimed; in the course of less than 24 hours it decided to jump me straight to OS death row.

(A long way to go, just to harass users of an operating system the company DOES NOT EVEN SELL ANYMORE.)

My one copy of XP is very old. The wily holographic disk has the orange license key sticker stuck directly on it. I’ve used it on several computers, all of which basically either died and got thrown away…or were formatted with Linux and given away to charitable causes sans any of my personal info. Yet I don’t know how many times I can push this magic “activate” button before it decides to say no. Plus I hadn’t even installed the VirtualBox tools that let Windows magically embrace things like integrating the mouse pointer with the host…what if I activated, then installed those, and it decided it was a new computer all over again?

As it happens, I restarted in Safe Mode and it decided to let me in. I installed the VirtualBox tools and rebooted and clicked “activate”. It let me activate (for now…at least while these activation servers happen to be around.) But this is another zen lesson about what it means for something to be Defective By Design. My small dependence on a few Windows tools and desire to assist people with problems (such as porting solutions to not need Windows) will hopefully be phased out before I should ever encounter another Genuine Windows Disadvantage!

South By Southwest and Austin Migration

Friday, March 11th, 2011

Sorry for the lack of updates to the blog, but February was a busy month of leaving Los Angeles for Austin, March was taken up by SXSW, and April will involve finding a new apartment and furnishing it. But I hope to return to recreational programming and writing articles about it soon enough!

(Note: If you’re visiting the site because you met me in Austin and got my card & want to talk more then please feel free to email/call or leave a comment.)

UI Should Be More Than The Data Structure

Monday, January 10th, 2011

There was an interesting question on the User Interface discussion board at StackExchange. It regarded how to make an interface for letting a user enter numeric ranges, and then specify a label for anything that falls in that range.

A real-world example might be how percentages are turned into letter grades, such as 97-100 for an A+ and 94-96 for an A… and so on. But the mock-up data used in the provided example was:


Less than 20 Default
20 .. 40 blah
40 .. 80 next
More than 80 something

A constraint was that the ranges would not be allowed to overlap, and the question was what would be the best UI for this task. Rather than just draw a picture in response, I open-sourced a working online implementation of something I called jquery-numband:

Though it’s only a prototype, it offers an efficient angle on this question which starts with a freeform input box. You can paste any text into that box and it will only pay attention to the numeric values (which need not be integers). These numbers are sorted, it will throw out the duplicates, and generate the appropriate non-overlapping bands for you.

Once the bands are formed, you can enter mapped values for each. You can also click on some triangles next to the numbers to indicate if occurrences of that precise value should be considered in the band above -or- below it.

Editing the split points directly on the bands isn’t allowed (for now) but you can amend the main text box. If such an edit disrupts the boundaries of bands you’ve already used then it saves a “history” record to avoid data loss. If that precise band should reappear, the history record is reabsorbed to repopulate it.

You can try it out online to get a feel for how it works:

http://hostilefork.com/shared/jquery-numband/

I wrote this to make a point…

Programmers are clever because they find ways to keep the system from getting into a bad state. If the spec asks for non-overlapping bands you don’t want the user accidentally winding up with a dozen identical bands. It’s also desirable to stop nonsense like ranges from (0.2 .. Banana). The ability of software to constrain this is a big part of user interface.

However this can lead programmers into a blind spot when looking at this kind of a problem. They make the only elements on the screen ones that correspond to some piece in the final target data structure. UI buttons aren’t allowed to break the “programming rules” of that underlying data, so they become tantamount to an exposure of the API for operating on it. The result leads to a modal interface that handcuffs the user.

I avoided that trap by bringing in a freeform text box and a range history, while still keeping the user’s eyes on the final data structure. The result let me exploit a lot more of what computers bring to the table, such as sorting the numbers and quickly filtering through information that might even come from a copy/paste.

I’ll come back with more detail in this post, but in the meantime you can see examples of what I’m critiquing in the other interfaces here:

http://ui.stackexchange.com/questions/2898/how-to-create-bands-of-number-ranges-for-a-field/

Imagination Squared (Plus OpenZoom)

Sunday, September 12th, 2010

There is a community driven art project in Jacksonville Florida, called Imagination Squared. The idea was to have hundreds of members of the local artist community each contribute a small square that they’d decorated. The squares were all a standardized size, and they were all tiled together in an art installation.

Curious as to what people had sent in, I looked through the site. The art page had hundreds of 100×100 pixel thumbnails, and you had to click on individual ones to get to a larger-resolution 300×300 picture. This struck me as an obvious application for the Microsoft Research PhotoSynth/SeaDragon zooming that was infamously demonstrated at the TED conference by Blaise Aguera y Arcas.

I wondered how the Free Software folks had been faring in creating an open-source variant of SeaDragon. Doing some searching I was pleased to find the OpenZoom project. You can see they have a number of cool examples, and I thought the ImaginationSquared project would be an example that would interest a lot of people (the hundreds who contributed squares, at least!)

So here’s the promo video for what I just released the source code to this morning:

Though I’m not going to host the player on hostilefork.com, I pushed the source code out to GitHub today for both the generator (written in Ruby) and the viewer (written in ActionScript 3). I’m also happy to provide built versions of the data and component to individuals who want them:

http://github.com/hostilefork/openzoom-squared

Neither of those two are languages I’ve used before. So I’ll use the rest of this blog entry to talk about my thoughts on that.

(more…)


Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported