OU blog

Personal Blogs

UK Moodle Moot 2010

Visible to anyone in the world
Edited by Sam Marshall, Friday, 23 Apr 2010, 22:39

Sorry, I have been totally neglecting this blog. It's so busy at work I don't have time to write entries...

Anyway, along with a bunch of other OU people, I went to the UK moodle moot last week. It was terrible! No, not the moot, but I had to get up at 07:00 one day and 06:30 the other day. It was like living in another time zone or something.

The moot was okay. I didn't like most of the keynotes. (And said so in a meeting afterwards... forgetting my boss had given one. Ooops.) But there were several interesting presentations, particularly one about how higher education institutions handle Moodle development and one about different models for funding open source development. I didn't give a presentation - I submitted a proposal but either it was rejected or they lost it. Oh well, it would only have been another boring demo of ForumNG anyhow!

More of a personal blog thing (but it's not like I'm writing this on work time)... I took my camera one day and took a few photos. I stuck the selected ones on Flickr which is where I put random collections of not very good photos... Anyway, if anyone's interested, there are 8 pictures starting here (click picture then use 'next' link at right to go through them):

Labs

The reflections in that are about the most people you'll see in any of them. I don't do pictures of people. smile But the moot was held in the University of London's Senate House building, which is a really impressive landmark building. Unfortunately, we tried, but we couldn't get to the top floor or anywhere near it... Ah well.

I'll try to do another post soon (...ish) about development work, which is of course ongoing!

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 5 Mar 2010, 18:09

Here's this week's blog update. Let's see if I have anything to say!

I keep getting beset by crises, but this week wasn't bad considering - I recorded over 2 days of actual planned development work in our time reporting system! Woohoo.

Ray's providing primary support for the VLE part of our Structured Content publishing system now. So when this week our system made a staff member cry, I wasn't there to see it. The bug in question wasn't really our fault for once, and we did a workaround. But it's the first time I know of that we actually made somebody cry in front of a developer because of a software bug.

(I have made somebody cry at work once before. But that was something I said, not a bug! Don't worry, it was a long time ago and we made up.)

The other crisis was that cron (periodic server tasks) kept breaking. The main thing cron does for ordinary users is send out forum emails, so apologies if you didn't get forum emails at some points... I don't think we actually lost any subscription emails (if it stays broken for more than 2 days, the old emails get discarded) but there were periods when emails were delayed for a rather long time.

The server team put emergency fixes in place, and I've done workarounds (maybe) for both situations now: in one case this appears to have been caused by file corruption [possibly due to attempts at simultaneous access to the same file], and in the other case by a syntax error introduced last release which for some reason hasn't caused problems up until now. We think this may have been slowing down a stats process because the error occurred about 27 million times each run, causing the PHP error log to reach 4 gigabytes.

Anyhow, back to development. For the dashboard back-end, I'm building proper unit tests; after I complete each little part of the code, I write a test for it. Coverage, i.e. the proportion of the code used when running tests, is currently at about 81%. Pretty good!

This should make the software quite reliable, but I think it about doubles development time, even though this is new code designed to be testable - something I didn't really take into account when doing estimates. That said, I always double estimates anyway, so this is only eating into that safety margin - the reason I'm behind schedule is not that things are taking longer than predicted, but that I'm getting less time to develop than predicted...

Developing with unit tests is a very different experience to most Moodle development (in most cases, doing comprehensive unit tests in Moodle is far too much hassle, because the structure / lack thereof isn't suited to it, and the PHP language also makes life more difficult). These unit tests all run on my system (in 0.7 seconds) without going anywhere near a Web server or database, something which is rather difficult to arrange in Moodle.

Although doing complicated tests can still be a bit tedious, I certainly wish I could work this way all the time...

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Thursday, 25 Feb 2010, 22:19

Yes, I fail at updating blog. Sorry. However! Here's an update.

ForumNG

We fixed several critical bugs in the contrib version thanks to bug reports from the community. Thanks! There have also been bugfixes from our internal testing.

Ray's finished the subscribe-to-discussion feature (but I don't think it is committed to the contrib version yet).

OU blog

Mahmoud's working on the individual-blog feature (aka 'learning journal' - every student has their own individual private blog within a course, which their tutor can monitor).

I put in a feature request to see if we can allow public comments (moderated) so that people who don't have an Open University account can leave comments in my blog. (Wait, did I say my blog?! I mean, the vast array of blogs hosted on our system! Er, don't pass this bit on to the people who prioritise feature requests.) Even if this gets the go-ahead it will be quite some time before it is developed though.

OU wiki

Bryan's annotation feature (which basically lets tutors 'mark' work in the wiki by locking a page and adding comments at any point within the text) is finished and mostly bugfixed, and I think it's great! We've been showing it off to people as part of our upcoming release (see below). I'm afraid this also is not in our community release yet - we need to do an update of ouwiki at some point.

My work

I've been continuing to spend a depressing amount of time on support and bugfixing and troubleshooting and writing specifications and even just on reassigning tasks. I don't actually mind doing any of this, but it's put me way behind on the dashboard system I'm supposed to be developing.

That said this week I did get back into work on that system and it is great (not the system, the work). It's in Java which means everything in the IDE works perfectly (I can refactor, woohoo) and I'm writing unit tests immediately after I finish each new method, with code coverage for tests at about 80% (the 20% is mostly odd/impossible failure cases and stupid setup code and the like). This should be really reliable! I hope.

General comedy

I did a briefing about our upcoming release for Helpdesk yesterday and for Media (an internal division that... eh don't worry about it) today, both done together with Sharon who is in charge of dealing with the transition from the old proprietary conferencing system to forums (and other things) within our Moodle-based VLE.

These already had a certain comedy aura because the 'upcoming release' has just been postponed (somebody's off sick in the team that works on servers and the person who would've stepped in for them is on leave) so we're doing briefings for an update that isn't even going to happen yet. But it's even better because:

  • In yesterday's briefing, somebody turned off the Forums block just before we did the demos. I was showing off the mobile view. 'So er... what there are no forums! ... well if the forums were showing, they'd be there, and it would only show the unread ones...' etc.
  • In today's briefing, the computer in the presentation room has an irritating wireless mouse, and it wasn't working! For added amusement, they replaced the keyboard with one which has all the keys in the wrong place (Return and Backspace tiny and surrounded by other keys) so I kept mistyping.
    After I did some of the demo on keyboard only, Sharon saved the day by going to get the key to the locked cupboard with the computer in, and plugging her own mouse to it. Best moment: when she'd just achieved this, still in my part of the demo, and we were on opposite sides of the room, me with the keyboard and her with the mouse. 'Click on the Resources link!' Good times.

Yes, I have pretty low standards for what consitutes 'comedy' but, well, I work in computing. smile

(And talking of low standards, I also made an an image macro based on the Xzibit 'Yo dawg' meme with reference to a proposed new Open University website design... but I think that one had better stay in-house.)

Permalink 1 comment (latest comment by Sharon Monie, Tuesday, 7 Sep 2010, 15:37)
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Monday, 1 Feb 2010, 17:06

Sorry, I've been neglecting this blog the last few weeks. Just a couple of interesting things to report (well... not very interesting really... but interesting by the standards of this blog).

First, I am presenting a session at iMoot, the international online Moodle conference this week. (You can still register if you like, it's not very expensive. Tim's got a session too, and of course there are plenty that aren't being given by Open University folk as well!)

This runs on a 24-hour schedule meaning that I have to do the presentation at (I think) 01:30 Thursday morning my time... then it gets repeated at a couple other times where I still have to turn up at the end for questions.

The session I'm doing is basically the complete guide to ForumNG - starting from installation and then covering all the fancy features and improvements. I'm hoping to encourage other people who run Moodle installations to try it, or people who teach to pester their administrators to try it, etc. So it'll be a bit like all the screencasts from this blog, except all jammed together at once, in a more coherent order, and (by the time that session ends) with a less coherent presenter. If that sounds like fun, well, hope to see you there. smile

If you don't fancy that, but you're up for a more traditional conferencey thing, I may possibly have a briefer presentation in the normal UK Moodle moot (this proposal has not been accepted yet so we'll have to wait and see).

Second, I know a lot of people outside the OU wanted the 'subscribe to individual discussion' forum feature. Good news, it turns out that people inside the OU want it too! We're scheduled to do it. I finished a (slightly sketchy) spec today and Ray's just beginning the development work.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 15 Jan 2010, 17:35

Here's my weekly update. It's just one week into 2010 (workwise) and I'm already feeling a bit tired...

I took the first week of the year off. This week I've been trying to deal with bugs (a few in live system, mainly in the March release that we finished developing before Christmas). One of these was a special bonus IE7 bug in one of our systems. IE7 crashed when you tried to print a page. It turns out that the crash occurred when headings had a margin of 2em. Setting it to 1em or 1.5em solved the problem. WHAT. That browser is crazy.

Apart from that I've been helping developers on my team get started with work for the June release. 'Helping them get started' is a euphemism for 'telling them to do something'. Unfortunately, it usually involves me having to write specifications and answer lots of questions and things like that, which makes it a lot less fun than the average dictator gig.

The goal of doing some actual development has seemed rather far away - I did clear all the assigned bugs now, but there will be more, it's like washing-up or something. Anyhow when I get started on that  I will be working on a new courses dashboard, initially for tutors.

This is going to show you all the forums on all the courses you're tutoring on - links and the 'unread' indicator so you know if you need to check that forum. The idea is that it saves tutors visiting every single course website when they just need to know if the forum changed. (It's not just forums, which by the way it will support both old and new NG ones - we will also show OU blogs and wikis, although they don't have unread information so we will just use the last-changed date.)

Probably the most interesting thing from my point of view is that this development isn't being done inside Moodle! I get to write it in Java. smile It will support some links from other university systems, and maybe eventually include other external systems too - that's why it's not being built as a part of the Moodle system here. (And by the way, you might notice it's actually a little bit like the existing My Moodle feature. But not the same.)

Back to Moodle development, we are doing some more stuff to our contributed modules in this development period. There will be more improvements to ForumNG (and another public release - in fact we're moving development to occur primarily in the contrib cvs, hopefully very soon). And we're finally adding the 'learning journal' feature to OU blog (so that you can have a course blog where students don't see other students' entries).

Finally, I'd like to highlight this article about developing an Android app just because Anthony wrote it. Might be helpful if anyone finds themself needing to do the same...

Now, I think I'll head home... um... just remembered, I do actually need to do some real life washing-up as well... smile

Permalink
Share post

Converting from old forum to ForumNG

Visible to anyone in the world
Edited by Sam Marshall, Wednesday, 16 Dec 2009, 20:39

Ray's gone on holiday to China (he completed all his scheduled work) so I'm now left on my own finishing off the forum developments for our March release. Which would be fine if people didn't keep finding bugs in the rest of the system. Argh!

Anyhow, I've made another screencast about quite an important new feature that I implemented in between bugfixing over the last few days. We can now convert from an old standard Moodle forum into a new ForumNG, which should obviously be really important for anyone planning to transition to ForumNG.

Screencast about forum conversionVideo player: forumng-conversion.swf (9.3 MB)

Some notes:

  • If you're not from the OU, you might think the 'old forum' shown here looks a little different; mostly, this is just because of our theme, but there are also some custom features that were added to the old forum locally, such as the ability to add more than one attachment. The conversion process will work with standard forums as well as our customised ones.
  • In the screencast I forgot to show the course home page after conversion. Ooops. The converted forum is placed directly below the old forum it's been converted from. Since the old forum is made invisible, the new forum will appear in exactly the same place.

This feature is particularly important to me because occasionally I have to use internal forums that are still using the old forum and it's a bit painful now I'm used to ForumNG! However that was not the primary reason for implementing it. smile

I didn't show them in the screencast but there are some other features Ray and I added since last time, so I'll just mention these here:

  • Export to Word document (it's actually just HTML which happens to load in Word, but don't tell anyone) - you can now use the 'selected messages or whole discussion' system that was developed for the forward-by-email feature I demoed before.
  • Print - you can print a discussion or selected messages, too. This takes you to a simple view of the messages that's more suitable for printing, and opens the Print dialog ready for you to print the page.
  • Save to MyStuff - this is an OU-only feature. Users here can save a discussion, or selected messages, to their MyStuff portfolio. Hopefully at some later date we will convert this forum to Moodle 2.x; at that point, we'll change this feature to use the standard Moodle 2 portfolio API which means everyone will get it.

As mentioned before, all this stuff should be available in the OU's March release, and in an update to the community version hopefully around the end of the month (or early January if I run out of time).

By the way, if anyone's interested in getting a more comprehensive overview of ForumNG rather than these periodic 'what we did this week' updates, especially from the perspective of standard Moodle usage outside the Open University, you might be interested in the iMoot virtual conference in February. I'll be presenting a one-hour (!) session about ForumNG, showing how to use it with standard Moodle 1.9. This will happen in different time zones and the live presentation is at like 2am or something my time. (It'll be recorded and rerun, with a live question session afterwards, at two more salubrious times.) So you'll get to see how well I can do a presentation at that hour of the morning. Well worth the entrance fee... or possibly not. smile

Permalink
Share post

About me

Visible to anyone in the world

Hi, just a quick note for anyone who's seen my posts about improvements to our forum software (there's probably one just below this) and is wondering who I am.

I'm one developer (that's business-speak for 'computer programmer') working within one area of the Open University, primarily on the system that runs course websites. (Incidentally, that includes this blogging system. I'm using it because, well, dogfood.)

My blog's certainly not official in any way, shape, or form. I'm just a programmer!

In particular, I do talk here about the work I'm doing, and when it will be 'released'. But for all sorts of reasons, even if I've built some software, there are often long delays before anyone gets to use it, and there may well be other alternative systems that are still in use, etc. There are good reasons for this - for instance, we don't like to make significant changes to software in use during a presentation of a course. It's also quite a good idea to test things after they've been written to make sure they actually work. That kind of thing.

If that means I've shown off something that looks nice, but it isn't in use yet on your course - apologies! Hopefully it will be used on a course you take at some point in future.

(I did get a few questions about this, so thought there might be other people wondering, and I don't want to cause any confusion. Sorry for this even-more-boring-than-usual post.)

Permalink
Share post

ForumNG: unread navigation and flags

Visible to anyone in the world

Over the last few weeks I've mainly been having to concentrate on fixing bugs in our upcoming release and indeed our current live system (argh, quiz), but I managed to squeeze in work on a couple of new forum features. I've made another very short screencast to demonstrate them.

Watch the screencast nowVideo player: forumng-unreadflag.swf (6MB, ~3 mins)

Some notes:

  • This screencast uses the standard Moodle theme, which is a lot less pretty than the Open University one! (Thanks to our excellent graphic designers.) I thought it would be nice to show how it looks on standard Moodle one time.
  • These two features were added based (respectively) on student and tutor responses to our existing pilots, and on earlier feature requests from tutors.
  • This is in our March release but if you're a student or tutor at the OU and you're wondering when you get to use this forum, the answer is probably not 'March'! Sorry.
  • If on the other hand you work at another institution that uses Moodle - we haven't yet updated the community release of ForumNG to include these features, so don't download it tomorrow and get disappointed. We'll be updating the community release around end of year, hopefully after that it will keep pace directly with our development.

Hope this was at least a little bit interesting! As usual, there will be more screencasts whenever we have more features to show. Given all the bugfixing that's going on recently, I'm not quite sure when that will be...

Permalink
Share post

New blog post

Visible to anyone in the world

I asked Ray if he would make a screencast about his new ForumNG features, and (after a little bit of convincing) he agreed! Finally, some variety in this blog.

Play screencastVideo player: forum_ray.swf (note: will not work in IE7 - please use Firefox or IE8).

The screencast covers three minor features in about four minutes. The features will be included in the OU's March update.

  • Permalink (posts are always shown within discussions, but this gives you a link to the discussion with #p1231312 or whatever so that it jumps straight to the post and expands it automatically)
  • Important posts (moderators etc. can mark a post as important, this makes it a different colour and adds an ! icon)
  • Alert (if somebody posts an offensive message, students can report it; this directly sends email to a nominated person so they can check)

Ray was a bit negative about it but I think the screencast is really great! However it did take him a long time (mostly outside work time) to make, which isn't really fair, so I probably won't ask him to do another one... at least not for quite a while.

Two notes for those considering using our forum at other institutions:

1) The screencast shows our version, but outside the Open University, default text on the 'Alert' form obviously won't mention the OU or our code of conduct. Instead there is generic text that should be suitable everywhere. You can replace the text with something specific to the institution using a local language file, which is what we've done here.

2) We haven't updated the community version with these features yet - going to do a batch update  around the end of the year or start of next.

Permalink
Share post

New blog post

Visible to anyone in the world

Time for this week's development update. I did do a new ForumNG feature (in addition to the public release mentioned earlier), but I thought I'd talk about something different.

Usually, I mainly talk about what I'm working on personally, but in fact the others on my team are working on lots of other things... I don't think they are offended but even so it would be good if I don't leave them out all the time!

And I hope some people reading this might be interested in reading a wider range of what's being developed in the OU's learning environment, even though that's probably not directly relevant. (As a reminder, if you happen to be an OU student - this is not in any way official, all just my personal comment, and features discussed in this blog are generally some way in the future. The things I'm talking about now are due for March, and even if we get them all finished on time, that often means, only in courses which start after March, and often not all of them either...)

Not in any order:

  • Ray is also working on ForumNG features, as mentioned before. He's currently finishing off the 'report offensive post by email' feature. Not the most exciting feature, but a useful one.
  • Anthony has just finished various investigation tasks relating to Sloodle - a community project that integrates Moodle with Second Life. The OU is running a small pilot project using Sloodle so we needed to have a local developer who knows something about it.
  • Tim is working on his new quiz engine. I saw it today (in between pestering him to do things other than quiz) - the bit where you can change interaction model in the preview is really cool.
  • Al and Alan are working together on the OU-specific 'OU stats' (reporting) feature. This is probably not very exciting to most people reading this; basically it means we will provide better statistics about course usage to course teams etc., with nice graphs and so on. (The current version only has text tables.) It's beginning to come together quite nicely.
  • Mahmoud is finishing code that automatically transfers gradebook scores to the main University systems (well, it gets them as far as the department that runs said systems, anyhow). This is going to let courses make quizzes/assessments which are required in order to complete the course, but not scored in the usual way (i.e. you have to complete it but the actual score you get doesn't matter - it's just about doing it). Yes there is a good reason for this! I can explain that if anyone likes...
    Because the deadlines for these don't work like normal exams, it needs this new automatic system.
  • Bryan (who is technically not on my team!) is working on a significant new feature for the OU wiki module (which is available for Moodle 1.9). The new feature is sort of a replacement for comments (comments are still there, but we will probably turn them off) - it lets tutors use the wiki to 'mark' group work via a new annotation system.

Later in this development, apart from 'more of the same' (continued ForumNG work, for instance) we should also be working on:

  • Mobile support for course pages (i.e. if you visit a course page using a smartphone, we will serve you a reformatted version that works better - at least until you enter an activity for which we haven't yet implemented a mobile version). We actually have a slightly unfinished pilot version of this in the December release, but you have to use a special URL to get it, and I think I probably shouldn't tell everyone what that is!
  • Integrating ePub support for [some] course content, so people can download a version formatted for any* ebook reader.
  • Minor improvements to the 'shared activities' system that nobody knows about. (Not sure I should put in a link to that one either, even though it is genuinely available already! Hmmm...)

* Where 'any' excludes Kindle, of course; my opinion is, unless they make a serious move toward open standards, Kindle should be kept well outside bargepole-range...

Well, that's it. Sorry if it was boring or confusing. Next week I'll post about forum developments again, including the new pirate flag feature!

Permalink
Share post

ForumNG public 'launch' (pilot)

Visible to anyone in the world

Thought I'd add a post about this now instead of waiting for my regular Friday blog post.

ForumNG is now available as an optional add-on for standard Moodle 1.9.

If you run a Moodle 1.9.x installation, please feel free to try it out. However, do bear in mind that this is a pilot version and is sort of halfway between testing (i.e. earlier versions have been tested but we changed a bunch of things since). Please install on a test server first, and do not use for any real work unless you've verified for yourself that it is good enough for your purposes.

If you do find bugs please report them via the Moodle bug tracker. There's a link to that in the modules & plug-ins entry above.

Permalink
Share post

New blog post

Visible to anyone in the world

Ooops. Didn't do a blog post on Friday, so here it is late...

Nothing very exiting to report in ForumNG-world last week:

  • I made the post throttling (limit posts user can make to forum in one day) option actually work - it wasn't implemented before.
  • I made initial subscription work (it works a bit differently to current forum though - based on the 'force subscription' logic then with negative subscriptions).
  • Ray added permalinks (# link with direct link back to post that you can copy/paste into emails etc) to each post.
  • Ray added highlight post feature for moderators; they can tick a box to make a post a different colour, which should be more obvious.

I'm now trying to get ForumNG to work with the old 'htmlarea' editor that is still used in standard moodle 1.9 (argh) in preparation for contrib release. I may be gone some time...

Permalink
Share post

March ForumNG features

Visible to anyone in the world
Edited by Sam Marshall, Friday, 30 Oct 2009, 20:32

This week we've started work on development for our March release. They haven't even started testing the December release yet, but these things have to overlap or we'd never get anything done...

There's a lot of development on ForumNG scheduled because the March release is a big push here - we want lots of courses to start moving onto the new forum, for new course presentations that start from that point on. I'm spending the vast majority of my time on it, and Ray Guo is also doing some of the new features. Hopefully I'll get Ray to make a screencast of his stuff so it's not just me all the time.

By the way, the version for Moodle 1.9 contrib (optional install) should be getting made really soon. (Famous last words.)

Anyhow, some people like the screencasts, so I decided to make another one each time I have a new vaguely interesting feature to show. This week I had to spend a lot of time scheduling tasks and suchlike (and getting Tim to do things he doesn't really want to do because he wants to work on quiz... but he's already implemented a really cool admin report). But I did manage to implement a new feature as well.

The feature is 'forward by email'. You can send a whole discussion, or selected posts from a discussion, in an email to any email address.

Here's the screencastVideo player: forumng-forward.swf (about 6MB). As usual, the link requires Firefox or another browser that is happy to play .swf files when clicked.

By the way, I didn't mention it in the screencast, but the whole thing does work for non-JavaScript users (including our 'friends' using IE6; we turned off ForumNG's JavaScript in IE6 because trying to make it work was a nightmare). The interface is basically the same but with less of the fancy visuals and more of the 'click a button, wait for a new page to load'.

Permalink
Share post

December ForumNG release update - save draft

Visible to anyone in the world
Edited by Sam Marshall, Friday, 23 Oct 2009, 21:14

Today was our code freeze for the December 1st release. As usual, various things were delayed, but I did actually manage to finish a few new features for ForumNG. (Not as many as I'd hoped - unfortunately, what with me going on holiday and then various necessary bug fixing tasks, there was only about two weeks of development on new features. Don't know exactly how much development there was, because, er, I'm late with updating the schedule page... ah well...)

Anyhow, here are the new features since last time I posted to this blog:

  • Administrators can now choose to unsubscribe users (from the list of subscribed users). This was kind of supposed to be there already, but I'd forgotten to implement it.
  • There's a Collapse all link on discussion pages. It's no use to man nor beast, but people were disturbed by seeing the Expand all without its mirror image.
  • Moderators (by default; anyone with the appropriate capability) now get to ignore limits on posting. For example, the forum can be set to allow posting only from a certain date; now, moderators are allowed to post before that date.

And the big one - save draft. We had a customisation to existing Moodle forums that let you save draft posts. (There were lots of problems with it, too, but let's not go there.) ForumNG didn't have this, but people wanted it back, and their wish is my requirements list!

The new save draft is a lot nicer than the old one. You can conveniently use it either because you want to leave a message and finish it tomorrow, or because you're halfway through a long post and are (probably justly) paranoid that the system will crash and lose all your work. Anyhow, rather than explain how it works, I've made a 3 minute screencast to demonstrate it.

In order to see the screencast you need to be using Firefox or some other nice browser that will display .swf files that are linked to. This is because I'm too lazy to set up a proper web page for it.

That said, here's the link.

December release features (...i.e. save as draft) screencastVideo player: forumng-savedraft.swf

Enjoy! (Well, or just bear it. It's only three minutes.)

PS If you're a member of OU internal staff you can probably see the documentation page for this update. Not available for tutors or students or anyone outside the OU, sorry. (But if you read this blog you know it already! Just in a bit less detail.)

Permalink
Share post

Unit testing opinions

Visible to anyone in the world

Tim dumped a huge book about unit testing on my desk today. He thinks I should read some of it!

But I'd been thinking of writing a blog post about unit testing, so why not take the opportunity before I read too much of the big book and it spoils me? I'll try to write a blog post that's nearly as long as the book!

First if anyone doesn't know what unit testing is, (a) it's a technique for writing computer program code that tests other pieces of computer program code in an automatic, repeatable way so that if you change the code that's being tested, and the change breaks something, the test will probably start to fail and you'll notice... and (b) you probably don't care about this post. Go have fun somewhere else! This is about boring programming stuff.

In my recent personal projects I do significant unit testing, but I don't really follow any of the buzzwords. Here's what I think, divided into neat pairs (spot the odd one out).

Be careful - I'm going to say that you 'should' do something or that you 'must' do something else or that 'nobody' would be stupid enough to even go within bargepole-reach of the general concept of a third something. If that's likely to concern you, please just pretend I said 'in my opinion' several times per sentence.

Is unit testing worthwhile?

  • Unit testing is really, really important when writing complex backend code. Unit testing won't work for UI code. This means you should ensure that as much code as possible is in the backend. But you know that already.
    Without unit tests you cannot change anything without being desperately panicky about whether it'll break (and it probably will). If you're doing something complicated you definitely want unit tests.
    JUnit is integrated into Eclipse, so if you're a Java programmer, it's easy to get started and run tests. No need to create test suites or anything. Just right-click on a source folder containing Java files with JUnit tests and 'Run As... JUnit Test' to run 'em all.
  • If you're doing something simple, writing unit tests is a waste of time. Don't bother. Unit testing set/get pairs - or anything that basically boils down to that - isn't big and it isn't clever. Because Java's a compiled language and because modern compilers give warnings for things like assigning variables to themselves, the chances you would break any code that simple are pretty damn low.

How completely should you test? At what level should you test?

  • When testing complex code you've written, coverage is important. Test coverage means the instructions that were covered by all your test cases. You hit run on all your test cases and something tells you what percentage of code was covered.
    If a branch wasn't covered by the test cases, it's probably a good bet that it's broken, so getting good coverage is important. I'd guess you want to be at least 80% or so, with maybe just some error cases and set/get and suchlike omitted. (If the errors are really important, i.e. might actually happen for somebody whose machine isn't already terminally broken, then you should make those tested too.)
    For Java developers, coverage testing is easy. Just install the EclEmma Eclipse plugin. It'll show you coverage by package tree, and you can look at source files to see lines that were covered (green) and weren't (red).
  • So I think coverage is important. But I don't think it matters a damn where that comes from. You do not need a matching test class for every real class. If you write low-level classes which are used by higher-level ones, then fine - just do tests for the higher-level ones, provided that gives reasonable coverage (and finesse the inputs to the higher-level code so it does). Or do lower-level tests for the worst most fiendish parts of that code, but don't bother with the finicky details; leave that for the higher-level stuff that will use it.
    Some people argue this means you can't immediately tell what failed. They're right, but nobody cares. Unless you're writing the world's most complicated project, it's unlikely that a failure in a high-level test would be more than a matter of minutes to track down at a lower level. You have a built-in reproducible example right there, and you know how to use the debugger. THERE IS NO STEP THREE. Come on. (Plus, you have the clue it's probably related to, oh I dunno, maybe something in the checkin that broke the unit tests?)

What about writing test code itself?

  • Test code should be well-organised so that we know which class you're testing...
  • ...but it doesn't have to be good quality code. Who cares? It's test code. Stick some comments in if you're doing something non-obvious or if you feel like it but if you have a function called testFreeble and your system has a feature called freebles and you run the freeble() function 3 times inside that test... I think we know what you're testing. If you call a function with -1 or 0 then it's probably an out of bounds or edge case. We get it.
    Similarly, refactor stuff (using the automatic 'extract method' or manual refactoring) to make your life easier writing and updating tests, but not purely for code quality reasons. Nobody needs to read tests unless they break. Unless your 'real' code is already perfect, spend time improving that before you waste it on test cases, which are usually relatively simple.
    Maybe you've configured your Java compiler to give a warning if you write a public method without javadoc (I do) - you can turn this off in test code because all test methods are public and those 'Tests freebles' comments get really old really fast. @SuppressWarnings("all").

Do you write tests before or after development?

  • After. Puh-leeze. You know you're going to change the API. How boring would a project be if you knew what the API was going to be before you started? And unit tests, achieving coverage, are not black-box tests; your test manipulates a black-box, but when writing the test, you choose test cases based on what you know's inside. It's much easier to do that when you've written it.
  • But, ideally, straight after. Write the complicated back-end code for the project first. You haven't got a user interface to run it - so until your project's very near finished, literally the only way you should ever be running it is through hitting 'play' on the JUnit view.
    Once you finish a feature, do the test for it. Running that test, you know your code won't work, because it's the first time it's ever been run. Yay! That's a good thing. Because writing tests is much less tedious if there's some realistic chance, like in this case about 90%, that they actually fail initially, and you have to go off and fix the bugs in your actual code.

Testing in Java is a dream; 'existing horrible project' aside, there's really little excuse not to do it. Write everything complicated as a separate backend package and test that sucker before you glue it into a real projet. Everything runs at lightning speed, you've got all the nice, pretty tools built into the IDE you already use (by the way, if you prefer NetBeans, the tools are available in that too).

 

Sooo.. at work I mainly have to develop things for (our customisation of) Moodle, which is written in PHP. Aaaand we're off to a flying disaster right there...

Moodle uses SimpleTest, which is a perfectly okay framework, but suddenly I have to go to a webpage to run the tests instead of hitting Command-F11. At present there isn't coverage stuff in it, either. We can never get the debugger to work (that's okay, I can live with print_object). But worst of all, everything in Moodle is tightly integrated, and (this part isn't really Moodle's fault) most of the complicated bits which are likely to break are actually database queries. Which means you can't usefully test it by abstracting out the database, even if that wasn't an absolute nightmare that wastes hours of development time (and yes I've done it).

Moodle 2 provides some things to make testing fractionally easier but overall it's still a nightmare and will remain so until there's some solution for setting up a reliable test database each test without having to do any work. (I favour SQLite or similar.)

In Moodle 1.9 frankly I can only be bothered to do unit tests where really essential (e.g. I did a fix for a bug with the shorten_text function, which is a complete nightmare, so I needed a test to have some confidence in my fix not breaking everything). The rest of the time... meh. Yes, that definitely makes my code less reliable, but with our timescales and the difficulty of unit testing, I don't see any option.

OK so that was way too long; if you read this far, have a cookie. (No, I didn't bring any cookies! Supply your own. Sorry.) Still, that's what I currently think about unit tests, not being an expert but having done or attempted them for quite a while. Let's see if I change my mind after reading Tim's book! (Which by the way is 'XUnit Test Patterns')

Permalink 1 comment (latest comment by Tim Hunt, Tuesday, 20 Oct 2009, 09:35)
Share post

ForumNG: Study advice

Visible to anyone in the world

Although time got eaten up by a zillion things unrelated to ForumNG changes, I did manage to develop one of the new features this week...

Study advice forum type

With this forum type, you can only see discussions that you started. (Except for moderators/advisors who have the capability that lets them see all posts.) All other discussions are entirely hidden.

So a student can post a question. Then the advisor can respond to it (and the student sees the response). But the student can't see questions that other students asked.

I'm not sure how useful this is in general; obviously we have a specific use case here which means it was 'critical' that this gets done in time! It is. Phew.

Development was a bit of a nightmare. I thought I'd finished inside half an hour... then I realised I'd only made the changes for the normal web view. Much, much, much harder were the changes to correctly display the 'unread message' count on the homepage (only includes ones in a discussion you can see), to make email subscription work (only sends emails you can see), and finally to make feeds work too. I kept realising there was another bit that needed fixing. Hopefully that is all done now.

And by the way - I haven't yet implemented the 'other' forum types in standard Moodle forum smile The Q&A type, for instance. That's scheduled for a future release.

Today we (Sharon and Lisa who are organising the 'FirstClass replacement' programme of work, plus me as the developer) met with a writer for the in-house magazine for tutors. For those not familiar with the University, FirstClass is the old, commercial conferencing software used here, and the new ForumNG software I'm working on is intended - along with the rest of our course website facilities - to finally replace it. Tutors heavily use FirstClass and are attached to the way it works, so that's why the magazine wanted to talk to us.

I said a number of inadvisable things involving the phrase 'sucks'. Let's see how many of them end up in the article. smile

Permalink
Share post

Back

Visible to anyone in the world
Edited by Sam Marshall, Friday, 9 Oct 2009, 17:39

I've been back at work this week, coping with enjoying a welcome return to ForumNG code!

The forum seems to have done okay during my absence. A few technical problems were found during this initial pilot period, and Bryan fixed a really bad one with email subscription (thanks/sorry). Other than that, there's a few serious ones, but they don't cause major problems for the test course. Which means I have been working in a calm manner to fix them for the next release rather than rushing to get stuff done.

(Of course I had to patch a totally different area of the system and rewrite a whole chunk of code that was supposed to have been done months ago... but that was quite enough rushing about for the week, so I'm glad it wasn't needed for the forum too.)

We have 3258 ForumNG posts on the live system now, which is still not that many, but a big improvement on the 20 before I went away.

  • I am trying to ensure that the community (Moodle contrib) release of ForumNG will happen soonish, possibly even actually getting time scheduled for it. Still hoping for November.
  • We added one more actual feature while I was away (again, thanks to Bryan) - you can now sort the discussion list in both directions. Previously, you could already sort by any column, but only one way (A-Z not Z-A, for instance).

Meanwhile this week I've been fixing bugs and working on an even more exciting feature - accessibility fixes! Yes, I know everyone might not be massively concerned about whether the icons are visible on a black background... but it did need fixing.

Permalink
Share post

ForumNG - the future

Visible to anyone in the world
Edited by Sam Marshall, Friday, 4 Sep 2009, 16:03

This is my last blog entry before going on holiday (from work and from everything Moodle-related!) for four weeks. So I thought I'd answer some questions about the future.

In the honourable tradition of FAQs, nobody has ever asked me a single one of the questions listed...

When is there going to be a public release of ForumNG for Moodle 1.9.x?

Hopefully the public release (to the 'contributed code' area where you can download optional extensions for your Moodle) will be around November. That depends on me sneaking it in on unscheduled time, unless I can get some scheduled...

The difficulty is not just the hassle of packaging it up and so on - code changes are required, because some JavaScript depend on TinyMCE's API and standard Moodle uses a different HTML editor. Hopefully the same things are at least possible with the Moodle 1.9 standard editor (otherwise the public release will disable HTML editor and use plain textboxes, making it not very useful).

Will ForumNG ever be the standard Moodle forum?

If the community likes it, it might be included in a 2.x release. This will obviously require us to update the module to support 2.x, and also to be able to transfer data from the old forum. (Both these things are planned.)

What new features are going to be in the OU's December release? (=same as the hopeful public release)

The December release plan includes:

  • Accessibility and usability fixes (we asked the relevant university department to do some testing for us, which identified some issues).
  • 'Study advice' forum type; a forum type where students can start discussions and reply in those discussions, but cannot see discussions started by any other user.
  • The return of the save-as-draft feature. (We had this feature in our modifications of the old forum. It didn't work properly. Unfortunately this time around I couldn't get away with the 'Moodle 2 will do this generically' excuse, because as we know, taking away features from users - even pretty annoying and not very useful features - is verböten.)
  • Ability for a user to 'flag' messages they are interested in or intend to respond to. Flagged messages get included as direct links on the front page of the forum, so you can jump straight back to them.

Hopefully there will be some other stuff, but to be honest, I might not even finish this lot as there isn't much development time...

Could you quote some useless statistics?

Okay. ForumNG went live on OU servers on Tuesday, and so far there have been a total of 20 posts. Woohoo! By comparison, we have 546,606 posts so far in old forums.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 15 Jan 2010, 17:33

Thankfully we only found a few more things wrong with ForumNG after the deadline. Mostly these are obscure but there's a serious IE8 problem - as it is too late to change anything before release (er, except the server OS major version... yes, let's not go there) we'll patch that the day after release.

The problem was caused by IE8 doing something right and then giving an error when it got to a bit of code where I'd done something evil to correct for IE7 doing it wrong! That's a positive sign, I think.

This week I gave a briefing and demonstrated the new forum along with the other new features, twice, to two different audiences: Helpdesk staff, and project managers.

It was basically the same briefing except helpdesk were a lot more responsive! Project managers sat there stone-faced... it's not like I have any actual jokes or anything, but I don't think the briefing was that dull, and the new software is pretty cool.. isn't it? Hmmm...

On the plus side, they didn't heckle when the system blatantly took ages to work at one point. [We were having problems with the test server, it's not a problem with forum - really! no, really really!]

Oh well, I guess they didn't want to be at that briefing. Or maybe there was a coffee shortage or something.

Another positive is that Helpdesk didn't spot anything wrong with the software. Usually when I show software to Helpdesk they are really good at spotting the stupid interface problems that are going to cause students to call them! So I end up going argh, yeah, you're absolutely right, damn, let me write that down, we'll tweak it as soon as we can... at least once. But not this time. Phew.

If I have time in next week's blog entry, I'll mention some of the areas we're planning to develop in the second release of the forum for December. I am hoping that along with these, we'll also have a working public release that other Moodle-using sites can try out, but I should say this unfortunately isn't scheduled, so we'll have to see.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 21 Aug 2009, 17:44

So ma-ny bugs! So little time...

We just hit the deadline for bugfixes to our next release in the start of September. Nothing else gets fixed for the release after today; if anything important is found, we'll fix it with 'catch-up' patches to the system.

The good news is that I actually fixed all the ForumNG bugs (28 this week). Bad news is that I don't really feel like we had enough testing - they also only started testing it this week. Email features haven't been tested because we had technical problems setting it up on the test system. Overall, though, I still think it probably works.

Here are some things that were found during testing despite that I also thought it 'probably worked' when we sent it for testing in the first place:

  • Students couldn't post or reply or view discussions. (Ooops.) Nor could tutors. (Ooops again.) It worked for admins though! Well, admins using Firefox, because...
  • The interactive features all broke for Internet Explorer users. (Hey, it's only 80%.)
  • The interactive features all broke rather more seriously in Internet Explorer 6 specifically.
    I decided there wasn't time to fix it and got permission to leave out all the JavaScript for that browser, at least for now. Might have to put it back in later if people complain. For now, we are proudly running an 'IE6 sucks, get a real browser' message in the footer of affected pages. (Note: The wording might be slightly different...)
  • The edit timeout implementation was a complete mess, with no checking at all, and utterly incomprehensible to students. Testers complained.
    This turned out to be kind of a plus in the end, because now there is a really nice edit timeout implementation; when you edit a post it tells you what the deadline is, if the deadline's getting near the message goes bold, and when it runs out then the Save button is greyed.
    In addition, while you're just looking at a discussion, the 'Edit' and 'Delete' links automatically vanish when time's up.
  • Pretty much every Cancel button anywhere across the entire forum broke in a different way. (Who ever tests Cancel buttons?)

So, that's the good news. (Maybe?)

I guess the less good news is that I'm not quite sure when there will be a public release for other Moodle users (to 'contrib') of this code, even after we think it's working! Hopefully we can do this alongside our next December release. There is a bit of work involved though because this code depends on TinyMCE and standard Moodle 1.9 uses HTMLArea. With luck they have similar interactive facilities, but...

By the way, if you're an Open University student/tutor/other staff member and are wondering when you get to use the new forum, the answer is probably not 'September 1st' even if we are theoretically releasing it then. smile A very few pilot courses will be using it in September, along with the staff LTS-EDIT forums, and I think the VLE examples one that tutors can see. Most people are still trundling along on the existing forum for some time to come.

Permalink 3 comments (latest comment by Douglas Beveridge, Saturday, 20 Feb 2010, 16:03)
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 17 Jul 2009, 18:42

ForumNG's coming along quite nicely. I've now implemented all the buttons along the bottom of the discussion. These are:

  • Discussion options (same as part of form you get when starting new discussion; change sticky, time restrictions, group).
  • Lock/unlock (launches form where you type text of lock message).
  • Merge (when you want to put the current discussion inside another one).
  • Delete/undelete (mark discussion deleted).
  • Show readers (slightly useless page displays people who've viewed the discussion, based on the unread data; available only for posts within the 'store read data' threshold, default 60 days).
  • Export to Word (exports the current discussion page to Word document).

The Word export is a bit of comedy* feature. Previously, I'd put effort into RTF export facilities using horrible libraries that don't work properly. Then somebody told me that you can actually just write an HTML file... give it a .doc extension or Word mime type... and Word will open it just fine. Ho hum. Anyhow, it works. [I kind of wish we could ditch this feature altogether, along with the one before it; they're both pretty useless.]

* In the geeky sense, not the 'actually funny' sense.

By the way, these buttons along the page bottom are an extension point: it's easy to add more buttons if required, without modifying any of the forum code.

Also this week I got backup and restore on the go, and integrated the OU search system, and tidied up the rating star UI a bit following (only slightly contradictory) feedback from helpful developers.

Just one more week to go before code freeze. I'm not too panicked about that - we've now agreed (er, kind of) that I won't be implementing other forum types (Q&A etc) for the first release, which means the only significant feature left is RSS/Atom feed support. Apart from that there are an awful lot of things that need checking (is email still working? it did once but that was ages back) and I probably need to search the code for TODO comments. Then if at all possible I want to do a bit of performance testing, i.e. leave my computer on overnight creating forums and check the next day that an individual forum still performs OK with much more data in the tables, maybe work on optimising the queries if they're slow, etc.

We have decided to leave the internal name at 'ForumNG' during the pilot period. I don't actually know where that naming convention came from, but suspect it's a Star Trek reference. It was also requested that the icon should be changed. Our current icon for old forum is a picture of a person wearing a green top. The new icon is identical, but I changed the shirt to red. We'll be sending this forum out on an away mission to (a small number of) OU students at the start of September...

Oh, and:

  • 1.9 PAGELIB HATE HATE HATE (why is there no $buttontext variable on the print_header for activity pages, grrrrrrr).
  • I found a slice of OU-specific code today which has been in place since last autumn, doesn't work correctly because of the old if($variable = 'value') thing, and in fact appears to have an identical result to the core code before the OU-specific bugs bits were added. Sweet.
Permalink
Share post

ForumNG discussion page

Visible to anyone in the world
Edited by Sam Marshall, Friday, 10 Jul 2009, 20:09

The ForumNG discussion page is (mostly) done, including all the fancy AJAX tricks. It was going to be way too difficult to explain everything in text, so instead I made a five minute screencast all about the new discussion page. (The software I used is in fact limited to exactly five minutes, so you'll notice me getting a little rushed at the end!)

Watch the videoVideo player: forum_discussions.swf *

* This link won't work in Internet Explorer. It will work in Firefox, or any other browser that is capable of displaying SWFs directly in the page. If you just get a download box when you click it, try using the latest Firefox instead.

A few things to note that aren't in the video:

  1. I recorded this from my home connection, which is extremely slow broadband. So the network delays you're seeing (or in most cases, not seeing) are representative of real usage.
  2. Everything shown here is subject to change. Development isn't complete yet.
  3. The discussion page is supposed to have a row of buttons along the bottom that give access to advanced features for moderators - seeing a list of students who have read the discussion, etc. This isn't implemented yet, but anyway it won't have the flashy AJAX stuff.
  4. If you have JavaScript turned off, everything still works, but the links are standard links that take you to new pages with forms on, the rating stars aren't stars but remain as a dropdown, etc.
  5. I didn't show how you add file attachments. That's because it currently doesn't work. smile
Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 3 Jul 2009, 18:02

I've got most of the ForumNG discussion page working, but there's quite a lot left to do too - the fancy AJAX stuff is half-done, and I haven't done any of the controls that go along the bottom of the discussion yet (lock, move, join, view readers, export). Also, I haven't applied the pretty blue OU theme to it. So a screenshot of that can wait for next week.

Instead, here's the History page for a post that has been edited, which I just coded:

forumhistory.jpg

This is available via a link beside the 'Edited by' text on a post. Only moderators (those who can edit other people's posts) have access to it. It shows all previous versions of the post (in this case, there were only two versions).

One possible use for this feature is so that staff can find out if a student posts something offensive, then edits it 20 minutes later, before they get told off but after they've offended someone! Hopefully not a very common occurrence with OU students, who I'm sure are always exemplary in their behaviour... although I was vaguely considering signing up for a course, in which case that will obviously change...

[The feature can also be useful if there are multiple moderators, so that one moderator can check to see what another moderator did, etc. Or for answering 'what on earth happened to this conversation?' questions if somebody edits a post to remove a section which people have already replied to. And so on.]

Old versions of edited posts are optionally deleted after a time limit, by default 30 days. We probably won't be enabling that feature at the OU.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Tuesday, 30 Jun 2009, 16:46

It's not a Friday, but it is way too hot (about 30C in our office) and I need a break, so here's a blog post.

This time it's about accessibility. I had a think (and discussed with one of our in-house experts) what to do about screenreader accessibility for forums. Turns out nobody really knows.

Here's my best shot at it - this is a screenshot of a ForumNG discussion with 'View / Page Style / No Style' in Firefox, which is a convenient way to approximate what screenreader users 'see'. (Yes, there are extensions etc. that do it more accurately - or you could actually use a screen reader, but last time I installed JAWS it did horrid things to my computer, so not going there again. Anyhow.)

forumaccessibility.jpg

Here are the accessibility points in the above screenshot:

  • Each post has a level-2 heading (which is not visible to sighted users). This means that screenreader users can skip through posts by pressing the H key. [If the post has a subject, that'll be a level 3 heading.]
  • The level-2 heading gives each post a number (not visible to sighted users). Numbers are in date order of posting.
  • The heading tells you which post (by number) the current one is a reply to. (That's also a link, should it be necessary to skip back up to the parent post.) This is important because screenreader users likely don't have access to the visual information that indicates it - indents to indicate which post replies to which.
  • Also in the heading is information about the category of the post that is otherwise only available visually - whether it is 'summarised' (showing only the first few words) or not, whether it is 'unread' or not.
  • All the links that are copied for each post (Reply, Edit, Expand, etc) contain the post number so that the links are unique. [Having lots of links with identical titles is an accessibility problem.] Again, the post numbers do not display to sighted users, there it just says 'Reply'.
  • There is some use of appropriate XHTML: in addition to headings (as mentioned), the per-reply commands have been formatted as an unordered list.

I'm sure we can do better but I think this is a good start and it illustrates a few tricks and issues so I thought it might be useful for other people.

If anyone has easy-to-implement suggestions about improving accessibility further over this layout, please add them here. Difficult-to-implement suggestions will probably be ignored. smile

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 26 Jun 2009, 17:35

By today I'd hoped to have the ForumNG discussion display working in the basic non-JavaScript version, but that was not to be sad

I've got about half-way through the display of single posts, which is obviously a key part of this, but.

On the plus side, the forum view page is pretty well complete now (the sorting options work, mark read works, etc).

As for why that discussion code isn't done yet, well, out of five days this week I've recorded 1.25 days of development. The rest is code review and otherwise assisting the other developers on my team; fixing problems with our live system, and analysing a performance question (we've just made a 3% performance improvement, woohoo); providing support for users of our existing stuff; etc. I sincerely hope next week is better, otherwise I may need to go into hiding in order to get anything else done.

Oh, and I've now seen a document sent by aggrieved FirstClass users. For non-OU people: FirstClass is the existing commercial conferencing system we use; it's being phased out in favour of Moodle forums, which is basically why I'm writing an updated Moodle forum version.

They seem to be rather concerned about bandwidth usage! I'll have to make sure ForumNG is reasonably efficient in that regard... now I'm wondering whether I should change all my CSS class names that begin 'forumng-' to 'fng-', which would save a whole 5 bytes each time...

[Conclusion: Er, no.]

Or, maybe if we turn on gzip transport compression they will be perfectly happy with getting rid of FirstClass...?

[Conclusion: Hell no. smile]

Permalink
Share post

This blog might contain posts that are only visible to logged-in users, or where only logged-in users can comment. If you have an account on the system, please log in for full access.

Total visits to this blog: 228252