A Trifle Absurd
Matthew Morgan’s software notions
Scripting Automated Tests
27 February 2006 at 13.08 • in Trifle, ProgrammingWhen using AppleScript, most people see GUI Scripting as a last resort: it’s a lot nicer to say “select first collection” than “select row 1 of table 1 of scroll view 1 of splitter group 1.” But the very qualities that make GUI Scripting unattractive—such as fragility, and dependence on explicit mouse and keyboard actions—make it a great tool for automated testing. I don’t even have to wait till Trifle is scriptable: I can write tests now.
AppleScript, though, is far from my favorite programming language. Thank goodness there’s appscript, a bridge that lets you use Python to script AppleEvents. Appscript can’t paper over all the oddnesses of AppleScript, but life becomes much easier with all of Python at my disposal.
For instance: I can drop down to the Objective-C level to verify something using PyObjC. I can use any of several test frameworks. And I can verify saved Trifle documents using Python’s XML support. This is Python’s sweet spot: libraries to connect to just about everything.
A Year After Switching
23 February 2006 at 20.29 • in MacIt’s been a year since I switched to the Mac. I was hoping for a better user experience, and I got all that and more. OS X and its included apps are a joy to use (well, we don’t talk about the Finder, right?). The Unix underlayer keeps me happy in ways the old Mac OS never could. Cocoa is a fun and productive framework to program in. And I get to use some top-notch applications:
I thought I was happy with web-based RSS readers, but NetNewsWire changed all that. It’s the perfect example of an application that Just Works. On the strength of that, I bought MarsEdit as well, and I’m using it to write this post.
I’m just beginning to use VoodooPad Lite to keep notes about Trifle. I used to keep a local wiki on my Linux box for stuff like this, but the edit/view modality was too annoying. VoodooPad solves that nicely; I’ll probably buy the full version soon.
And then there’s Quicksilver, probably the single best reason to switch to the Mac. Try it, use it, learn more about it.
I wonder how I should celebrate the one-year mark. Now that my iMac’s warranty is up, there’s nothing to stop me from getting a second display and doing some screen spanning…
The Agony and Ecstasy of Cutting Features
22 February 2006 at 19.31 • in TrifleI’m making a round of feature cuts to keep Trifle’s schedule sane. Cutting features is tough: the goal is to cut as much as possible to make the schedule tractable, but leave in the essential and distinctive features that make Trifle appealing. There’s an upside, too: it’s liberating to let go of feature baggage and see a schedule that looks doable again.
Some features are easy to cut. Group-by-column doesn’t fit Trifle’s nonhierarchical model. Automator actions will be easy to add later. Comment popups are just window dressing.
But of course there had to be a big difficult cut that’s hard to do but probably the right thing. And that, in this case, means rules. Rules are central to what I want Trifle to be. Rules are phenomenally useful. And rules need to be cut from Trifle 1.0 because (a) they’re the biggest schedule risk, (b) they need to be done right or not at all, and (c) Trifle is still a useful application without them.
Rules are a major schedule risk because their design is still awfully murky. I don’t even know whether they should be imperative or declarative—at this point, I dislike both choices. But in whatever form they take, rules will require a bunch of extra UI, which means more design work, and more potential slippage.
Rules need to be done right or not at all. If I pick a rule model and a UI and ship them with Trifle 1.0, and later realize they should have been completely different, I’m still stuck supporting the original model.
Trifle will still be a useful application without rules. You’ll still be able to make and manage lists and tables, and do simple calculations like totaling a column. There just won’t be that extra layer of automation that rules provide. Even without rules, though, normal scripting support should allow for plenty of automation.
So here I am trying to talk myself into a major feature cut. It’s discouraging, but I think it’s the right thing. At least I can console myself by dreaming of rules in Trifle 2.0.
Mode Mitigation
15 February 2006 at 12.07 • in ProgrammingAs I mentioned yesterday, table-centric apps seem to be stuck with a modal interface. But most of them try to mitigate the mode problem, so you’re not left double-clicking on cell after cell to get into edit mode.
A few examples are in order: Spreadsheets let you enter edit mode via any printable keystroke. Mori lets you arrow between rows while staying in edit mode. OmniOutliner lets you edit text with a single click.
Wait, if OmniOutliner just lets you click once to edit text, is it still modal? Yes. Several alphabetic characters are used as select-mode keyboard shortcuts. For instance, pressing E in select mode switches to edit mode, rather than typing an E. And other keys behave differently depending on where you are: pressing return in a note inserts a line break, but pressing return in a header creates a new header. But on the whole, OmniOutliner does a fine job of mitigating the modal mess.
And mitigation may be all we can hope for. Editing tables in Word is basically modeless, but that causes trouble on its own. There’s no distinction between selecting a cell and selecting all the text in a cell, so there’s plenty of opportunity for misunderstanding between user and application. Maybe we’re stuck with modes after all.
Modes of Table Editing
14 February 2006 at 19.54 • in ProgrammingThere was a time when editing text entailed switching between command mode and edit mode. But we’ve moved on (except for a few stalwart vi users), because modal interfaces suck. So why do table-centric applications like Excel and iTunes still use modes so pervasively?
For one thing, there’s a conceptual difference between selecting a cell and selecting the text inside a cell. In an iTunes playlist, you delete a song by selecting a table row and pressing delete, but you delete a song’s genre label by selecting the text in the genre cell and pressing delete.
A mode switch also makes a convenient transaction boundary. In Excel, switching out of edit mode triggers recalc. In most table-based apps, leaving edit mode records an undo action.
I can see why modes persist in this context; there’s no easy way to get rid of them. I keep thinking there must be a better way, though. Moving from the block cursor to the insertion point helped eliminate text editing modes. Is there a similar innovation that can save us from table editing modes?
Choosing an Embedded Language
10 February 2006 at 17.04 • in Trifle, LanguagesEvidently I’m doomed to have to choose among programming languages over and over again. This time I need a language for Trifle’s rules. The qualifications:
- Abstraction mechanisms — not just simple expressions.
- Simple, approachable syntax — People with only a smidgeon of programming experience should be able to do basic things with it. (There will be a dropdown-list UI wrapper for those with no programming experience.)
- Sandbox security — rules will be saved in Trifle documents, and I don’t want macro viruses on my hands. Those who need more power can hook into Trifle via AppleScript or another external scripting language.
- Small and embeddable — in particular, a clean and usable C interface.
F-Script and Tcl fail the syntax test; regrettably, so does Scheme. AppleScript isn’t sandboxed (plus it’s just a little too funky for its own good). The plausible prospects, as I see them, are Lua, Io, and JavaScript.
Lua was made for this scenario. It’s tiny, easy to compile, and simple to embed. Somehow, though, it always manages to rub me the wrong way. For instance, the distinction between dot and colon for accessing objects constantly trips up folks coming from other languages.
Io was inspired by Lua, but emphasizes simplicity and regularity of syntax (perhaps to a fault). I find it very attractive, not least because Io expressions look an awful lot like spreadsheet formulas. But it has a small user base, and still hasn’t quite hit 1.0.
JavaScript is the elephant of this bunch (or would that be the rhino?). It’s probably bigger than Io or Lua, but it’s available in a standard Mac OS X library (WebKit), so I wouldn’t have to ship it. The syntax is full of C-isms, but it’s so widely known that wouldn’t be much of a problem. And the security sandbox is heavily tested.
Booklog: January
9 February 2006 at 12.26 • in BooksFiction
- Gaudy Night — Dorothy Sayers
- Harriet Vane is back after a few novels of absence, and gets a mystery to solve (mostly) on her own. A many-layered story where the mystery is good, but the subplots are even better.
- To Say Nothing of the Dog — Connie Willis
- One of my favorite novels; it’s Connie Willis at her funniest. I picked the perfect time to reread it: now I understand the Gaudy Night references.
- Man in White — Johnny Cash
- An historical novel about Paul the apostle, written by Johnny Cash? I was too intrigued to pass that up. He certainly did his history homework, but the writing itself is clunky.
- Noisy Outlaws, Unfriendly Blobs, and Some Other Things That Aren’t as Scary, Maybe, Depending on How You Feel About Lost Lands, Stray Cellphones, Creatures from the Sky, Parents Who Disappear in Peru, a Man Named Lars Farf, and One Other Story We Couldn’t Quite Finish, So Maybe You Could Help Us Out
- A fun collection of children’s stories from people like Neil Gaiman and Nick Hornby; also known as The Book With the Really Long Title.
Other
- Shaping Things — Bruce Sterling
- Sterling crams futurism, design, and sustainability into a short book. A longer book would have been more interesting; as it is, too many ideas are tossed out, then glossed over. Still worth reading, though.
- Storyteller — Kate Wilhelm
- Writing advice mixed with tales of the Clarion writers’ workshop.
- The Little Flowers of St. Francis — Raphael Brown (translator)
- Reading this for the second time, I was struck by how truly different the medieval Christian worldview was, in both good ways and bad. The emphasis on penance and mortification seems deranged, yet some parts of the book are full of insight.
- Drive a Modest Car — Ralph Warner
- The founder of Nolo Press gives his advice on starting and running a small business. It’s well-written, and contains a good selection of fictional and real-life examples. I’ll probably buy a copy.