Tuesday, 3 September 2013

On Interface Design

I recently watched Don Norman talk about design's three levels of perception and wondered how well this might translate to software design. In short, we seem to appreciate interacting with man-made artefacts:

  1. in a visceral way, where colours and sounds and textures matter and can give us intrinsic satisfaction without us even being aware;
  2. in a behavioural way, where we seem to like things which don't require a great deal of conscious thought, but at least some level of skill (like driving, swimming or playing the piano);
  3. in a reflective way, where using the artefact or owning it elevates our self-esteem or the esteem of others.
So a car might offer its owner a great deal of visceral and behavioural satisfaction through a smooth design and a snappy gear-shift, as well as some reflective happiness by (for instance) using an electric engine (and therefore allowing its owner to see herself as a planet-loving altruist).

So how is this relevant to software? Well, it's probably obvious to anyone who's spent more than a few hours in front of a console that game developers got the visceral level of design right. It's always been a puzzle to me why so many shops whose sole point of sale is the internet (pretty much any airline website and even behemoths like Amazon at times) are so resolutely set on failing to provide people with a good shopping experience. One can only hope that companies like Testlio will one day fix that.

The next level up is probably more subtle. I remember once reading in a HCI book that nobody likes being a beginner. It's frustrating and in reflective mode it makes us feel stupid and worthless. Yet again I am perplexed at how unnecessarily steep the learning curve is for so many applications. To this day I have never seriously used any Eclipse or Visual Studio because I simply have neither the time nor the desire to learn to browse (in this day and age!) through heaps of pages of settings to unearth some obscure check box three levels deep that allows me to switch on C++11 features in the compiler. For all the pain, at least a man page + grep allows you to search through the entire documentation and at least attempt to find the relevant bits with some speed, instead of spending minutes staring at the screen like an idiot trying to remember which way you went last time.

Finally, what one wants of a piece of software (in addition to, that is, being helpful) is that it makes us feel clever using it. I'd almost like to posit that software which gets levels one and two right, gets the last one for free. Any reasonable vim user can change pretty much anything about the text before them without ever lifting their fingers off the keyboard and that is viscerally satisfying. Basic commands, which also have the highest frequency, are easy to imprint in one's muscle memory, so on a behavioural level one can step out of the lkflsnfdfnaldkfj phase pretty quickly. And in the long run, using vim requires a certain level of skill and dexterity, which can make the people using it secretly feel good about themselves. There's a reason people wear T-shirts sporting ":wq" and not "I love Office Word TM".

In any case, I think Don Norman's framework might constitute a good starting point in creating the next trending application.

WPA Wireless on Ubuntu 13.04 Minimal

A few days ago I installed Ubuntu minimal and connecting to an open wifi access point simply and automagically just worked (TM). Being the sensible person that I am, I thought I wouldn't upset the wireless gods by questioning such a wonderful and unexpected gift. My happiness was short-lived. When I moved location to somewhere with a WPA2 protected wifi, I realised that Ubuntu minimal does not come with the wpasupplicant package installed, which is required for connecting to WPA-encrypted hotspots. So here is my 'lesson learned' note to my future self, should I ever need to solve this problem again.

On Ubuntu 13.04 at least, there seems to be a service called networking (/etc/init.d/networking) which is installed and running by default. This service reads the config file /etc/network/interfaces which defines how Ubuntu ought to connect to the Internet. To connect to an open wifi access point, the file can be as simple as:

# The primary network interface
auto wlan0
iface wlan0 inet dhcp
   # wireless-* options are implemented by the wireless-tools package
   wireless-mode managed
   wireless-essid dlink

where wlan0 is my wireless network interface and dlink the access point name. The line beginning with 'auto' means this network interface should be brought up on boot and the line after that means obtaining an IP is delegated to dhcp. All nice and simple.

Now, if you have a WPA encrypted hotspot, the networking service apparently delegates the authentication to a process called wpa_supplicant which can be invoked from the command line quite simply like this:

wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

where the -B option asks it to run in the background as a daemon, the -D option tells it to use the generic wireless card driver "wext" (which apparently should work with most cards), -i identifies which network interface it should configure and -c indicates the configuration file. This configuration file needs to be generated once, manually, like this:

wpa_passphrase YOUR_ESSID YOUR_PASSWORD > /etc/wpa_supplicant.conf 

where wpa_passphrase is another utility that comes with the wpasupplicant package. Once the configuration is done, you can restart the networking service to re-read the /etc/network/interfaces file (sudo restart networking) or simply reboot the computer. That's it. You should now be happily connected to the Internet.

Good to know

This configuration seems to work on a fresh Ubuntu Minimal install with just i3, the X server and slim as login manager installed so no need for Network Manager (package: network-manager-gnome) or other nonsense. The annoying thing is that I got distracted by some red-herrings while trying to get things to work which to this moment I haven't figured out. When invoking wpa_supplicant from the command line I got a few errors/warnings in the console along the lines of:
  • ioctl[SIOCSIWENCODEEXT]: Invalid argument.
  • ioctl[SIOCSIWFREQ]: Device or resource busy.
  • wlan0: Association request to the driver failed.
which had me chasing wild geese for a while but in the end proved irrelevant: the connection worked just fine.

Another red herring was a strange problem by which, when doing everything from the command line, the connection worked after the first time it acquired a dhcp lease on an IP address but not after. So doing:

sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
sudo dhclient wlan0

ping www.google.com # YAY we are connected

worked fine, but upon stopping and starting the wpa_supplicant process I got the error "Network unavailable", which went away only after doing

sudo dhclient -r wlan0
sudo dhclient wlan0

to reset the dhcp lease and get a new one. Why? No eye deer. Then again, I probably shouldn't push it with the wifi gods..

Friday, 7 June 2013

Which Cog?

Between reading copious amounts of Joel on Software and trying to create a Stack Overflow Careers 2.0 profile, I was suddenly reminded of a recent Economist article which deplored the amount of training (or lack there of) employees are offered by their companies. Hiring managers, it bewailed, like to think of interviewing as shopping around for spare parts: ideal candidates ought to be perfect fits to whatever component of the corporate machine is missing a cog.

Unfortunately, there is no chartered standard for programming professionals. Most people don't come tailored to the job they are recruited for. Specialists in particular technologies may come close but it seems that for the majority of entry- and mid- level positions, one is presented with but a vast collection of generically skilled individuals, all of which will require some amount of chiselling to fit the job spec. So perhaps the best one can hope for is that they are sufficiently malleable and intelligent and enthusiastic etc that they can quickly be moulded into what is required.

But anyway, my actual point was that one must seek this in one's employers: that they offer resources for learning and in more than name.