View-Model-Template

Jul 27, 2007

I don’t know anything about Struts 1, but Bill de hÓra’s recent post has got some interesting web-application-design tips. There were two particular bits that spoke to me:

struts-config.xml struts-config tries to capture primarily the flow of application state on the server, by being an awkward representation of a call graph. In doing it misses a key aspect of the web - hypertext. In web architecture, HTML hypertext on the client is the engine of application state, not an XML file on the server.

In other words (I think) in web applications your state in the page you’re on and taking action is about following the links (or submitting the forms) on the page. Your actions (and therefore the transitions between different states) are determined by what links and forms are on the page. But in fact, URLs should be hackable, and transitions unlimited. When you design the application what you really need to think about are the tasks the users want to achieve (and therefore the transitions that they might want to make) rather than the possible state transitions.

Whitespace in markup languages

Jul 22, 2007

I wrote previously about the, to my mind, wrong-headed use of xml:space in WordML (and OOXML), and promised something a bit more positive about how whitespace should be handled in markup languages. So here it is.

A bit of a disclaimer up front: my attitude on this topic is highly skewed by the fact I use XSLT all the time, and it has particular ways of dealing with whitespace. I happen to think that the way XSLT deals with whitespace is pretty solid, but that might just be because it’s what I’m used to.

The aim of this post is to answer the following question “when designing a markup language, what should I say about whitespace processing?”

Programming robots the feminine way?

Jul 22, 2007

I recently filled in a questionnaire that asked about the use of robots in teaching programming. (You can win a robot!) Some of the questions seemed to be particularly about attracting women into the field; I guess the thinking is that programming something that does something in the real world is more engaging (particularly for women?) than doing artificial exercises in linked list manipulation. Or something.

I like programming robots as much as the next geek, and am the proud owner of two regular Lego Mindstorms kits as well as a less complex, but more evil, Dark Side Developers Kit. Thinking around this, it struck me that there are two classes of projects you can do with robots:

  • a directive program, where you tell the robot exactly what to do (go forward for 5 seconds, turn, forward for 2 seconds etc.)
  • a facilitative program, where you define the feedback between sensors and motors, then just let the robot go

Things that make me scream: xml:space="preserve" in WordML

Jul 13, 2007

I intend to do a series of “things that make me scream” posts. Many of them will be about WordML (as in the markup language used by Word 2003) because that’s what I’m struggling with at the moment and because it’s so goddam awful. I don’t want to get into the whole ODF vs OOXML open standard-or-not debate. My problems with WordML (and OOXML) are mainly about aesthetics rather than process: I look at it and… well, it makes me want to scream. Examining what it is about the language (or implementation thereof) that prompts this visceral reaction might help in designing better languages.

So: did you know that Word 2003 puts a xml:space="preserve" attribute on the <w:wordDocument> document element of the XML that it produces and doesn’t indent its output? This is a nightmare if you ever have to actually look at the documents: auto-indentation programs (like the one in <oXygen/>) quite rightly won’t add whitespace to elements that are in the scope of an xml:space="preserve" attribute, which means you can’t use these programs to indent XML automatically.

Today's life-skills: shoelaces and playdoh

Jul 12, 2007

I learnt two new life-skills today.

First, how to tie my shoelaces using the Ian Knot. It’s very quick, and works just as well with anything with loops, such as supermarket or nappy bags.

Second, how to make playdoh. A standard recipe all over the web is:

  • 1 cup flour
  • 1/2 cup salt
  • 2 teaspoons cream of tartar
  • 1 cup water
  • 2 tablespoons oil
  • 1 teaspoon food colouring