Vincent Gable’s Blog

August 21, 2008

Are Line Numbers Just Clutter?

Filed under: Design,Programming,Usability | ,
― Vincent Gable on August 21, 2008

I think numbering every line in a source-code editor is (very mildly) harmful. It adds visual clutter; and that’s a bad thing.

Often you need to find a particular line number, say to locate a failed assert() — but every programming editor has a “Go to line#” command, which is faster to use.

Showing the line number the cursor is on is worthwhile, because almost no display space is lost.

If you have your left-hand column set to show you line numbers, try turning it off and see what happens. You may be able to focus on your code ever so slightly better.

August 20, 2008

Hardwired Strings

With every programming language/development environment I know of, you have to do extra work to make a string localizable. For example,
errorMessage = NSLocalizedString(@"This is hard!",@"");
not simply,
errorMessage = @"This is hard!";

And it’s not just extra work, it’s a ridiculous amount of work. E.g. to create an Objective-C string, you just put an @ in front of a standard C string. But to create a localized string, you have to surround your string in ()‘s, and prefix it with a seventeen character mixed-case function-name, and finally add an empty “note” for the translator. (Rarely, you may want to add a note for the translator, and it’s good that you can, but you should not be forced to write something when it is not necessary.)

There isn’t really an excuse for this; it’s just how languages have lazily evolved.

Non-localizable (“hardcoded”) strings are a huge issue, even though they are trivially simple for programmers to fix. The problem is that translators do not work with source code, they work with resource files. So when they find a “hardwired” string that must be changed in code, they tell a programmer to fix it. And that communication is slow and costly. Especially when you consider that good localizers are probably native to the place they are localizing for — meaning that having a real-time conversation involves at least one party staying up past 3AM.

I dream of a day where "this would be localized by default"; "and"("syntactic sugar for adding optional translator notes would be there too"); and creating C"literal C-strings" would be easy.

“Unicode support libraries” are doomed to institutionalized-failure, because they will never make it easier to do the right thing. It must be so easy to create a localizable program that you wouldn’t dream of doing anything else.

August 17, 2008

B-Movie Boxes

Filed under: Design,Programming,Quotes | , ,
― Vincent Gable on August 17, 2008

Computer interfaces still look like they came from the set of a 50s Science Fiction TV series. Polished metal, shiny everything. We’re fast approaching the ability in computer graphics to create any kind of space we want. Would that be a shiny shuttle interior or would it be a spacious, sunlit, gentle atrium view?

Keith Lang

I can’t recommend the book Emotional Design enough.

August 15, 2008

Members Are The Devil

Filed under: Bug Bite,Design,Programming
― Vincent Gable on August 15, 2008

More and more, I am of the opinion that a member-variable is a terrible thing to have in a class. Put more sanely, a class should have as few member variables as possible.

I have squashed too many bugs in the past couple of months, where two objects had their own fields that represented the same thing .. but then got out of synch. Only one object should ever store the same value.

I guess you could say this is database-normalization, applied to general programming. And I think in that space it makes more sense.

A corollary is, never cache a value that can be calculated, without a measured performance reason.

August 14, 2008

Only Skin Deep…

Filed under: Design,MacOSX | , ,
― Vincent Gable on August 14, 2008

Pictures showing that a nerds desktop can look like other operating-systems … at least from a few feet away.

It’s a good reminder that design is not just skin deep.

August 12, 2008

Aesthetics Matter

Filed under: Accessibility,Design,Quotes,Usability | , ,
― Vincent Gable on August 12, 2008

.. aesthetics (are) important in UI. If you begin to look at something and want to avert your eyes, the site has failed.

Hank Williams

I highly recommend the book Emotional Design, which makes this point in much more detail. A person’s emotional state has a quantifiable impact on how successful they will be at a task. Aesthetics are still the most direct way to manipulate emotion.

August 6, 2008

Distorting Text for Readability?

Filed under: Design,Usability | ,
― Vincent Gable on August 6, 2008

This is an award winning example. Compared to traditional “flat” text, the distorted text is certainly striking, looks more three-dimensional, and since it’s drawn on top of objects that would normally obscure signage it’s larger. But it can only be seen correctly from a few angles.

This example from 1939 looks a little confusing — more like a POTS sign then a STOP sign.

August 3, 2008

How to Implement Automatic Updating

Filed under: Cocoa,Design,MacOSX,Objective-C,Programming,Sample Code,Usability
― Vincent Gable on August 3, 2008

If you are about to add automatic updating to your application (and you should), then check out the Sparkle Framework before you start. I wish I had done this before I spent a lot of time writing my own automatic updating code.

A quick-and-dirty hack.

Get your application’s version number by:
[[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"];
(This articles explains setting up Xcode to bake the current subversion-number into every build.)

Get the the latest version number out of a text-file on a website:
[NSString stringWithContentsOfURL:[NSURL URLWithString:@"www.your-url-here.com/whaterver/version.txt" encoding:NSASCIIStringEncoding error:nil]];
If there is any trouble, it will return nil. CAUTION: This will block the main thread for up to 30 seconds, while -stringWithContentsOfURL: tries to access the URL.

Making it Usable

If you don’t want your program to be unresponsive while it tries to get something off the internet, try this:

- (void) updatesReady
{
   //do something....
}

- (void) synchronousCheck
{
   NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

   NSURL* latestURL = [NSURL URLWithString:@"http://www.your-url-here.com/currentversion.txt"];
   NSString* latestVersion = [NSString stringWithContentsOfURL:latestURL encoding:NSASCIIStringEncoding error:nil];
   //latestVersion will be nil if there trouble was accessing latestURL.

   NSString* ourVersion = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"CFBundleVersion"];
   if([ourVersion isLessThan: latestVersion])
      [self performSelectorOnMainThread:@selector(updatesReady) withObject:nil waitUntilDone:YES];

   [pool drain];
}

//will call updatesReady iff a new version is ready, otherwise does nothing.
- (void) checkForUpdates
{
   [NSThread detachNewThreadSelector:@selector(synchronousCheck) toTarget:self withObject:nil];
}

A few thoughts on automatic updating:

When the user explicitly runs an update-check, they should get immediate feedback that something happened. You should put up a window with a spinner. Even though checking for updates may only take 100msec in your lab, if the user is on a flakey wireless connection while traveling, it could take several seconds for them.

It feels like it takes several years for an HTTP fetch to time out, if you can’t do anything while you wait.

Anything having to do with threads is harder then it looks.

“Check for updates {daily, weekly, monthly}” is a useless preference. Just because Apple’s Software Update has it does not mean you should offer those choices! They do not give the user any real control over when and how they are annoyed by requests to update. Users don’t care when the update checks are performed — they only care when new software is announced to them. Ether go with the a simple check-box that toggles automatic updating, or go with something like:
“Let me know about new software: at 12 PM”.

Display the date of the last successful update check, never display “Last Update Monday 9AM — update failed”. (This should be obvious, but I see it all the time). Version checking should be silent and unobtrusive. Don’t tell the user about it — only tell them about results.

Automatically downloading updates in the background is a great idea if they are small, and the computer has a reasonably fast internet connection.

You might also want to check out: NiftyFeatures 0.4 By Uli Kusterer .

An example project containing two classes, UKUpdateChecker and UKFeedbackProvider that can be plugged into your applications to add “Check for Update…” and “Send Feedback…” menu items to your applications.

July 25, 2008

Trained Open Source Security

Filed under: Design,Programming,Quotes,Security | ,
― Vincent Gable on July 25, 2008

So it’s a matter of training. And that’s pretty much true of Open Source security models. Think of Open Source software. Having a bunch of random people look at the code to tell you if it’s secure won’t work. If you have well-trained people who look at the code, that will work! Open Source just means you can see it, it doesn’t guarantee that the right people will see it.

Bruce Schneier

The interview is much broader, and worth reading.

July 23, 2008

Wow, Macs Really Are Easier

Filed under: Accessibility,Design,MacOSX,Usability | ,
― Vincent Gable on July 23, 2008

Atul Varma learns to love his Mac

…In a nutshell, though, I had always assumed that Macs were only marginally easier to use than PCs. I guess I’ve found over the past two months that in some ways, this holds true—the Mac is essentially an incredibly sexy-looking PC, with the same annoyances and a few polishes that make it a bit more humane to use. In other ways, however, the difference is truly like night and day.

This is a story about such a situation.

… I had to go through 8 wizards in all, so that’s a grand total of twenty-four clicks required to unplug my keyboard and mouse from one side of my computer and plug them into the other side. I’m not actually installing brand-new hardware here.

The first time I had to plug this keyboard and mouse into my Mac, I was floored. In the best-case scenario, I expected it to think for a second or two and then give me a reasonably unintrusive message informing me that I could use my USB mouse and keyboard. That would have been pretty humane.

But it did one better.

The Mac didn’t tell me anything, because my mouse and keyboard just worked the moment I plugged them in. When you plug in a power cable or a pair of headphones into a computer, you don’t get some kind of confirmation message from your operating system, because it’s obviously supposed to just work—why should plugging in a USB keyboard and mouse be any different?

… I have to admit that when it all adds up, I find my Mac to be significantly easier to use than my PC.

« Newer PostsOlder Posts »

Powered by WordPress