I’ve been writing lots of integration tests lately, for a system that has zero unit tests. Does this make me a bad programmer? Probably. But it’s so easy! This is in Kohana, using ORM, and so the model basically is the database (which idea I rather like), and mocking it or splitting it out to be separate is just a pain. Far less code to write if one can test the whole interaction of the system at once.
I am being slightly tongue-in-cheek here, because I do realise that the maintenance burden of a system built with tight coupling between the various layers is likely to increase contiunually (to a point where someone at somepoint says “oh sod it, let’s rebuild from scratch on Drupal”). But for the multitude of systems that are basically just CRUD, the approach of writing tests that mimic the code seen in controllers is pretty simple and neat.
In Kohana (with Minion), actions and tasks are sort of similar. Both should be ‘thin’ and do nothing more than create objects of the domain model, and direct bits of those objects to various systems of output. Keeping them both in my mind today is helping me divorce the domain model’s interface from the usual web-based interaction: if I imagine that I’ve got to do the same things in both a web-based action, and a terminal-based task, then they seem to end up thinner.
Testing comes into it as well: the test method (I mean the
do_a_thing_test() method, not the method-of-testing) is again similar to the actions and tasks. It mustn’t know much or do much. It only differs in that, in place of setting up some sort of output, it makes assertions about the domain objects.
I’ve finally gotten around to updating my MediaWiki port of the TwentyTen WordPress theme. There’s more to be done, but this morning I moved the page Tables of Contents to the sidebar (issue #2). It’s nice to be forced into learning more about the internals (especially caching) of MediaWiki!
This is the first post that I’m making on my newly-recreated website. I was going to wait until I’d got things a bit smoother and more finished before activating this site, but why bother? I don’t think anyone’s going to mind too much if my news feed is broken for a few days, or some posts that were here are now no longer. I cringe when I read anything I wrote Before, anyway, so it’s probably best that it’s gone from sight for a while (no pun intended).
Do you like the suitcase at the top? It’s much nicer in real life.
Last week I needed a simple, reader-focused skin for a MediaWiki install, and I figured WordPress’ TwentyTen theme would be suitable. So I ported it to MediaWiki.
The skin can be downloaded from Github, and I’ve also added it to the MediaWiki gallery of user styles.
Ben Lee delivered an intriguing, in depth (an hour and a half!) talk on his work as Artistic Director for a computer game company. What particularly fascinated me about this topic was the attention to detail that is given to the fantastic environments that Ben and his ilk create. Amazing! The fantasy/sci-fi world is full of this sort of thing: people imagining environments and virtually ‘building’ them. I am particularly struck with the concept of inventing an environment to inhabit, (of course this isn’t limited to computer interfaces), for isn’t that what humans try to do in so many ways? What if we look around and try to notice that we are living in an amazing 3D environment in which we can interact with every ‘asset’ (that’s what they call discrete objects in a computer game)? Shouldn’t we then set to marvelling at everything around us, thinking “Wow, I can actually touch things!”
So that’s what I’m going to do now…