Older blog entries for malcolm (starting at number 114)

I Told You It Was A Good Book

Random follow-up to a random post: Justine Larbalesteire's Magic Or Madness book (the first one in the trilogy I reviewed) won the Andre Norton Award last night for best Young Adult Science Fiction/Fantasy Novel in 2006. That's part of the Nebula Awards, so kind of a big deal.

See? Other people thought it was good too.

Syndicated 2007-05-13 15:41:17 from Malcolm Tredinnick

"This Should Be Easier..."

The sort of code comment that is usually a sign that whoever wrote this code originally thought it would be easier than it turned out:

  # If all that malarkey found an object domain, use it; otherwise fall back
# to whatever get_absolute_url() returned.

Syndicated 2007-05-12 00:55:01 from Malcolm Tredinnick

Runtime Model Creation In Django (?!)

One of the nice things I like about hacking on Django is that the design lends itself to changing things without having to modify the core code. The internal pieces are split up pretty sensibly into different classes and functions so that you can override and subclass just the bits you need to. It's something that orients my internal design compass a lot when I'm looking at code additions.

Consequently, it's nice to see other people taking advantage of this. Along these lines, Marty Alchin's recent documenting of how to create models at runtime deserves some publicity.

I don't know that this is a particularly robust idea in general, but it clearly has its uses. Marty needs to do it for some reason. I guess with a bit of work and some robust database schema migration code underneath, you could create a web-based model design tool, for example. It's certainly a nice example of using the available hooks and reading the existing code to see how to extend the process.

Syndicated 2007-05-11 19:07:56 from Malcolm Tredinnick

Banning Books Is Stupid, Okay?

Go and read this post over at author Maureen Johnson's blog. Ignore the fact that the blog is very pink and the post titles are in all-capitals and the pictures of headless women in the left column. Read the content. Now pick your jaw up off the floor.

I am astounded that the type of logic that led to the banning of one of Maureen's (or anybody's) books is considered acceptable anywhere. Okay, we're only hearing one side of the issue, but the other side would have to be pretty overwhelming to outweigh the side we read about there.

It's not unexpected that some adults hold extremely conservative views about what is appropriate for their child. Or that they think these values should be projected onto everybody else. Or even that they think kissing between two girls risks pregnancy (although one wonder how they became parents in the first place if this is their understanding of the mechanics). What boggles the mind is that a "committee" of reasonable high school teachers and librarians couldn't or wouldn't see through the obvious problems in the argument.

Syndicated 2007-04-28 15:35:45 from Malcolm Tredinnick

Best Foreign Language Test Phrase Ever!

I've been doing a lot of work lately that is ultimately of benefit to people who want to use a language other than English in their software output (and input). For this you need test data, preferably in a lot of languages. Until now, I've been using a little file with the equivalent of "the quick brown fox jumped over the lazy dog" in a number of languages.

Today I struck gold!

My new favourite test phrase is "my hovercraft is full of eels" and here is a page with the phrase in over 60 languages. Brilliant!

(For those who don't know the origin of the phrase, it's from a Monty Python sketch called The Hungarian Phrasebook.)

Syndicated 2007-04-27 18:57:34 from Malcolm Tredinnick

Review of "Magic or Madness" Trilogy

Why I'm reading a young adult series has a bit of a back story, explained below. Why I'm reviewing it is just because I haven't seen a lot of reviews of this series around and it deserves some wider coverage, at least in Google searches.


Amongst the numerous blogs I read regularly are half a dozen or so by professional authors. Some of these are people whose books I read and enjoy — I've mentioned John Scalzi here before, for example. Others are people I've come across in one way or another, usually via an author's site I'm already reading. These blogs add a nice extra layer to books, because you can see them being developed, watch the author's excitement as they are released and read the readers' comment. Over the past couple of years, I've probably bought maybe a dozen books based on recommendations or curiosity from these writers.

For various reasons (mostly because they're interesting), some of the author sites I'm reading are"young adult" authors. Now, I'm not particularly young any longer (mid-30's-ish these days) and I'm not even particularly adult. However, having read along as Justine Larbalestier finished the third book of her trilogy and seen the eager comments from her young (I assume) fans, I thought I'd find out what goes into a good young adult novel these days. It was more of an curiosity satisfier than looking for a good book.

The Australian release date for Magic's Child came and went without it appearing in my local Border's — they still haven't got it on the shelves when I checked today — so I did what every decent person with a credit card would do: ordered the series of three books from Amazon.

The Books

I figured you can't just dive in and read the third book of a trilogy, so I read all three, Magic or Madness, Magic Lessons and Magic's Child. They were great fun.

Short version: 8 or 9 out of 10 from somebody way outside the target demographic.

I read fairly fast and at 270-odd pages each, the books felt very short, but I guess this isn't atypical for the genre (based on a rough sampling of books in the teenage section of the local bookshops). Since the timeline of the entire trilogy is only one and a half weeks (with the exception of a jump right at the end of book three), reading one book a night didn't feel like I was rushing the story at all.

Very hard to give much of a synopsis of the storyline, since so much is revealed in a way that is contrary to where you think it is going as you read along. However, generally, the books follow the adventures of three teenagers who have magical powers, but in a universe where magic is not a wonderous gift, but more of a curse — both using it and not using it have grave consequences. There seems to be not a lot of upside to having magical powers in this particular world, beyond short-term gratification, so the concept gives support to a great story about the three protagonsists learning about the wider implication of their "gift" and each dealing with it in their own way. The trade-off between short-term pleasure and long-term responsibility is at the front of the decisions throughout and I think Larbalestier has done a great job of capturing how people of that age might try to deal with the problems. They want to be grown up, but sometimes they just want to be kids, too.

The three main characters were just annoying enough that I figured they had to be well written. Likeable in most places, but you want to throttle them every couple of dozen pages or so. Pretty much normal teenagers, from my experience.

The books are set jointly in New York, USA and Sydney, Australia. Larbalestier is an Australian, married to a Texan (Scott Westerfeld), who lives in both cities. I usually cringe a bit when I'm reading Australian writers writing about Australia for overseas readers (or worse, movies that try to do the same — some of them are just plain awful). However, in this case, I think she's captured the differences between the countries without making either culture seem freaky. There's even some quite realistic-sounding scenes about life in Aboriginal camps and outback townships. The protagonsists tease each other about their different ways of speaking, but it highlights the differences without making them seem wrong. I am (clearly) not a writer, so it's hard to capture quite why this works in this case, for me, and not always in other books.

Since I travel a bit between Australia and the US for work and I love New York (and live in the northern suburbs of Sydney), the descriptions about the differences between Manhattan and Sydney really resonated. It's a lovely city, but it's so different in many ways. Their (the United States peoples') love of all-day breakfasts and serving sizes that could feed a small family of four alone, is something that I have pegged as iconically dentifying about that country and it's one of the many small differences brought out as the characters move between the two countries.

I've been struggling for a few days to put my finger on exactly why I like these books. The storyline isn't particularly complicated. I think it's the characters. Setting aside the slightly flukey setup that all three of them met up in the same ten day period that they had to make life-and-death decisions, which I found a little contrived at first, they are basically very human people. They have real and different interests: The boy, Tom, has an interest in fashion and creating clothes, which is unusual but doesn't feel out of place. One of the girls, Reason, keeps order in her thinking through mathematics and problem solving, so the Fibonacci sequence and perfect numbers put in a regular appearance (making this another entry on my list of books with cool female lead characters who are mathematicians in some sense). The other girl, Jay-Tee is the American and more of a nightlife and party girl. Each characters interests and thinking was consistent and fit in with their behaviour throughout. I like characters with a some depth, but I hate it when they seem to have been brought up with ridiculously improbable and fortuitious things happening in their childhood or present. Okay, in this case, some of the characters have magical powers and that's bordering on the improbable. But the rest of their experiences weren't completely far-fetched. The short verison is that I prefer intelligent, ordinary background characters to Ritchie Rich-style protagonists.

I also really enjoyed the frequency with which I would just start to draw conclusions about one of the characters and my assumption would be challenged (and turn out to be wrong). The timing here was uncanny — I think Larbalestier has a good intuitive sense of how fast the reader is going to form an impression, let's it just start to take root and then has a good laugh to herself as she removes the chair you're sitting on. Either that or she needs to get out of my head, because it was uncanny. This wasn't so apparent in book three as in the earlier books, though, so either I was becoming more wary, or by the time the third book was written, we already knew too much about the characters for much to be surprising. Still, there were a few nice moments of timing even in the third book and it's a writing style I'm going to want to think about a bit more: how does it work so effectively here?


Would I recommend reading this series? Absolutely. I really enjoyed them a lot more than I expected to.

Would I recommend buying them? Harder to say. If you're me, maybe not worth it. Books are not cheap these days and these three were a bit short for three volumes. On the other hand, if I was a teenage me, I would beg somebody to buy them for me or save up my money and go for it (of course, how would I know I liked them so much in that case? And wouldn't Justine Larbalestier be too young to be a published author back then... hmmm). If I was a parent looking for a present for my well-behaved, all her homework done on time, child: definitely.

Syndicated 2007-04-24 00:02:56 from Malcolm Tredinnick

Documenting Helps Design

As a counterpoint to yesterday's quote about designer's being intelligent, here's one I ran across today.

"Before long I figured out that if Caroline [Rose, a technical writer,] had trouble understanding something, it probably meant the design was flawed. On a number of occasions, I told her to come back after she asked me a penetrating question, and I revised the API to fix the flaw she had pointed out. I began to imagine her questions when I was coding something new, which made me work harder to get things clearer before I went over them with her."

This is Andy Hertzfeld in his fantastic book Revolution In The Valley, which I recently bought and am slowly reading. Caroline Rose was writing the first version of the early Macintosh developer documentation in mid-1982.

Good design doesn't happen in a vacuum. You need to road test your decisions from time to time.

Syndicated 2007-04-07 19:41:52 from Malcolm Tredinnick

Odd Python Fact

Using the long weekend to get some intensive hacking done, I'm converting Django's internals to be more transparently unicode aware. All this character encoding twiddling has me thinking about performance, so I've been writing lots of little test programs to time features.

One unusual result that popped up this afternoon concerned reading a UTF-8-encoded file. Contrary to my intuition, this version:

  data = open(filename).read()

was consistently a little bit faster than this version:

  data = codecs.open(filename, 'r', 'utf-8').read()

Admittedly the differences were generally (much) less than 5%, in favour of the first version, but I was a little surprised there was any real difference at all. I'm not worried by this result, but I would have guessed incorrectly.

In both cases, I'm reading in the data and converting it a unicode string. I was running it against some examples I had lying around from Markus Kuhn. The results were consistent if I changed the order of the tests or intermixed them. Aliasing codecs.open to a global variable sped up the second method very slightly, but not enough to catch up. I was careful to pre-fill the disk buffer cache and run each test enough times in a loop for any noise on a single run to be absorbed.

Turns out, the results are closest (essentially identical speed) for files that have mostly one byte per character (pure ASCII files being the fastest) and diverged the most for more complex characters. The runic poem, with lots of three byte characters, and Greek text, which is entirely two byte characters were the most divergent.

Syndicated 2007-04-07 19:26:47 from Malcolm Tredinnick

Software Design Responsibility

Being a public holiday today, I spent the morning lazing in bed and ended up re-reading most of Chris Crawford's book, On Game Design. It's a fun read from somebody who has both experience and opinions.

It also contains a passage that stuck with me the first time I read it and has guided a lot of my design thinking since then (from chapter 18):

"Some people think that open mindedness requires a deisgner to hear out every idea, to give every suggestion its day in court. This isn't noble; it's stupid. Seriously considering every idea that drifts by isn't a sign of open mindedness; it's an indicator of indecisivness. A good designer has already thought through all the basics of the design and so should be able to reject a great many ideas without much consideration, To put it another way, you should already have considered most of the ideas that are put to you; if somebody surprises you with an idea you didn't think of, you should consider it a warning sign that you haven't thought through the design carefully enough. If the rgeat majority of ideas that are offered you have already gone through your mill, you should have no problem rejecting them without much consideration. Other people will consider you a narrow-minded prima donna for doing so; let them. Your job is to build a great design, not gratify your co-worker. Be courteous, but concentrate on doing your job."

I'm not in 100% agreement with this as it applies to Open Source development. There are many areas in a project where the primary developers and designers mentaly or explicitly mark an area as "we'll work that out later" or "to be revisited when we have time". Design discussions in those areas are often fruitful and enightening to everybody.

In many areas, though, the main designers usually have thought through a lot of the decisions and have developed an intuition about what works, what won't and what direction they want to head in. I do think this sort of approach to open mindedness is only applicable for reasonably well established designs by developers with a certain track record of success. Something in the early stages of development or being as a first project should welcome holistic reassessment.

It is not incumbent upon a software package maintainer, even in Open Source circles, to continually revisit and rejustify every decision whenever somebody new wants to challenge a particular case. That is ineffective.

When reading through source code, you can often work out, without too much difficulty, the design thread running through various decisions. Initially, accept that as gospel. Later, as you become more familiar, look for areas of inconsistency. Does the inconsistency matter? Can it be reconciled? Is it actually a cause for problems? True sharp edges or ill-fitting pieces exist in most applications. Sometimes it's best to just acknowledge they are there and move on. Sometimes, you can smooth them off with a bit of a rewrite, although this may force some changes on the users, too. Often, the number of inconsistencies are not as great as people might think. Any number of alternative solutions may not be implemented or even explored in great detail; because they do not need to be. Once you have one solution that fits your design approach succesfully, it's usually pragmatic to move on. Iterative improvements will still be made, but radical design changes aren't as necessary as some people would like to believe.

Finally, the closing sentence in the above quote is an important responsibility for the designer:being polite never killed anybody. Soliciting suggestions, even though you may have already implicitly considered many of them already is a tricky task. You need the haystack, for it contains the one needle that fixes an important problem. Encourage contributors, but ask them to have realistic expectations, too.

Postscript: I probably didn't make it clear why this quote from Crawford has influenced my thinking. It caused me to think.. Because I don't completely agree with it, yet can see some elements of wisdom there, it has made me think a lot about when design discussion are useful and when a project design leader should cut off the discussions and pick a path.

Second postscript: Turns out I've blogged about this quote before (see October 25 and 27 entries on that page).

Syndicated 2007-04-06 21:32:24 from Malcolm Tredinnick

Australian Open Content Licensing

The proceedings of a 2005 conference, "Open Content Licensing: Cultivating The Creative Commons", held at Queensland University of Technology are now available.

I've only read a few articles so far, but the contents look interesting and read well. I originally noticed this via Glynn Moody's "open..." blog and he made a throwaway remark wondering why it took so long to produce. These are well-edited articles. Given the caliber of the speakers (some law professors, judges, lawyers, ...), it's not surprising they are busy people, so a bit of time for the back-and-forth is not unexpected. The results seem worth the wait.

One thing I did note about the list of speakers, though: nobody that I recognised as representing the Australian Open Source community. Yes, Open Source development is not the same as Creative Commons production, but Open Source contributors do generate both a lot of Creative Commons content and tools for working with said content. They aren't completely disjoint fields.

Syndicated 2007-04-03 20:04:29 from Malcolm Tredinnick

105 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!