Saturday, July 11, 2009

Operating Conventions Part II (How To Fix What Shouldn’t Be Broken)

This is part two of Operating Conventions, which is itself part of Bad Things Programmers Do. You can read Part 1, but you don’t really have to.

Method 1: Just Fix It

Seriously. Redirect your file open dialogs to the proper My Documents (or better yet, remember the last location.) Use Windows Contacts. Use the favourites folder. Do it the right way, and it won’t be a problem anymore.

Method 2: But compatibility!

If you really must, because some program written years ago by a developer you don’t even know is still alive depends on it, then keep a compatibility struct synced to the OS’s APIs. Make it plain that other developers are not to use the old way anymore, as it may disappear off the face of the earth at any time (this is called deprecation.)

Method 3: But my way is better!

If you truly believe your way is better, then its’ still up to you to keep the OS up-to-date. Use proprietary extensions that other programs will ignore. At the very least, do it your way completely, but keep the OS version synced to any changes.

Remember, above all, if you do it right the first time, you don’t have to worry about compatibility later down the road. Your users will be happy, you’ll be happy, and other developers will be happy too.

Next time on Bad Things Programmers Do, we’ll talk about HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths, otherwise known as the bane of my existence (because programs don’t register themselves there.)

Ciao!

--MarkKB

Wednesday, January 14, 2009

Operating System Conventions

Operating systems have a way of doing things. They provide APIs for developers to hook into and use, and default locations for users to put stuff into.

For example, most operating systems now provide a Documents folder as a default location to put their stuff in, a Bookmarks or Favourites folder to store website links, and music, picture and video folders for various media types. Vista also provides a common Feeds API, and a common contacts framework.

However, many programs are not updated to support, or worse, completely ignore these conventions. While this is not always a big deal to the developers and power users, it is a big deal when Ma switches from one app to another and can’t find her stuff. (They may not be using your software, but you’ve just completely alienated them from trying it out again, or recommending it to others.)

Non-Deliberate Examples

Operating systems often replace functionality that has traditionally been handled by programs. For example, before Microsoft introduced the My Documents folder in Windows 98, most word processors saved their documents to C:\Documents, C:\My Documents, C:\Docs, or variations thereof. At least by 2002, one (admittedly minor) word processor was still doing this, saving to C:\Documents\<insert program name here> Docs.

The same thing happened with the Downloads folder in Windows Vista – even today, many popular download managers and *ahem* file sharing apps don’t download their files to the Vista Downloads folder.

And, of course, we must not forget how every single game seems intent on putting <Program Name> Saved Games in my Documents folder, rather than App Data where it belongs, or the user’s Saved Games folder in Vista.

(I myself am not immune – File Manager “Nemo”’s fav folders idea was formed before I knew Vista would have a similar feature, and developed before I had a working build of Vista to play with, for example.)

And Then There’s…

Some programs deliberately ignore conventions altogether – whether it’s to create a “walled garden” to keep users in, because it’s out of spite or contempt, or simply because it’s the way they’ve always done it.

Browsers are a rather egregious example – apart from Internet Explorer, the default browser in Windows, none of the major browsers use Windows’ Favourites folder for their favourites/bookmarks, and none of them use each other’s bookmark database (although many use the same system.) This one stands out particularly well, seeing as Windows has had a bookmark folder since Microsoft started shipping an internet browser with Windows - Windows 98 with IE4 in 1998, just over a decade ago. They aren’t even stored in some proprietary format – they use plain text, and Windows even provides an API, just in case you don’t want to do the heavy lifting yourself.

The common Feeds API is another example – Apart from Microsoft’s own Internet Explorer and Windows Live Mail, no other program that has anything remotely to do with RSS/Atom feeds uses it.

A particularly annoying one is how email programs’ contact/address books – heck, anything with some kind of contact system – seems to use their own system of doing things. Although Outlook Express/Windows Live Mail have generally been good with this, even Microsoft Outlook doesn’t use the default OS contacts database of their own operating system. (Windows Live Messenger doesn’t do it either. Hmm…)

Next time, I’ll discuss how to fix these problems without breaking your apps. ‘Till then!

--MarkKB

Monday, September 22, 2008

Bad Things Programmers Do

[Updated 14 Jan 2009 with new article titles.]

I’ve decided to start a series about the bad things many programmers do. Suggestions at markkeyb@gmail.com would be appreciated!

Many things on this list are about things that programmers shouldn’t really do, but do anyway. Many of them make small little programs, but some are really high profile or really popular, and often are looked up to by less prominent programmers as how to do things, which only propagates the problem.

Articles in this series:

Operating System Conventions (Part 2)
App Paths? What App Paths?
Uncommon Controls and Dialogs
Hardcoded Paths
Inappropriate Tray Usage

This list will be updated with links when I’ve published the articles. Yay!

--MarkKB