June, 2007

  • The Old New Thing

    What determines which programs show up on the front page of the Windows XP Start menu?


    The principle is that programs you've run most often recently are the ones that show up on the front page of the Start menu. At least, that's what we started with, but it turns out that some fine-tuning was needed in order to get the experience to be more "natural".

    The basic rule is that each time you launch a program, it "earns a point", and the longer you don't launch a program, the more points it loses. The Start menu then shows the programs that have the most points. That's about all I'm going to say about the mechanics of point-winning for a variety of reasons.

    • The details of the method by which the programs on the Start menu are selected are still patent-pending.†
    • The details are also extraordinarily boring. I get drowsy every time I have to explain them.
    • Exposing the details would just encourage people to "game the system" in order to improve the placement of their programs on the Start menu.
    • Formally documenting the details would implicitly grant permission for people to rely on those details. This would prevent the Start menu designers from making adjustments to the rules (for example, to combat people who "game the system") or to scrap the process entirely and replace it with a whole new method.
    • It's not this part of the Start menu selection algorithm that puzzles people.

    After the basic rule is applied, the fine-tuning and detail-following kick in. Those are the parts that are puzzling to most people. The next several entries will go into many of the subtleties and fine-tuning behind the Start menu's list of frequently-used programs.

    Now, you may wonder about all these subtleties and whether they're really necessary, but it is these little fine-tuning steps that make the final result more useful and feel natural.

    Please hold off your questions until the (two-week!) series is complete, because I suspect a later entry will answer them. (This series is an expansion upon the TechNet column on the same topic. If you've read the TechNet article, then a lot of this series will be review.)

    Pre-emptive snarky comment

    †"Software patents suck!" It's irrelevant what your or my opinion of software patents is. So long as they are legal, they will exist, and you and I will just have to deal with it. If you want a change, write to your congressman. Support candidates whose position on software patents is compatible with yours. Complaining to me accomplishes nothing.‡ It's sad that I have to write this, but any time somebody writes the word "patent" the comments degenerate into flamology about patents. I have a few future entries about patents; the response to this article will determine whether they stay on the schedule or quietly vanish like the stories about Bob.

    ‡Well, it does accomplish something: It gives me another reason to stop blogging.*

    *Along with the people who keep bugging me about using daggers instead of asterisks. Hint: Asterisks already mean something in computer programming.

  • The Old New Thing

    Why does a new user get stuff on their Start menu right off the bat?


    In the initial designs for the Start menu, the list of most-frequently-used programs on the Start menu would be completely empty the first time you opened it. This was perfectly logical, since you hadn't run any programs at all yet, so nothing was frequently-used because nothing had been used at all! Perfectly logical and completely stupid-looking.

    Imagine the disappointment of people who just bought a computer. They unpack it, plug everything in, turn it on, everything looks great. Then they open the Start menu to start using their computer and they get... a blank white space. "Ha-ha! This computer can't do anything! You should have bought a Mac!"

    (In usability-speak, this is known as "the cliff": You're setting up a new computer, everything looks like it's going great, and then... you're staring at a blank screen and have no idea what to do next. The learning curve has turned into a precipice.)

    The original design attempted to make this initially-blank Start menu less stark by adding text that said, roughly, "Hey, sure, this space is blank right now, but as you run programs, they will show up here, trust me."

    Great work there. Now it's not stupid any more. Now it's stupid and ugly.

    It took a few months to figure out how to solve this problem, and ultimately we decided upon what you see in Windows XP: For brand new users, we create some "artificial points" so that the initial Start menu has a sampling of fun programs on it. The number of artificial points is carefully chosen so that they are enough points to get the programs onto the Start menu's front page, but not so many points that they overwhelm the "real" points earned by programs users run themselves. (I believe the values were chosen so that a user needs to run a program only twice to get it onto the front page on the first day.)

    Note that these "artificial points" are not given if the user was upgraded from Windows 2000. In that case, the points that the Windows 2000 Start menu used for Intellimenus were used to seed the Windows XP point system. In that way, the front page of the Start menu for an upgraded uses already reflects the programs that the user ran most often on Windows 2000.

    In the initial release of Windows XP, the "artificial points" were assigned so that the first three of the six slots on the most-frequently-used programs list were chosen by Windows and the last three by the computer manufacturer. If your copy of Windows XP was purchased at retail instead of preinstalled by the computer manufacturer, or if the computer manufacturer declined to take advantage of the three slots offered to it (something that never happened in practice), then Windows took two of the three slots that had been offered to the computer manufacturer, leaving the last slot blank. That way, the very first program you ran showed up on your Start menu immediately.

    In Windows XP Service Pack 1, the assignment of the six slots changed slightly. Two of the slots were assigned by Windows, one by the United States Department of Justice, and the last three by the computer manufacturer. (Again, if you bought your copy of Windows XP at retail, then two of the computer manufacturer slots were assigned by Windows and the last was left blank.)

  • The Old New Thing

    What other programs are filtered from the Start menu's list of frequently-used programs?


    We already saw that programs in the pin list are pruned from the most-frequently-used programs list because they would be redundant. Another fine-tuning rule was introduced after the initial explorations with the new Windows XP Start menu: Programs with specific "noise" names are removed from consideration.

    Many "noise" programs were showing up as frequently used because they happened to be shortcuts to common helper programs like Notepad or Wordpad to display a "Read Me" document. These shortcuts needed to be filtered out so that they couldn't be nominated as, say, the Notepad representative. The list of English "poison words" is given in Knowledge Base article 282066.

    (Incidentally, a program can also register itself as not eligible for inclusion in the front page of the Start menu by creating a NoStartPage value in its application registration.)

    We'll see in the epilogue that Windows Vista uses an improved method for avoiding the "unwanted representative" problem.

  • The Old New Thing

    Points are earned by programs, not by shortcuts


    The first subtlety of the basic principle that determines which programs show up in the Start menu is something you may not have noticed when I stated it:

    Each time you launch a program, it "earns a point", and the longer you don't launch a program, the more points it loses.

    Notice that the rule talks about programs, not shortcuts.

    The "points" for a program are tallied from all the shortcuts that exist on the All Programs section of the Start menu. Many programs install multiple shortcuts, say one to the root of the All Programs menu and another to a deep folder. It doesn't matter how many shortcuts you have; if they all point to the same program, then it is that program that earns the points when you use any of the shortcuts.

    One the Start menu decides that a program has earned enough points to make it to the front page, it then has to choose which shortcut to use to represent that program. This is an easy decision if there's only one shortcut. If there are multiple shortcuts to the same program, then the most-frequently-used shortcut is selected as the one to appear on the front page of the Start menu.

    If you paid really close attention, you may have noticed a subtlety to this subtlety. We'll take that up next time.

    Please hold off your questions until the (two-week!) series is complete, because I suspect a later entry will answer them. (This series is an expansion upon the TechNet column on the same topic. If you've read the TechNet article, then a lot of this series will be review.)*


    *I wrote this last time, but that didn't stop people from asking questions anyway. I don't expect it'll work today either, but who knows, maybe you'll surprise me.

  • The Old New Thing

    If you pin a program, it doesn't show up in the frequently-used programs list


    After the initial explorations with the Windows XP Start menu, we had to add a rule that fine-tuned the results: If a program is pinned, then it is removed from consideration as a frequently-used program.

    For example, if you right-click Lotus Notes and select "Pin to Start menu", then it goes into the pin list and will never show up in the dynamic portion of the front page of the Start menu. This tweak was added to avoid the ugly situation where you have two icons for the same program on the front page of the Start menu, when only one would do the job.

    This is another manifestation of the "Don't show me something I already know" principle, which we saw earlier when we discussed why the All Programs list doesn't use Intellimenus. After all, you pinned the program to your Start menu because you run it often. There's no point in showing it again at the top of your "frequently-used" list; you knew that already! Use that scarce real estate to show the user something that is actually of value.

    Next time, another fine-tuning rule that tries to filter the noise from the results.

  • The Old New Thing

    The program doesn't have to be run from the Start menu to earn Start menu points


    There's a second subtlety to the basic principle that determines which programs show up in the Start menu:

    Each time you launch a program, it "earns a point", and the longer you don't launch a program, the more points it loses.

    Since programs earn points and not shortcuts, a program can earn points even if you don't use the Start menu to run it.

    In usability studies, we often see people who run programs by digging through their Program Files directory until they find an icon that looks promising and then double-click it. If there is a shortcut on the All Programs section of the Start menu that points to the same program, then that shortcut will eventually work its way onto the front page, assuming the user runs the program often enough.

    This is why you will see a program appear on the front page of the Start menu even though you never ran it from the Start menu. The program earned points because you ran the program manually, or because you opened a document that is associated with that program. Promoting a program run this way helps users realize that they can run Backgammon from the Start menu instead of having to open My Computer, then click on my C drive, then click on Program Files, then MSN Gaming Zone, then Windows, and then double-click the icon with the strange name bckgzm. I've seen usability sessions where the users did this repeatedly, and they considered it perfectly normal, albeit frustrating. "Computers are so hard to use."

    Next time, we'll look at how the pin list influences the list of frequently-used programs.

  • The Old New Thing

    More Start menu fine-tuning: Choosing a better representative for a frequently-run program


    If you paid really close attention to the way a representative shortcut is selected for a program, you may have noticed a problem with it. Here's the rule again:

    If there are multiple shortcuts to the same program, then the most-frequently-used shortcut is selected as the one to appear on the front page of the Start menu.

    Suppose there are two shortcuts to Notepad on the All Programs section of the Start menu, one is the standard Notepad shortcut that comes with Windows, and the other is a shortcut whose command line is notepad.exe C:\Program Files\LitWare Inc\Release Notes.txt. Now suppose the user opens a text document on the desktop. Notepad runs, it "earns a point", and suppose that this gives Notepad enough points to appear on the front page of the Start menu. Which Notepad shortcut do we show?

    According to the rule stated above, we will choose either the standard Notepad shortcut or the LitWare Release Notes shortcut, depending on which one you've run most frequently. If it's the latter, then you'll have the puzzling result that opening a text document on the desktop causes the LitWare Release Notes shortcut to show up on the front page of the Start menu. It's perfectly logical and completely baffling at the same time.

    In Windows Vista, another tweak was added to the algorithm by which a shortcut is chosen to represent a program on the front page of the Start menu: If the user hasn't run any of a program's shortcuts from the Start menu, a shortcut that doesn't have any command line parameters is preferred over one that does.

    This tweak causes the Start menu to favor the standard Notepad shortcut over the LitWare Release Notes shortcut. It also means that, for example, a shortcut to Litware.exe is preferred over a shortcut of the form Litware.exe -update.

    Note: I was not present at the Windows Vista Start menu design meetings, so I have no insight into the rationale behind its design. Sorry.

  • The Old New Thing

    What is the impact on the Start menu of long-running programs?


    Let's take another look at the basic principle that determines which programs show up in the Start menu:

    Each time you launch a program, it "earns a point", and the longer you don't launch a program, the more points it loses.

    If you stare at this long enough, you might see a hole in this principle: What about a program that you launch once and keep running all the time? According to the rule, this program would "earn a point" when you first launched it, and then it would gradually lose points even though you clearly use this program frequently. (Here, "frequently" is an understatement for "all the stinking time!")

    Thus was born another fine-tuning rule: For each consecutive day◊ a program was kept continuously running, it "earned a point" as if you had launched it yourself.

    This little "feeding the program points under the table" was enough background radiation to keep the program afloat in the points race, but not so much as to overwhelm the programs that you actually launch frequently. After all, if you keep the program running all the time, the Start menu didn't have to give the program high placement. Most of the times you open the Start menu, you don't need to launch that program; it's already running. The program just needed to be kept from dying out completely.


    In extreme cases, it might even drop all the way to zero, at which point the program would act like you'd never run it at all!

    ◊"Day" here is shorthand for a more complicated definition (taking into account idle time), the details of which are not relevant.

  • The Old New Thing

    How does the Windows XP Start menu decide that a program is newly-installed?


    Actually, I discussed this topic already, but I'm mentioning it again here since it's thematically related to the other Start menu articles.

    I'm told that there have been a few tweaks to the rules for Windows Vista. Some installers set the time stamps on the program to match the time stamp of the install media. This makes for pretty directory listings but means that the Start menu fails to recognize the program as new. To address this, the Start menu also takes the creation time of the directory containing the program into consideration when determining which programs are new.

    Second, a program that appears in the pin list will not be marked as new, since that would be pointless duplication. (This is only an issue for the "chameleon" pin list entries like "Internet" and "Email" which track your current default Web browser or mail program.) And third, the grace period after installation has been extended from one hour to five hours. This gives computer manufacturers more time to install all their shovelw^H^H^H^H^H^H^Hhigh-quality added-value software.

  • The Old New Thing

    There's no point improving the implementation of a bad idea


    IsBadXxxPtr is a bad idea and you shouldn't call it. In the comments, many people proposed changes to the function to improve the implementation. But what's the point? IsBadXxxPtr is just a bad idea. There's no point improving the implementation of a bad idea.

    On the other hand, some people suggested making it clear that IsBadXxxPtr is a bad idea by making it worse. While this is tempting in a "I'm forcing you to do the right thing" sense, it carries with it serious compatibility problems.

    There's a lot of code that uses IsBadXxxPtr even though it's a bad idea, and making IsBadXxxPtr worse would risk breaking those programs that managed to get away with it up until now. The danger of this is that people would upgrade to the next version of Windows and their program would stop working. Who do you think the blame will be placed on?

    Sure, you might tell these people, "That's because it's a bug in your program. Go contact the vendor for an update." Of course, that's assuming you can prove that the reason why the program stopped working was this IsBadXxxPtr stuff. How can you tell that that was the problem? Maybe it was caused by some other problem, possibly even a bug in Windows itself. Or is your answer just going to be "Any program that crashes must be crashing due to misuse of IsBadXxxPtr?"

    And, as I've noted before, contacting the vendor may not be enough. Most large corporations have programs that run their day-to-day operations. Some of them may have been written by a consultant ten years ago. Even if they have the source code, they may not have the expertise, resources, or simply inclination go to in and fix it. This happens more often than you think. To these customers, the behavior change is simply a regression.

    Even if you have the source code and expertise, fixing the problem may not be as simple as it looks. You may have designed your program poorly and relied on IsBadXxxPtr to cover for your failings. For example, you may have decided that "The lParam to this message is a pointer to a CUSTOMER structure, or it could just be the customer ID number. I'll use IsBadReadPtr, and if the pointer is bad, then the value must be the customer ID number." Or you may have changed the definition of a function parameter and now need to detect whether your caller is calling the "old function" or the "new one". Or it could simply be that once you remove the call to IsBadXxxPtr, your program crashes constantly because the IsBadXxxPtr was covering up for a huge number of other programming errors (such as uninitialized variables).

    "But what if I'm just using it for debugging purposes?" For debugging purposes, allow me to propose the following drop-in replacement functions:

    inline BOOL IsBadReadPtr2(CONST VOID *p, UINT_PTR cb)
      memcmp(p, p, cb);
      return FALSE;
    inline BOOL IsBadWritePtr2(LPVOID p, UINT_PTR cb)
      memmove(p, p, cb);
      return FALSE;

    It's very simple: To see if a pointer is bad for reading, just read it (and similarly writing). If the pointer is bad, the read (or write) will raise an exception, and then you can investigate the bad pointer at the point it is found. We read from the memory by comparing it to itself and write to the memory by copying it to itself. These have no effect but they do force the memory to be read or written. Of course, this trick assumes that the compiler didn't optimize out the otherwise pointless "compare memory to itself" and "copy memory to itself" operations. (Note also that the replacement IsBadWritePtr2 is not thread-safe, since another thread might be modifying the memory while we're copying it. But then again, the original IsBadWritePtr wasn't thread-safe either, so there's no loss of amenity there.)

    (As an aside: I've seen people try to write replacements for IsBadXxxPtr and end up introducing a bug along the way. There are many corner cases in this seemingly-simple family of functions.)

Page 1 of 5 (41 items) 12345