Tuesday, March 16, 2004

Tim Bray on Dynamic Languages

Tim Bray has just joined Sun (congratulations, Sun). One of the interesting snippets in the middle of the article was:


In fact I personally believe that Java’s share of enterprise software will decline, but not in favor of anything from Redmond. I think that dynamic languages (Python and friends), particularly in conjunction with Test-Driven Development, are looking more like winners all the time. They generally are cheaper to program in, run just as fast, and have fewer bugs; what’s not to like?

I wonder if Tim’s in a position to help Sun see that the drive to make J2EE heavier and heavier will ultimately hurt them? There’s a definite groundswell out there of folks pushing back against the monster that is modern enterprise development (just look at the spread of the Groovy meme, and things like Spring). Will companies like Sun and BEA listen, or will they simply become less relevant? I’m hoping that Sun at least listens, but I’m not holding my breath: they’ve got an awful lot invested in the J2EE, and seem to think that the only way to move into the future is to add even more features.


The best thing that they could do for themselves and for the development community would be to scrap at least half of J2EE, and move back to a more lightweight, declarative style of applications development. Perhaps the 1.5 metadata stuff is a Trojan horse to let them do that, but I suspect not.

We Got a Jolt Award!

Sue Spielman just called. Apparently the Pragmatic Starter Kit just won a Jolt Productivity Award. I’m blown away: we had some stiff competition, and the books haven’t been out that long. I’m thinking that the judges were probably thinking what we’re thinking: these kinds of basic skills are becoming crucially important if we’re to keep software development competitive in this country.


Anyway, a big “thank you!” to everyone involved, and congratulations to the winners.

Thursday, March 11, 2004

Nice Interface in a Storm

My Powerbook’s hard drive came to a sticky end yesterday. Almost literally. Starting in the morning, it seemed to “stick” every now and then, and applications would hang until it came back. The sticking got worse and worse until eventually everything just died.


Down to the Apple store, and Tony in the Genius Bar said “before we wipe it, why not take an full disk copy to be on the safe side. It’ll probably cool down enough overnight that you’ll be able to get to the disk.” And he recommended Carbon Copy Clone as a way of getting a hard drive copied onto and external firewire drive.


And it all worked. I downloaded the software, booted up in the morning, and copied 40Gb onto an external LaCie drive. My hard drive resisted a few times, but judicious tapping of the case seemed to bring it back to life. When it finished, I rebooted off the firewire drive, and was able to create a book PDF to send to the printers before the weekend.


Along the way, I came to admire the Carbon Copy Clone interface. It’s trivial: it basically asks you where to copy from and to, and gives you a “start” button. But what makes it great is the log window. You see, underneath the covers, CCC simply uses BSD commands to do its work (things like ditto and bless). And in the log window, it shows you these commands as it executes them. First, that means that as the backup is happening, you can track the progress. I had a couple of terminal windows open to I could see directories being created in response to the commands that CCC was issuing. That made it easy to tell when the hard drive had stalled.


But it’s also a great interface because it taught me two or three new commands: things I hadn’t tried before. After I’d got a new loaner Powerbook powered up, I found myself using ditto a lot to install particular applications and directory trees.


So, for me at least, CCC is a really good example of a mixed-mode interface. It’s a GUI when I needed it (I have to admit to being panicky when the drive failed, and the idea of pressing a single “start” button to make an archive was appealling). At the same time, it also encouraged me to understand what wasreally happening under the covers, knowledge I put to good use later in the day.


And now I’m thinking about the applications I write. Do I perhaps hide too much of what’s going on from my users? If I made it more explicit, would it help them become more proficient?


Anyway, kudos to Mike Bombich for Carbon Copy Clone. (And thanks to Tony at the Willow Bend Apple Store for the loaner machine).

Saturday, March 6, 2004

Our Third Title!

If I’ve been distracted recently, it’s because Andy and I’ve been heads-down getting our third book finalized. When we first started Pragmatic Unit Testing in C# with NUnit, we though it would be a fairly light rework of the JUnit book. We were wrong. Instead, we’ve found that we’ve rewritten entire chapters, and heavily modified much of the rest.


The good news is that with this book we’re absolutely at the leading edge. We were tracking the NUnit team as they added whole new sets of features (check out categories as a great way of grouping tests), and Andy’s been working closely with Charlie Poole (thanks, Charlie!) to make sure we’ve been capturing the spirit of what they’re releasing.


We’ve also decided to try an experiment: this time we’re releasing the PDF version while the paper book is going into production. Folks who buy the PDF now will be able to get the standard combo discount ($12.50) on the paper book when it arrives from the printers.

Tuesday, November 25, 2003

Mechanism and Policy

What can we do about the tradeoff between flexibility and convenience in interface design? Do users want us to provide just the means to get the job done (the mechanism), or do they want to be told how to do that job (the policy)?


I’ve been reading Eric Raymond’s “The Art of Unix Programming” (a good book that could have been great had he managed to find a more balanced voice). In the section on user interfaces, he reminds his readers of the decision of the designers of the X windowing system not to impose look-and-feel constraints on X applications. The designers say that X supports “mechanism, not policy.”


The X windowing system provides the underlying graphical user interface for most Unix systems (the Mac is a notable exception, as we’ll see). Perhaps surprisingly, X itself offers almost no user-level features. Instead, it concentrates on providing a set of low-level primitives for drawing windows and filling those windows with graphics and text.


In order to make X usable, you need to supply an application program called a “window manager.” This hooks in to X and handles events: for example, X may create a window, but the window manager can decide where to place it on the screen. To fill windows with widgets (standard interface components) you need another layer of software, the various X toolkits.


The designers of X felt that building a lot of behavior and standard interaction models into X would limit the user of X. Instead, they provided a (fairly low-level) API, and allowed their users to build any style of interface they wanted. They provide the mechanism, but enforce no policies on how that mechanism is used.


By contrast, the windowing systems from Microsoft and Apple (as well as those from Be and NeXT) were rich in policy. The windowing systems imposed a number of look-and-feel constraints and behavioral similarities between applications. There were even documents for application designers dictating justhow their applications should look and react.


So what are the tradeoffs? Raymond says:


The difference in approach [between X and Mac/Windows] ensured that X would have a long-run evolutionary advantage by remaining adaptable as new discoveries were made about human factors in interface design—but it also ensured that the X world would be divided by multiple toolkits, a profusion of window managers, and many experiments in look and feel.


Ignoring the interesting spin on “evolutionary advantage” (I don’t often see X applications edging out Windows and Mac ones on my client’s desktops), the point is a good one. By keeping the underlying framework free of particular implementation decisions, you make it more flexible. This flexibility is a two-edged sword. One the one hand, it allows multiple competing ideas to duke it out: the winners will be selected by their users, and not just by developers (perhaps this is what he meant by evolution). But on the other hand, it also leads to the fragmentation he describes.


But he’s also being disingenuous here: the reality is that it isn’t the X windowing system itself that’s adapting at all. Instead, it’s the efforts of hundreds of people writing the stuff on top of X that has provided the ongoing evolving interfaces he describes. Underneath the covers, X is basically the same old X. In some way, you could say that all their efforts were expended making up for stuff that X didn’t provide itself.


So, by providing policy, the designers of Windows and Mac interfaces have provided their end-users with a consistent look and feel, and a base set of application behaviors. By instead focusing on mechanism and ignoring policy, the designers of X allowed developers to experiment, but gave the users of X applications a very inconsistent interface experience. Arguing one approach is better than the other is pretty pointless: they’re just different.


What can we learn here when it comes to applications and designs?


When I first started thinking about this, I was reminded of the audience discussions that sometimes erupt when I talk about Naked Objects. A Naked Objects application exposes the core business objects of an application directly to the end user. They can manipulate these in any way the objects allow: there is no overall application GUI imposing a certain way of doing things. A Naked Objects system provides mechanism, but little in the way of policy. When I describe this, some folks have a strong reaction against the idea. “Without high-level policy imposed by the GUI (scripting, or series of modal dialogs that have to be filled in in a proscribed order) how can we ensure our users do everything that needs to be done?” they ask. And its a good question. Experienced users, folks who understand the domain, love Naked Object systems because they get the control and flexibility they need to get the job done. But inexperienced users can be confounded by that same flexibility—”what should I do now?”. (In a way, this also relates back to the Dreyfus model of skills acquisition: beginners need to be guided, while experts need to be left alone to get on with their jobs.)


In the Naked Objects world, it turns out that there’s a compromise. Because the Naked Objects are themselves just Java business objects, there’s nothing stopping you putting a more conventional view and controller on top of them, converting your Naked Objects application into a conventional GUI or Struts-style app. And, because the objects are the same beneath the covers, you could probably arrange to run both the Naked Objects and conventional application at the same time. The conventional application would have less flexibility and functionality, but would be easier for casual users. The Naked Objects system would have full flexibility for more experienced users.


In a way, this seems like the OSX way of doing things. Apple have taking a Unix operating system and wrapped it with a fantastic user interface. Not only does this interface work at the application level, but it also gives you the ability to do most of the administration of a box without dropping to the command line or editing files. I love this: I’ve spent all too many years administering Unix boxes the hard way. But what I love just as much is that when I need to, I can still get down and dirty. It’s the best of both worlds: regular users get a great, easy-to-use interface, but power users get to strip away the facade and work down at the lower levels.


Increasingly, I think the “one-size-fits-all” mentality is going to break down. We need to think about delivering our application functionality using multiple modalities, each targeted at specific user communities. Mechanism versus policy is one axis we need to consider, and one that’s relatively easily addressed in a well-designed application. We don’t need to decide up front whether to deliver one or the other; instead we need to work out how to provide both.

Tuesday, October 14, 2003

My Kind of Warranty

Over on the ruby-talk mailing list, why the lucky stiff just announced a new version of the Syck library (it reads and writes the excellent YAML format). In his announcement, he includes a warranty and a disclaimer:


  • Some of this code is still beta software and here’s my disclaimer as far as that goes: I’m not going to say “Use at your own risk” because I don’t want this library to be risky. If you trip on something, I’ll share the liability by repairing things as quickly as I can. Your responsibility is to report the inadequacies.

That, my friends, is what a warranty should be.

Monday, October 13, 2003

Tangled Up In Packing Tape

It’s been a busy couple of months here as we prepare to launch our new book-printing imprint, The Pragmatic Bookshelf. We spent the year writing the first two books, Pragmatic Version Control andPragmatic Unit Testing. The interesting part was what happened next.