Read on and leave a comment
or return to our portfolio.

31 Jul 2008

by Noel

SchemeUnit 3: A New Approach to Testing

SchemeUnit 3 has been released. Although the interface remains compatible with version 2 the underlying philosophy of SchemeUnit has changed in a significant way. The following is extract from the SchemeUnit manual, describing the new approach.

SchemeUnit is designed to allow tests to evolve in step with
the evolution of the program under testing. SchemeUnit
scales from the unstructed checks suitable for simple
programs to the complex structure necessary for large

Simple programs, such as those in How to Design Programs,
are generally purely functional with no setup required to
obtain a context in which the function may operate.
Therefore the tests for these programs are extremely simple:
the test expressions are single checks, usually for
equality, and there are no dependencies between expressions.
For example, a HtDP student may be writing simple list
functions such as length, and the properties they are
checking are of the form:

(equal? (length null) 0)
(equal? (length '(a)) 1)
(equal? (length '(a b)) 2)

SchemeUnit directly supports this style of testing. A check
on its own is a valid test. So the above examples may be
written in SchemeUnit as:

(check-equal? (length null) 0)
(check-equal? (length '(a)) 1)
(check-equal? (length '(a b)) 2)

Simple programs now get all the benefits of SchemeUnit with
very little overhead.

There are limitations to this style of testing that more
complex programs will expose. For example, there might be
dependencies between expressions, caused by state, so that
it does not make sense to evaluate some expressions if
earlier ones have failed. This type of program needs a way
to group expressions so that a failure in one group causes
evaluation of that group to stop and immediately proceed to
the next group. In SchemeUnit all that is required is to
wrap a test-begin expression around a group of

(check-equal? (foo! 1) 'expected-value-1)
(check-equal? (foo! 2) 'expected-value-2))

Now if any expression within the test-begin

expression fails no further expressions in that group will
be evaluated.

Notice that all the previous tests written in the simple
style are still valid. Introducing grouping is a local
change only. This is a key feature of SchemeUnit’s support
for the evolution of the program.

The programmer may wish to name a group of tests. This is
done using the test-case expression, a simple
variant on test-begin:

"The name"
... test expressions ...)

Most programs will stick with this style. However,
programmers writing very complex programs may wish to
maintain separate groups of tests for different parts of the
program, or run their tests in different ways to the normal
SchemeUnit manner (for example, test results may be logged
for the purpose of improving software quality, or they may
be displayed on a website to indicate service quality). For
these programmers it is necessary to delay the execution of
tests so they can processed in the programmer’s chosen
manner. To do this, the programmer simply wraps a test-suite
around their tests:

"Suite name"
(check ...)
(test-begin ...)
(test-case ...))

The tests now change from expressions that are immediately
evaluated to objects that may be programmatically
manipulated. Note again this is a local change. Tests
outside the suite continue to evaluate as before.

2.1 Historical Context

Most testing frameworks, including earlier versions of
SchemeUnit, support only the final form of testing. This is
likely due to the influence of the SUnit testing framework,
which is the ancestor of SchemeUnit and the most widely used
frameworks in Java, .Net, Python, and Ruby, and many other
languages. That this is insufficient for all users is
apparent if one considers the proliferation of “simpler”
testing frameworks in Scheme such as SRFI-78, or the the
practice of beginner programmers. Unfortunately these
simpler methods are inadequate for testing larger
systems. To the best of my knowledge SchemeUnit is the only
testing framework that makes a conscious effort to support
the testing style of all levels of programmer.

Posted in Code | Comments Off on SchemeUnit 3: A New Approach to Testing

24 Jul 2008

by Noel

Undeleting Files on the Mac

I spent a good portion of last week attempting to recover about 30GB of movies that had been deleted from a Mac with a 60GB hard disk. When a file is deleted its normally left intact on the hard disk except for a marker saying its space can be reused. This means that deleted files can be fairly reliably recovered, so long as the space hasn’t since been used for other purposes. We found the movies were missing only a few days after they were deleted, and they took up half the hard disk, so I was fairly confident they could be in part recovered.

Of course that’s great in theory but in practice how I was I going to recover those files? A quick bit of Googling discovered three programs that will attempt to recover deleted files on the Mac:BoomerangFileSalvage, and Data Rescue II. I downloaded a trial copy of each and set to work. Here’s how they performed:

  • Boomerang ran very quickly but only found some 29MB of the missing 30GB of movies. Of the three programs I tested it is the easiest to use, with only a few options for the most common problems. It also does a better job of sticking to the Mac interface conventions than the other two.
  • FileSalvage took many hours to search the hard disk. It found lots of files, but it didn’t identify many as fragments of movies. Additionally the interface is very clunky. It doesn’t use the standard Mac widgets and selecting file types in Expert mode is a real pain.
  • Data Rescue II ran fairly quickly and found almost all the lost data. Success! It is fairly easy to use. The guided standard mode does a good job of leading you through the recovery process, and the many options in Expert mode are explained well. Like the other programs it uses non-standard widgets, and this needlessly detracts from its usability.

So in my testing Data Rescue II was the clear winner. Don’t read too much into this, as I was only looking for movie data; one of the other programs might work better for a different type of file. However, if you’ve deleted some files that you want to recover I would start with Data Rescue II, then try Boomerang, and only then try FileSalvage (and go to bed while it’s running). Finally, if you have two Macs a firewire cable and target disk mode will make the whole recovery process a bit simpler.

Now what I want to know is: why would a Mac developer invent their own user interface widgets unless they really want that amateur feel to their product? Is there something about Cocoa programming that makes it easier to create, say, your own tab component than use the system one?

Posted in General | Comments Off on Undeleting Files on the Mac

13 Jun 2008

by Noel

PLT Scheme 4 is out

PLT Scheme 4.0 is out. We’ve been using the pre-releases for months so this release isn’t particularly significant to us. However, for Universities and other institutions having an official release is important. I do think that too many individual developers stick with out-dated versions of PLT Scheme. The number of questions about 372, which is at least a year old, amazes me. Pre-releases are so much better! Go upgrade!

Posted in Code, Racket | Comments Off on PLT Scheme 4 is out

6 Jun 2008

by Noel

Of Interest 06/06/2008

  • Ravelry, the knitting social network, raises $71K from its users. First amazing thing (to me, a non-knitter) is that Ravelry even exists. There truly is a place for everyone on the big ol’ Internet, and with each community a corresponding business opportunity. Second interesting thing is that the donation drive was user initiated. I wonder if it will be a regular occurrence. I like the idea of community supported social networks, but I doubt it is a sustainable model. Indeed Ravelry’s primary sources of income are advertising and affiliation fees
  • Lessons on building online communities from the people behind Flickr. Two key points: Firstly, it takes a lot of effort to grow a community, and the creators have to get involved in that early stage. Later on, it’s best to get out of the way and let the members decide for themselves what the community is like. The discussion of Flickr’s design, intentionally personal but unobtrusive, is a great point and reminds me of the service at the best restaurants.
  • If I understand Clay Shirky correctly, drinking gin is the original form of blogging. Bottoms up! Seriously, at least skim read the text. Note that some evidence suggests at least part of thesis does not hold.

Update: More thoughts on Ravelry

Posted in General | Comments Off on Of Interest 06/06/2008

6 Jun 2008

by Noel

Musing on Ravelry

Hi Ravelry people! Thanks for dropping by and commenting. It’s clear you are all very passionate, which bodes well for the long-term future of Ravelry.

A number of you have argued that Ravelry is more than just a social network. I agree, and I think this an important development in the business model for these kinds of sites. Flickr was the first “social networking” site that I saw that offered useful features beyond the social network. This is a great model. Few people want to dive into a new community without first spending some time learning the rules of the group. What Flickr does is give you a reason to return to the site before getting involved in the social aspects. So you start of using Flickr just to store your photos and then perhaps over time find your way onto the various groups. In my case I never make use of the social features of Flickr, but Flickr still benefits from my custom. In comparison sites like Friendster give you nothing to do on the site beyond the social interaction, and consequentially I never visit the site.

Where I see Ravelry going beyond Flickr is in acting as an intermediary connecting buyers and sellers in the knitting and crochet community. While Flickr offers some commercial services, it is a very asymmetric model with only a few big sellers. It seems that Ravelry is pursuing a much more egalitarian model, where any community member can easily engage in either end of the transaction. Ravelry is essentially the market maker, and you just have to look at the London Stock Exchange or NASDAQ to see how important this function is. What makes the Internet wonderful is that it allows someone to make a market (and a living) in something as informal and fun as knitting!

Posted in Business | Comments Off on Musing on Ravelry

21 May 2008

by Noel

The Return of Scheme UK

Many years ago I started the Scheme UK user group in merrye London Towne, and all was good. Then I moved to Birmingham and Scheme UK slowly died. I always had the intention I’d start it up again when I had more time, but now I don’t have to! Ewan Higgs has taken the initiative and organised the next meeting for the 28th of May. Dave Griffiths will be talking about his fairly awesome fluxus system. All the details are on the Scheme UK site.

Posted in Functional Programming, Racket, Web development | Comments Off on The Return of Scheme UK

25 Apr 2008

by Noel

Know Your Customer

Watch the battle below and guess who won: Bboy Baek (on the left), or Bboy Born (on the right).

I expect most people would say Baek. He does all the crazy stuff, right? Looks hard and impressive, while Born is just spinning around on the floor most of the time. However, I expect most bboys would give it to Born, who in fact did win that battle. Why? Born sets are well constructed. He has a nice mixture of toprock (the stuff standing up) and downrock (the stuff on the floor), and mixes up the tempo with those pauses at 1:27 and 2:40. Baek has great moves, but he just throws them down without any real set up, and he messes up some of them, like the hand-hop at 50s and the flares at 2:14. Also, when the music changes he just wanders around the stage, not dancing.

I like this video as its reminds me of an obvious but sometimes forgotten point in software development: experts are not everyone. Expert users are often the most vocal, and when desiging software it can be very easy to let their concerns dominate to the detriment of less skilled but more numerous users. Sometimes a new feature is just creeping featurism, but sometimes it’s core to the target market. The only way to tell the difference is to constantly keep in mind who the customer is. Startups in particular can have difficulty with this, as by definition a startup doesn’t yet have any customers. Common advice to startups: scratch your own itch and dog fooding, can be seen as mechanisms to put the developers into the mindset of the users. 37Signals advice to build less is appropriate when targeting the general public. Extreme Programming mandates an Onsite Customer. We’re lucky at the moment to have constant contact with our customers, and regular feedback from them is important make sure we develop software that is useful for them.

Posted in Business | Comments Off on Know Your Customer

21 Apr 2008

by Noel

The Biographicon

The Biographicon is a very pretty web site of user contributed biographies. It is also written in Scheme, and here’s one of the developers discussing how it was done.

Posted in Web development | Comments Off on The Biographicon

6 Apr 2008

by Noel

Science and Self-Directed Learners

Over on LtU I was asked how to help beginning programmers become self-directed learners. I have taught a number of students, but not in a context where I’ve been able to really make a difference in their programming practice, so I don’t have an answer to the whole question (though my instinct is that the apprenticeship method is the right way to go). However I try to teach one process that I think is an essential step towards becoming a self-directed learner. That process is the big idea called science, and I’m not talking about lab coats and chunky glasses

When working with students I always get asked what the result of evaluating some piece of code will be. What I tell the students is toask the computer via a test case or the REPL. Testing ideas by experimentation is science in its simplest and most immediate form, and a crucial step in developing the student’s ability to solve their own problems.

Application of science to programming is not restricted to students;test-driven development is science. So what is science then? I simplify, but basically three things: a theory to test, an experiment to test it, and a standard of proof (note we can never truly prove a theory, just simply not be able to disprove it). This is exactly when a unit test is. For example, a Scheme programmer might pose the theory “the string->number function will convert strings padded with whitespace characters to numbers”, formulate the experiment(equal? (string->number “ 200”) 200), and have as the standard of proof the boolean output of this single experiment.

When most people think of the scientific method they think of the lengthy and expensive double-blind trials used in, for example, medical trials. A really important point is to realise that when you do science, you choose the standard of proof. For example, as most computer programs are deterministic a few tests can be sufficient to show a property holds. When dealing with a concurrent program, or some other non-deterministic system, you may need to be more rigourous.

So there we have it. All programmers are scientists to some extent, though they might not know it. We can extend the use of experimentation to answer other questions, such as determining if productivity is affected by changes to software development process. Doing this in a lightweight way is the intention of the Simple Improvement package, though I haven’t had the time to get that library to a really useful state. Perhaps in a later post I’ll go through the ideas behind it. In the mean time, get experimenting (lab coats optional).

Posted in Code | Comments Off on Science and Self-Directed Learners

25 Mar 2008

by Noel

Epic Lolz

Over Easter we insulated our roof. It was quite easy job, but I’m not going to write much about it as this post is entirely an excuse to show this picture:

funny pictures

No animal abuse was involved: he climbed up the ladder into the loft and stayed there until we moved him to put down more insulation.

Posted in Fun | Comments Off on Epic Lolz