newsletter articleI wrote an article about trinkets, an online introductory programming environment, for the latest issue of the newsletter of the UK's Computing at Schools organisation. Here's a slightly revised version, with more screenshots (click them to enlarge).

I came across trinkets when looking for a way to complement our free pack of leaflets (about algorithms, coding, women in maths, historical computers, etc.) for BBC's Make It Digital season with a hands-on "hour of code" activity that could be done online, without any software installation or account creation, by the general adult public.

undefined name Trinkets fit the bill perfectly. A Python trinket is a browser-based environment featuring a text editor with syntax highlighting, a Run button, and a pane showing the resulting output. Misspelled variables are spotted before running the code. error messageError messages are shown in a meaningful way, instead of cryptic stack traces. If students get lost in their own changes, clicking on the 3-line icon shows a menu with a reset option that reinstates the original program.

share menuEach trinket is hosted on, with a unique URL that can be shared on social media and by e-mail, using the Share menu. Alternatively, you can embed trinkets in webpages, to put explanatory text around coding activities and to run the code automatically. That's the route I took. Again, trinkets make it easy: a Share menu option shows the HTML snippet to paste into the page.

usage statsAlthough you can create a trinket by just going on the website, changing the example given there, and then sharing the link with your students, I recommend you create an account or log in with your Google or Edmodo account. With an account you can easily duplicate and change existing trinkets (which I found convenient for building a progression of activities) and you can see how often your trinkets were viewed, interacted with, and shared.

You should give each trinket a memorable name to quickly find the code you're looking for. There's a 'gallery' view of trinkets but unfortunately it doesn't show the code, only the output, which means that trinkets requiring user input are, unhelpfully, blank in the gallery view.

To sum up, I found trinkets to be simple, effective, easy to use, well designed, and a very good option for avoiding hosting, software installation or account creation, as long as you don't mind depending on the continued existence of the website. Only some Python modules are currently available, including part of the turtle module (which moves turtles very smoothly), but they're enough for most exercises or projects you can think of. There are also trinkets for teaching a Scratch-like language, HTML, CSS, and even music notation.