All About A*

Amit Patel’s multi part discussion of A* (esp in games) is a very nice read. Even if you just read the first page, you’ll get a clear picture of various pathfinding algorithms and their trade offs. So later bits aren’t quite as nice to follow (e.g., the trade offs between terms in the heuristic could be fruitfully visually indicated), but overall, it’s great.

It’s part of a series teaching math and computer science via games. Not necessarily wildly original in concept (cf AI: A Modern Approach), but here execution is everything. Check out the discussion of pathfinding for a tower defence game.


Some Good Reads

I really am trying to clean out my tabs and writing something in depth on each isn’t always cutting it. So here’s some quick hits (the link text generally isn’t the title:

  • Burying NoSQL for consistency failures. Essentially the argument is giving up consistency for availability (cf CAP theorem) is a bad move due to increased application complexity AND that many “NewSQL” systems aren’t consistent for a subtle implementation reason.
  • A beautiful performance study of grep tools by the author of ripgrep. Clear, fairly comprehensive, appropriately modest, it seems totally publishable to me. I learned a lot reading it and enjoyed doing so.
  • “Systems programming” != “low level programming” has a nice history of the term and concept. It’d be good to get an analysis of how the phrase “programming in the large” got in.
  • You should read all of Dan Luu, but you’d could do worse than starting with his “Hardware is Unforgiving”.
Four Down, hundreds to go.


I went down the rabbit hole trying to code up some simple class data analysis tools. I have a custom script for exam results which uses Jinja2 as a template language and generates a Markdown doc. It’s alright, but I figured there must be something ready made that wasn’t a “note book” and could generate documents and reveal.js slides.

Nope. Not so I could use.

I had knitpy in a tab for forever so I though I’d give a spin. It seems both moribund and broken for all my struggling could demonstrate.

I poked at Pweave. I don’t know if I just lost the will to live or I really couldn’t get it working. Either way I was spending more time looking at the tool than pulling in and massaging the data, so I gave up.

Along the way I came across a paper on PythonTeX which has some interesting arguments:

PythonTeX makes possible reproducible LaTeX documents in which Python, Ruby, and Julia code is embedded. This can mitigate the potential for copy-and-paste errors, simplify the creation of figures, and allow significant portions of documents to be generated automatically. Built-in utilities for dependency tracking reduce the need for makefiles or similar systems. Tight LaTeX integration allows code to adapt to its context in a document. User-defined sessions that run in parallel provide high performance. Synchronization of errors and warnings with document line numbers mean that writing and coding remain efficient. Finally, the depythontex utility ensures that PythonTeX may be used even when plain LaTeX documents are needed.

In particular, they argue that tight integration with the host language is an advantage as you can more easily pass data back and forth:

  • As a LaTeX package, PythonTeX allows users to write valid LaTeX documents in which the full power of LaTeX is immediately accessible, rather than hybrid documents that contain LaTeX markup. Unlike in IPython and Pweave, it is simple and straightforward to pass information such as page dimensions from LaTeX into Python. It is even possible to create LaTeX macros that mix LaTeX with other languages.

I think it may be possible to abstract some of that out. I don’t see a strong need for super tight integration to get most of this. But who knows? It’s worth exploring.

A Survey of Online Coding Tutorials

The paper, “A Pedagogical Analysis of Online Coding Tutorials“, provides an analytical review of a sample of online coding tutorials. One of my project students did something similar (they should have published!). The analytical framework is useful but not surprising: they have a set of types (interactive tutorial, MOOCs, web references, etc.) and “nine groups of 24 [analytical] dimensions” including content, organisation, and context. It all seems sensible, though I’m a bit leery. It seems almost too sensible. There’s no empirical work on actual effects (completion, satisfaction, and learning). It’s super tempting to think we can extrapolate from this beautiful and tempting set of features to these effects. Consider their key conclusion:

Our results suggest that most online coding tutorials are still immature and do not yet achieve many key principles in learning sciences. Future research and commercial development needs to better emphasize personalized support and precise, contextualized feedback and explore ways of explaining to learners why and when to use particular coding concepts. Based on our sampled tutorials, we recommend that teachers be very selective in their use of materials, focusing on the more evidence-based tutorials, particularly the educational games. All educational games in the list provide hierarchical structure, immediate feedback, and opportunities that learners actively write code and use subsequent knowledge for coding throughout the tutorial.

But they’re games. What kind of learners are responding to them? Are students responding to them? No coding game that I know off has bubbled up in the popular consciousness or trade press the way say Khan Academy or MOOCs in general have. That doesn’t mean they aren’t educationally superior, but it needs some explanation.

Overall, however, it seems like a solid, worthwhile paper and a good and necessary starting point. Someone needs to too this sort of work and we need more of it.

It’s also the sort of work that needs a dynamic, ongoing database that’s kept up to date with periodicity snapshot papers. One off papers get stale quickly! But it’s eminently replicable, so…have at it!

Eno: Another Data Markup Language

Eno seems interesting. I don’t know that it’s interesting enough to exist over existing formats, but it’s in the YAML/Config format/TOML family and sort of a cousin to Markdown/Settext/Wikiformat (as all these data formats are).

It doesn’t seem to have a spec per se and the documentation is silent about primitive datatypes, which is annoying. Looking at the Python library’s documentation suggests that it uses an on demand coercion approach…basically, you coerce an element when you retrieve it from the parsed structure:

>>> from enopy import loaders, parse

>>> doc = parse("""
...   publish: yes
...   location: 36.987094, -25.091719
...   contact: contact@faulty
... """)

>>> doc.boolean('publish')
>>> doc.lat_lng('location')
{ 'lat':  36.987094, 'lng': -25.091719 }
ValidationError: 'contact' must contain a valid email address, for instance ''.

I can’t say I’m a big fan of this API. It seems really dreadful to have the field name as a string inside a coercing function call on the document which magically gets the right “loaders”? I mean, you have to specify the type of everything including built in structured types? Yeek.

Ok there does seem to be a generic interface:

>>> document = enopy.parse(input)

>>> document.element('title')
<class Field name="title" value="Artfest 2018">
>>> document.element('tags')
<class List name="tags" items=2>
>>> document.element('content')
<class Section name="content" items=14>

This feels like a step back from e.g. JSON. And this documentation hurts me!

Still, it’s kinda interesting and one could always layer a different API on top.

Worksheets to Support Active Learning

I do a lot of lecturing. I like to lecture and am good at it. It also is pretty much what’s expected. For MSc classes we have all day classes which kinda suck for lectures though that’s mostly what we do. For my software engineering class, I break up the day with two labs, which helps, but I’m always on the look out for ways to make the lectures more effective. This generally means trying to get the students to do active learning, that is, not to passively “receive” information…this is nearly worthless…but to anticipate, question, puzzle over, generally be engaged in the material I’m presenting. Student response systems seem to help some with this as does asking questions of the class (though this often fails). Our students are of wide ranging abilities and backgrounds. For many, just working in English is a big strain.

One thing I’ve had what I think of as some success with is providing little, simple activities on sheets of paper, e.g., to draw various complexity curves. It’s a variant of clicker questions, but trying to get them to do something.

I came across a Software Carpentry blog post on Git worksheets which intrigued me. The idea there is to “draw along” with the instructor instead of doing some task. It seems a nice way to provoke and support the good sort of note taking. I have a lot of “process style” slides which I maybe can change into worksheets or have anticipatory worksheets. I draw a lot on the board spontaneously, but perhaps using the opaque projector on a worksheet might be more effective (though take a lot more prep).

Support for Contact Theory

There’s an intriguing post by Echidne about a paper about an experiment on the effects of gender integration on men’s attitudes toward women. This chime’s with other stuff I’ve read esp about thresholds for participation which trigger changes in climate (I really need to go back and dig all those up and put them in one place). Interestingly, Echidne speculates that the quality of the contact is also key:

The first sentence is crucial of course, and so is, in my opinion, the clear sharing of same tasks in an observable manner.  It’s not enough that men and women are in close contact, the way many of us are in our homes or at least in our childhood homes, say.

The work must be shared so that the skills and effort of each contributor become evident to the others.  Many traditionally female chores at home (cleaning, laundry) can become almost invisible (as work) to those family members who are not doing them when sexual division of labor is rigid, and it may be hard to value the work someone is doing if it appears to just happen in the background of life.

I find this highly plausible. And it points not just for the need for women in leadership positions but in all positions. And it’s ever more important to make sure that they don’t get stuck with ghettoisable tasks.