Christine Dodrill on the Universal Design

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

She has her own terminology:

State – What is true now? What was true? What happened in the past? What is the persistent view of the world?

Events – What is being changed? How will it be routed?

Policy – Can a given event be promoted into a series of actions?

Actions – What is the outcome of the policy?

Mechanism – How should an event be taken in and an action put out?

Policy seems a bit confusing, but sometimes there is a reward if you expend the effort to understand someone else’s model.

The code sample seems to run into Krubner’s First Law Of Programming, which is that any function that has an explicit “return” function/keyword will be a mess:

m.UserCommand("NICK", c.normalFloodLimit, function(state, source, args)
  if #args ~= 1 then
    return actions.failCommand(source, "NICK", c.errCommandBadArgc(1))
  end

  local newNick = args[1]

  if state.findTarget(newNick) then
    return actions.failCommand(source, "NICK", c.errNickInUse(newNick))
  end

  if not utils.legalNick(newNick) then
    return actions.failCommand(source, "NICK", c.errIllegalNick(newNick))
  end

  return {actions.changeNick(source, newNick)}
end)

Three return statements! What a nightmare! I wrote a ton of code like this back when I used to write a lot of PHP code. This is exactly what I’ve been getting away from in recent years.

The post gets much more interesting in the 2nd half:

All Hoon computation takes [the] same general form. A subject with a fomula that transforms that subject in some way to produce a product which is then used as the subject for some other formula. In our next tutorial we’ll look at some of the things we can do to our subject.

Subjects applied to formulae become results that are later applied to formulae as subjects. Events applied to policy emit actions which later become events for other policies to emit actions.

Because of this design, you can easily do live code reloading, because there is literally no reason you can’t. Wait for a formula to finish and replace it with the new version, provided it compiles. Why not apply this to the above ideas too?

“Subjects applied to formulae…” sounds like the normal recursion that makes computing possible (in the sense of a Turing Machine). But “Events applied to policy emit actions which later become events for other policies to emit actions” is somewhat more interesting, as it seems to be referring to recursive side-effects.

I wish there were more details on that last idea, but the post ends.

Source