Skip to content
June 3, 2014 / cdsmith

CodeWorld Rises Again!

About three years ago, I started work on an idea about technology-based math education.  The idea was to get middle school students to work passionately on using mathematics to create things, by:

  1. Doing their own original, creative work, instead of following instructions or reaching set answers.
  2. Getting instant feedback 24 hours a day, so they can tinker and learn in a self-directed way.
  3. Building confidence by working on their own ideas, inspiring pride and excitement.
  4. Experiencing how concepts from geometry, algebra, and physics can be springboards for creativity.
  5. Becoming creators, rather than just consumers, of technology.

That’s a lofty set of goals, but it was very successful.  In the 2011-2012 school year, I taught a small class of six students, two to three hours per week.  We had an awesome time.  They built their own computer games throughout the year.  We struggled together, worked our way through, and finished the school year with an awesome expo where the students showed off their work to local technology professionals and participated in a question-and-answer panel about their experiences.  It was fascinating listening to this, because a few patterns arose:

  • Students didn’t really think of what they were doing as math.  This remained true, even when the skills they learned involved describing the behavior of systems using equations, functions, and variables; describing complex shapes in terms of geometry, the coordinate plane, and rotations, translations, and scaling; coming to grips with the meaning of probability and randomness; etc.
  • The students who entered the year being “good at technology” weren’t necessarily the most likely to succeed.  Talking to these students broke all of the stereotypical molds about computers and technology!  Students took to the activity and wildly succeeded were very often girls, and had previously thought they were more the art-and-music type.

At the end of that year, I had plans to teach this program in multiple schools the following school year.  Unfortunately, things then got a little sidetracked.  I started a new job at Google over the summer, moved to California, and dropped the program.  The web site that students had used to build their projects fell into disrepair, and stopped working.  I stopped doing anything about it.

Over the last week and a half, though, that’s changed!  CodeWorld is back!

Getting Started

The CodeWorld web site is (as always) at http://www.codeworld.info.

Any web browser will do, but you really need to use the latest version of whatever browser you choose.  If you’ve been putting off upgrading Internet Explorer, it’s long past time!

You’ll also want a Google account.  You can log in using your Google account, and save your programs to Google Drive.  Because your programs are saved to the cloud, you can use the web site from any computer you like, even computer labs in a school, and your programs will follow where ever you go.

Using the web site is simple.  Type your program on the left.  Click Run to see it work on the right.  You can sign in to open your existing projects and save your projects.  You can also get links to share your projects with others.  There are sample projects along the bottom of the screen, including Yo Grandma!, a game written by Sophia, one of my students from the original class.

Unfortunately, instructions on how to write the programs are still mostly missing.  If you already know the language, a link to the generated documentation might help.  Otherwise, hold on!  Once the programming environment is stable, I plan to put together a comprehensive progression of exercises, tutorials, and examples.

Behind the Scenes

Under the hood, I mostly recreated this from scratch, throwing away most of the original project from a few years ago.  This new version of the environment has a lot of advantages: it runs your programs on your own computer, so your program runs a lot faster.  It’s less restrictive.  And I completely customized the language to make a lot of things simpler and easier to understand.

Changes:

  • The programming language for CodeWorld is called Haskell.  Haskell is an awesomely mathematical language, but parts of it are also notoriously complex.  The new incarnation of CodeWorld still uses Haskell, but goes a lot further to hide the rough edges.  In particular, you’ll rarely see any classes, and there’s an obvious type for most things (e.g., all text has the type Text, and all numbers have the type Number.)
  • Previously, CodeWorld was based on a library called Gloss for the Haskell programming language.  Gloss is great, and I saved as many ideas from it as I could.  But CodeWorld is now its own library.  This let me clean up some terminology, align the meaning of programs more closely with the goals of algebraic thinking and math concepts, and work with the simplified version of the language.
  • The biggest change to how the web site works is that your programs now run on your own computer, instead of on the web server.  This is using an awesome project called GHCJS, which converts the Haskell program into JavaScript, which is understood by web browsers.

I’ll try to keep posting here as I have learning material ready to use with this tool.  Stay tuned!

17 Comments

Leave a Comment
  1. This is great news! I was very impressed with the original incarnation of this project and can’t wait to see how this progresses now that you’re working on it again.

  2. Tim Docker / Jun 5 2014 7:48 pm

    This is really fortuitous timing – I was on the point of starting to teach my children some programming (age 12 and 14), and was trying to work out how to get sufficient interactivity in the development process whilst using a declarative language (ideally haskell).

    Do you plan to make the code available for the system? Are you open to collaboration on the backend?

    • cdsmith / Jun 6 2014 12:34 am

      Tim, I would love to release the source code! Unfortunately, there’s a bit of formal process to go through with my employer first. Hopefully, that will go smoothly, and I’ll post here when it’s done.

    • cdsmith / Jun 19 2014 4:58 pm

      Hi Tim,

      Just to follow up here, I managed to finish the paperwork, and the source code release is now done. You can find the code at https://github.com/google/codeworld.

      Yes, I am happy to collaborate on the back end. It’s technically a Google project now (though an unofficial and unsupported one), and Google requires that you submit a contributor agreement before I can accept pull requests and such, but it’s a pretty benign one as far as I can see. Details are in CONTRIBUTING.md in the repository.

      • Tim Docker / Jun 19 2014 11:21 pm

        That’s great news. Thanks for your efforts.

        It’s school holidays in Australia now, so a good time to do some computer lessons. I’ll start my children off on the codeworld web site, whilst in my own time I’ll get my own build up and running.

      • llaisdy / Jul 1 2014 3:45 am

        Why is a Google API key necessary to run the server? (step 9 of Build & Deploy on the Github page).

      • cdsmith / Jul 1 2014 2:00 pm

        Good question!

        Instead of storing usernames and passwords locally, CodeWorld uses your Google account to identify you. The API key is needed for the login system, so users can log in with their Google accounts.

        If you leave it out, most of the functionality will work, but no one will be able to login, and as a consequence, save their work either.

        Are you setting up your own instance of the site? Or just getting it running for development and local testing? If the latter, you can probably skip that step.

      • llaisdy / Jul 3 2014 5:22 am

        My son and I had a go with a previous version of this (you blogged about running it with a home school) and he liked it a lot. I’d be interested in setting up an instance, but only if it could be unhooked from Google. I guess I need to look at rewriting the login and storage parts.

      • cdsmith / Jul 3 2014 10:10 am

        Got it. I’ve opened a bug report to do this for the main site (https://github.com/google/codeworld/issues/39), but I can’t say when I’ll get to it. If you do try it yourself, let me know any questions you have about the code.

  3. Cassie / Jun 6 2014 6:54 pm

    I am a homeschooling mom with almost no background in coding. I see you are working on learning material to go with the Codeworlds tool. Will the materials you have planned be intuitive and empower students as well as instructors inexperienced in coding without the intervention of an instructor such as yourself who is familiar with the program?

    • cdsmith / Jun 7 2014 12:57 pm

      Cassie, I hope so, eventually! My first priority will be to create materials to go along with a class in a local school this coming school year. I’ll publish those as they are available.

      Students tend to pick up the picture parts easily, and spend hours and hours playing around with them. I could definitely imagine making a series of videos to introduce the basic capabilities and suggest ideas to play around with. Animations also come somewhat (though less) easily. The latter part of the class working up to games can be a bit more challenging, in that students typically need a lot of help at the target age group. At this point, students are also working on their own unique projects. I think it would kill the program if you assigned a specific game for them to make. So by that point, I think you’d definitely need an instructor. I’m thinking about how to build learning materials for teachers, but that’s further off.

  4. Luite Stegeman / Jun 7 2014 5:15 am

    Very cool.

    You can probably reduce the reload time if you use incremental linking. It’s a bit underdocumented, we’ve been using it to reduce the link time for the executables in our testsuite. You can generate a base bundle with most of the library code, load that from a static location where it can be cached, and only reload actual user code (look for –generate-base in test/TestRunner.hs and the TestLinkMain / TestLinkBase modules. I’m not including a link, since I suspect that’s the reason an earlier reply got eaten by the spam filter)

    You might also be interested in things like pausing the runtime or stepping through a program, or perhaps more low-level ways to control the threads (killing a thread with an async exception works obviously, but delivery is not instantaneous). Let us know in #ghcjs (freenode) what ideas/requirements you have, and I’ll try to help.

  5. Chaddaï Fouché / Jun 9 2014 6:56 am

    Nice :)
    When you first tried this experiment, I tried to do the same in a club setting but didn’t succeed very well (not enough time, awkward timing, not enough authority on my part…) though we did some nice things. I would be very interested in an open version of this, which I would probably translate (in French) to help reduce the number of things to learn for beginners (French middle-schoolers/high-schoolers aren’t the best English speakers).

    • cdsmith / Jun 12 2014 11:17 am

      I definitely plan to release this as open source, which you should be able to translate. I even redefine the standard library, so you could create a french version of that. Stay tuned; it may take a while, as there’s some unfortunate paperwork involved.

  6. Job van der Zwan / Jun 28 2014 3:31 am

    Hey, I’m noticing that it runs smooth in Chrome but slow in Firefox. Any ideas what the bottleneck might be?

    • Anonymous / Jun 28 2014 6:37 am

      Nevermind, I just discovered that Firefox on Linux doesn’t have hardware acceleration yet. That’s probably the issue.

Trackbacks

  1. Teenage Haskell | twdkz

Leave a comment