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