10.13.2009

CLI in web based applications

I was recently asked to do a prototype for migrating some, well, lets say not very recent user interfaces to a more web based view on them. The first test was to just make sure that a web based application could perform fast enough and we didn't need to go swing. For the record, I'm not a swing fan because of all the layout finagling and I sure don't like GWT doing all my work for me. Call me a purist or an idiot, your call.

I check out what the users want and come up with a nice thin app using JQuery on the front end communicating via REST services responding with JSON for the datasets. Pretty standard stuff. Nothing too revolutionary there. If you're not using REST, I'd recommend it but I can get on that soapbox later. What was interesting was the request that these workers prefer to use keyboard shortcuts. In essence, I was asked to make a web based application that didn't use a mouse. Pretty interesting and different than usual.

I toss together this prototype and demo it - first suggestion was could I make it so there was just a text box interface where users could type in shortcuts and then use key combinations to drive functionality.



The solution I ended up with uses the hotkeys plugin for jQuery -
It is crazy easy to use, here is binding the f4 key to execute whatever is typed in the text window:


$(document).bind('keydown', 'f4', function(){ executeCLI();});

function executeCLI()
{
var cliString = $("#prs_cli").val().trim();

//Process cliString, call more functions, etc
}


Its crazy simple to bind functions then to key combinations. You can even bind key combinations, i.e.

$(document).bind('keydown', 'ctrl+c', function(){ executeCopy();});


Why would anyone do this? At first I asked the same question. The mouse is there, use it. But then I started using the CLI interface for the web. Think about how faster you, the maven, are with CLI? Think about the experienced user being able to interact with web apps this way. Pretty cool and effective stuff.

So check out hotkeys and maybe think about some CLIs for your super users of your web apps.

1 comment:

  1. Very cool stuff. With regards to the why would anyone do this question, I refer you to the Google applications: Mail, Reader, etc.

    I know with Reader I virtually never touch my mouse (Neal Ford isn't shy about pointing out that the keyboard is faster for power users than the mouse on most tasks). I actually wish more sites had keyboard shortcuts or browsers had a standard way of navigating across links with the keyboard...

    ReplyDelete