Type Slowly

Oct 31

Day(s) log, 29th - 31st October 2010: Octopii, Cucumbers, and Probability Distribution Monads.

Aside from making Octopus costumes, and going to ATP’s Release the Bats concert last night (which was incredible - all the bands were great and it was a lot of fun), I’ve had a reasonably productive few days!

Friday was my first Systems Infrastructure lecture,which looks like it’s going to be a really interesting course - we’re currently learning about memory management, but we’re going to be doing loads of stuff about operating systems, compilation and concurrency control.

Aside from that, I learnt some more stats and read the Functional Pearl on Probabilistic Functional Programming in Haskell, which introduces the PFP library. I’d been toying with writing something similar as my dissertation project before finding out it already exists, so now am thinking that I might try implementing something interesting on top of it, a naive Bayesian classifier, perhaps, or something involving Markov chain simulation. The difficulty in coming up with these ideas, I think, comes from having to find something that’s (a) fairly well-defined in terms of scope, (b) sufficiently general in application to be interesting, and (c) within the limits of my abilities. Still, I still have a fair while before I have to choose, so it’s not yet a problem.

PFP really impresses me as a library actually, it’s really well-designed, in that the monadic structure allows you to wrap probability distributions around any other arbitrary domain-specific model types you have, and the actual mechanics of random sampling etc are completely abstracted away into the library’s combinators, meaning you’re only ever dealing with your own types, and the library’s types for representing probabilities and distributions. It’s a really natural, expressive way of dealing with probabilistic computing, and a case study in how to write a really good interface to a library for dealing with really general problems, and really illustrates the power and malleability of Haskell’s type system as a modelling tool.

In Harmonypark news, I’ve been putting the finishing touches to my last chunk of work on Thrive, which has taken a little longer than I expected, due to the fact that the changes caused loads of our cucumber features to fail. I’m starting to develop a few  misgivings about cucumber as a tool, in particular the issue that led to my problems this week - that the setup and teardown of your tests (especially when using a tool like pickle) is intimitely coupled to your implementation, so small changes in your code or model can break totally unrelated tests - something that really isn’t great when a single scenario is meant to test a single feature, atomically.

I suppose there’s a trade-off here: one could do without setup and teardown in features, doing all the setup through browser-steps, at which point you basically lose the atomicity of your test, as basically you have to test the entire liifecycle of your application up until the point you’re interested in. However, this does mean your test is totally general, and is in no way tied to any implementation details that the user or client doesn’t see.

On the other hand, you could use seperate setup steps occasionally, setting up your database with all the state needed to test your feature, making it highly atomic,  but also highly coupled to your implementation. The ideal, I imagine, is probably somewhere between the two. In any case, I think changes of this scale are probably more indicative of a requirements gathering, design, or modelling mistake at some point in the past - making wholesale changes like this is generally bad news, and that’s the real problem, rather than the way in which your test suite reacts to it. Still, it’s all going smoothly now, and we’re very nearly ready for launch, which is exciting.

Finally, I spent a bit of this afternoon organising my massive folder full of pdf’s of papers, ebooks and such using Mendeley Desktop, which seems like a fantastic tool. I’m also using librarything to keep track of physical books that I have read or want to read - I’m finding it hard to keep track of what I want to read, and whether it’s in the UCL library, on my shelves, or is something I might have to go to the British library for, or buy. Using both these tools, I’m hoping I can plan my reading a bit better (I tend to jump between texts and topics fairly freely at the moment, which isn’t necessarily a bad thing, but I’m finding it hard to measure my progress), as well as keeping an annotated record of the things I have read, which’ll make it easier to find books I need to refer back to later, if I need to.


blog comments powered by Disqus
Page 1 of 1