TONT 32703 『诱饵』控制面板

原文链接:https://devblogs.microsoft.com/oldnewthing/20060110-17/?p=32703

译注:原文第一段超级长,为方便阅读,进行了手工拆分。

Last time, we saw one example of a “decoy” used in the service of application compatibility with respect to the Printers Control Panel. Today we’ll look at another decoy, this time for the Display Control Panel.

在上一篇博文中,我们了解了一个与打印机控制面板相关的、用于服务应用程序兼容性的『诱饵』。今天我们来看另一个『诱饵』,这次是关于显示控制面板的。

When support for multiple monitors was being developed, a major obstacle was that a large number of display drivers hacked the Display Control Panel directly instead of using the documented extension mechanism. For example, instead of adding a separate page to the Display Control Panel’s property sheet for, say, virtual desktops, they would just hack into the “Settings” page and add their button there. Some drivers were so adventuresome as to do what seemed like a total rewrite of the “Settings” page. They would take all the controls, move them around, resize them, hide some, show others, add new buttons of their own, and generally speaking treat the page as a lump of clay waiting to be molded into their own image. (Here’s a handy rule of thumb: If your technique works only if the user speaks English, you probably should consider the possibility that what you’re doing is relying on an implementation detail rather than something that will be officially supported going forward.)

在开发多显示器支持的过程中,一个主要的障碍是有相当多的显卡驱动会对显示控制面板直接下手进行修改,而不是使用文档中载明的扩展机制。例如,这些驱动不采取向显示控制面板中增加一个单独的选项卡、来展示诸如虚拟桌面之类的功能的方式,而是直接对『设置』页面横加出手,把它们的按钮直接塞进去。有些驱动极富冒险精神,甚至把『设置』选项卡整个重写了一遍。这些驱动抄起选项卡里的控件来挪东挪西、变大变小、藏这显那,还加了些他们自己的按钮进去,总的来说就是将这个选项卡当成了一块粘土,想做成什么形状就做成什么形状。(这里有一条简明的经验法则:如果你的做法只对说英语的用户有效,那么你应该考虑一下你所做的事情正在依赖部署细节,而不是受官方支持、可以持续下去的东西。)

In order to support multiple monitors, the Settings page on the Display Control Panel underwent a major overhaul. But when you tried to open the Display Control Panel on a system that had one of these aggressive drivers installed, it would crash because the driver ran around rearranging things like it always did, even though the things it was manipulating weren’t what the developers of the driver intended!

为了实现对多显示器的支持,显示控制面板的『设置』页面做出了重大改动。然而,当你在某台安装了上述野心勃勃的显卡驱动的机器上打开显示控制面板的时候,程序会崩溃,因为驱动还在按照旧有的方式对控制面板里的控件大改一通,即便是如今它出手修改的东西已经与驱动的开发者所想的已经完全不同了!

The solution was to create a “decoy” Settings page that looked exactly like the classic Windows 95 Settings page. The decoy page’s purpose in life was to act as bait for these aggressive display drivers and allow itself to be abused mercilessly, letting the driver have its way. Meanwhile, the real Settings page (which is the one that was shown to the user), by virtue of having been overlooked, remained safe and unharmed.

解决方案,则是创建一个『诱饵』设置页面,这个页面看上去与旧式的 Windows 95(显示控制面板的)设置页面完全一样,而它的一切目的就是为了诱使那个野心勃勃的显卡驱动对它毫无怜悯之心地一通乱改,让驱动能心满意足。而与此同时,真正的『设置』页面(展示给用户的),由于被(驱动)忽视掉了,得以岁月静好。

There was no attempt to make this decoy Settings page do anything interesting at all. Its sole job was to soak up mistreatment without complaining. As a result, those drivers lost whatever nifty features their shenanigans were trying to accomplish, but at least the Display Control Panel stayed alive and allowed the user to do what they were trying to do in the first place: Adjust their display settings.

这个『诱饵』设置页面并没有任何有趣的目的,其全部职责就是毫无怨言地迎击驱动的乱搞。最后,这些驱动要展示的那些花哨的功能一个也没能显示出来,但至少显示控制面板安然度过了这一切,使得用户能做他们一开始便想要做的事情:调整显示设置。

TONT 32723 当应用程序认为系统永远都不会变的时候:第3章

原文链接:https://devblogs.microsoft.com/oldnewthing/20060109-27/?p=32723

(译注:第2章在原Blog中不存在,原因未知)

One of the stranger application compatibility puzzles was solved by a colleague of mine who was trying to figure out why a particular program couldn’t open the Printers Control Panel. Upon closer investigation, the reason became clear. The program launched the Control Panel, used FindWindow to locate the window, then accessed that window’s “File” menu and extracted the strings from that menu looking for an item that contained the word “Printer”. It then posted a WM_COMMAND message to the Control Panel window with the menu identifier it found, thereby simulating the user clicking on the “Printers” menu option.

我的一位同事曾解决过的一桩诡异的应用程序兼容性问题,是找出为什么某个程序无法打开打印机控制面板的原因。在深入调查后,原因变得明朗起来。这个程序会打开控制面板,用 FindWindow 找到控制面板的窗口,然后去访问这个窗口的 File(文件)菜单,把这个菜单里的菜单项字符串解析出来,然后在其中找到带有 Printer(打印机)这个词的项目,然后向控制面板窗口发送 WM_COMMAND 窗体消息,以刚才找到的菜单项为参数。经过以上一通操作,便完成了模拟用户单击『打印机』菜单项这个操作。(译注:可自行参考 Windows 3.x 的控制面板长什么样子,以便更好理解上文描述的操作)

With Windows 95’s Control Panel, this method fell apart pretty badly. There is no “Printers” option on the Control Panel’s File menu. It never occurred to the authors of the program that this was a possibility. (Mind you, it was a possibility even in Windows 3.1: If you were running a non-English version of Windows, the name of the Printers option will be something like “Skrivare” or “Drucker”. Not that it mattered, because the “File” menu will be called something like “Arkiv” or “Datei”! The developers of this program simply assumed that everyone in the world speaks English.)

到了 Windows 95 的控制面板里,这种操作可谓一败涂地。控制面板的『文件』菜单里并没有『打印机』这一项,对软件的编写者来说,这是根本不可能发生的事情。(需要提醒的是,即便在 Windows 3.1 中,这也是一件有可能发生的事:如果你运行的 Windows 不是英语版本,那么『打印机』一项的名字可能叫做 Skrivare(译注:瑞典语的『打印机』)或者 Drucker(译注:德语的『打印机』),但这其实也不是最大的问题,因为与此同时『文件』菜单的名字可是会叫做 Arkiv 或者 Datei(译注:分别为瑞典语和德语的『文件』)呢!编写这个软件的开发者估计简单的认为这个世界上的所有人都是讲英语的吧。)(译注:也可能人家根本就没想在英语区之外发行?)

The code never checked for errors; it plowed ahead on the assumption that everything was going according to plan. The code eventually completed its rounds and sent a garbage WM_COMMAND message to the Control Panel window, which was of course ignored since it didn’t match any of the valid commands on that window’s menu.

程序的代码从来都没有对错误进行过检查,只是一味地勇往直前,假定一切都会按计划进行而已。代码做完了它的工作,向控制面板窗口发送了一个无效的 WM_COMMAND 窗体消息,而这个消息由于没有包含针对窗体菜单的任何有效指令,理所当然地被系统忽略了。

The punch line is that the mechanism for opening the Printers Control Panel was rather clearly spelled out on the very first page of the “Control Panel” chapter of the Windows 3.1 SDK:

笑点在于,打开打印机控制面板的方式,实际上在 Windows 3.1 SDK『控制面板』章节的第一页就清清楚楚地写着:

The following example shows how an application can start Control Panel and the Printers application from the command line by using the WinExec function:

以下案例说明如何使应用程序通过调用 WinExec 函数来打开控制面板以及打印机设置界面:

WinExec(“control.exe printers”, SW_SHOWNORMAL);

In other words, they didn’t even read past the first page.

换句话说,这个软件的开发者连第一页都没读过去。

The solution: Create a “decoy” Control Panel window with the same class name as Windows 3.1, so that this program would find it. The purpose of these “decoys” is to draw the attention of the offending program, taking the brunt of the mistreatment and doing what they can to mimic the original behavior enough to keep that program happy. In this case, it waited patiently for the garbage WM_COMMAND message to arrive and dutifully launched the Printers Control Panel.

至于解决方案,则是创建了一个用作『诱饵』的控制面板窗口,这个窗口的类名与 Windows 3.1 的控制面板窗口一致,以便让这个程序能找到它。这个诱饵的作用是吸引这个无礼的应用程序的注意力,首当其冲地模仿旧式控制面板的行为,来让这类应用程序心满意足。在这个案例中,它的作用是耐心等待那个无效的 WM_COMMAND 窗体消息的来临,然后尽职尽责地打开『打印机』控制面板。

Nowadays, this sort of problem would probably have been solved with the use of a shim. But this was back in Windows 95, where application compatibility technology was still comparatively immature. All that was available at the time were application compatibility flags and hot-patching of binaries, wherein the values are modified as they are loaded into memory. Using hot-patching technology was reserved for only the most extreme compatibility cases, because getting permission from the vendor to patch their program was a comparatively lengthy legal process. Patching was considered a “last resort” compatibility mechanism not only for the legal machinery necessary to permit it, but also because patching a program fixes only the versions of the program the patch was developed to address. If the vendor shipped ten versions of a program, ten different patches would have to be developed. And if the vendor shipped another version after Windows 95 was delivered to duplication, that version would be broken when Windows 95 hit the shelves.

现如今,这类问题一般会通过使用『楔子』一类的方式解决,但这个案例是在 Windows 95 的年代发生的,那时应用程序兼容性技术相对来说还不够成熟,而那时能用的办法就是应用程序兼容性标签,以及对二进制文件应用热修复补丁,在其加载入内存时对二进制数据进行修改。热修复补丁这一招只会被留待遇到最棘手的兼容性问题时才会使用,因为从软件发行商哪里获得对其程序进行修改的许可,是一个冗长的法律过程。打补丁被视为是实现兼容性问题解决的『最终手段』,不仅仅因为获得许可要经过机械繁复的法律流程,同时也是因为这样只能修复兼容性补丁所针对的该软件特定版本的问题。如果软件发行商发布了10个版本的应用程序,那就要开发10个不同的补丁。而如果软件发行商在 Windows 95 送厂之后又发布了新版本,那么这个新版本在 Windows 95 上架销售之后便仍存在兼容性问题。

It is important to understand the distinction between what is a documented and supported feature and what is an implementation detail. Documented and supported features are contracts between Windows and your program. Windows will uphold its end of the contract for as long as that feature exists. Implementation details, on the other hand, are ephemeral; they can change at any time, be it at the next major operating system release, at the next service pack, even with the next security hotfix. If your program relies on implementation details, you’re contributing to the compatibility cruft that Windows carries around from release to release.

理解文档中受支持的功能和部署细节的区别很重要。文档中受支持的功能是 Windows 和你的程序之间的契约,Windows 在这个功能的存续期间会信守承诺。而另一方面,部署细节则是稍纵即逝的,可能随时发生变化,变化可能发生在下一个系统大版本,下一个 Service Pack,甚至是下一个安全更新补丁。如果你的程序依赖部署细节,那你不过是在为 Windows 代代相传的、沉重的兼容性包袱添砖加瓦罢了。

Over the next few days, I’ll talk about other decoys that have been used in Windows.

接下来的几天里,我会讲一讲 Windows 中其它的一些兼容性『诱饵』。

TONT 33023 关于无法再支持已经无人再制造的硬件这件事

原文链接:https://devblogs.microsoft.com/oldnewthing/20051209-12/?p=33023

Windows Vista will not have support for really old DVD drives. (The information below was kindly provided to me by the optical storage driver team.)

Windows Vista 对于一些特别老型号的 DVD 光驱已经不再提供支持了。(以下信息由光存储驱动开发组友情提供。)

When PC DVD drives first came out in 1998, the drives themselves did not have support for region codes but instead relied on (and in fact the DVD specification required) the operating system to enforce region coding, with the further understanding that starting on January 1, 2000 all newly-manufactured drives would support region coding in hardware rather than relying on software enforcement. For the purpose of this discussion, I will call the two types of drives “old” (manufactured before 2000) and “new” (manufactured on or after January 1, 2000).

1998年,PC 上的 DVD 光驱刚刚出现的时候,光驱硬件自身并不支持区码限制,而是依赖操作系统来确保这个限制(实际上也是 DVD 标准所要求的),不过在后来更新的标准中,自2000年1月1日起,所有新生产的DVD光驱都应当在硬件、而不是在软件中确保区码限制。为了讨论方便,接下来我将这两种光驱称作『旧』光驱(2000年以前生产)和『新』光驱(2000年1月1日起生产)。

It is that software enforcement that is going away. Turns out that the enforcement of region coding in software had its own problems:

在这个转变的过程中,由软件实现的区码限制消失了,原来是因为由软件实现的区码限制有它自己的问题:

  • It was impossible for third-parties to compile their own CDROM.SYS from the source code in the DDK because the region code enforcement code was not included in the DDK.
    第三方开发者无法从DDK(驱动程序开发包)的源代码中编译他们自己的 CDROM.SYS,因为 DDK 中没有区码限制相关的代码。
  • The region code enforcement code would sometimes mistake a new drive for an old one, resulting in customers unable to play DVDs. Even worse, the driver test team could not reproduce the problem reliably, and the problem went away entirely once a debugger was attached to the system.
    区码限制功能有时候会将新光驱当作旧光驱,导致客户无法播放DVD。更糟糕的是,驱动测试组无法可靠地复现这个问题,而且一接入调试器这个问题就消失了。
  • The code to support the older drives is complex, and the drives that the optical storage team purchased prior to January 1, 2000 are dead or dying. Consequently, testing the code that provides support for old drives has become increasingly difficult, and when the last old drive finally gives up the ghost, testing will become impossible altogether.
    支持旧光驱区码限制的代码很复杂,并且在光存储团队在2000年1月日以前购置的(测试用)光驱大多已经或差不多坏掉了。由此,测试支持旧光驱代码的工作变得愈加困难,等到最后一台旧光驱坏掉的时候,测试工作就会变得完全无法进行了。

These were among the considerations which contributed to the decision to stop supporting these old drives.

以上这些都在决定停止支持这些旧光驱的考虑之中。

What does this mean for you? Almost certainly, the answer is “absolutely nothing”.

而这对你又意味着什么呢?基本可以肯定,答案是『毫无意义』。

First, there is no change to the way data is read from DVD drives, so data discs will still work the same way as they do today. Second, all new DVD drives will continue to run as they did before; the only change is that the risk of mis-identification as an old drive has been removed. Only if you have an old drive will you notice anything different, namely that encrypted/regionalized DVD movies will no longer play. And since the average drive lifetime is only three years, the number of such old drives that are still working is vanishingly small. Not even the optical drive test team can manage to keep their old drives alive that long.

首先,从DVD光驱中读取数据的流程没有任何改变,故而数据光盘的读取效果与现今别无二致。其次,所有的新DVD光驱都会像过去那样正常工作,唯一的变化是会造成将新光驱当作旧光驱这个失误的相关代码已经被移除了。只有当你手里的光驱是『旧』光驱的时候,你才会发现有不一样的情况发生,亦即加密的或有区码限制的DVD影碟无法播放。鉴于光驱的使用寿命平均只有三年,会有这个问题的旧光驱的数量正在急剧缩小。(别忘了,)就连光驱测试组的成员们都没法让这些旧光驱活那么久。

TONT 33043 用实体物品作为提醒

原文链接:https://devblogs.microsoft.com/oldnewthing/20051208-10/?p=33043

On our team, we have a mailing list where people can report problems. Those people could be testers from our team or they could be people from elsewhere in the company. Everybody on the team is expected to keep an eye on the messages and debug problems in their area. The job of monitoring the mailing list to ensure that every issue is ultimately addressed rotates according to a predetermined schedule, and in addition to receiving a piece of reminder mail at 4pm the business day before it’s your turn, you will also find a Mickey Mouse ears hat on your desk when you arrive in the morning.

在我们的团队中,有一个邮件列表用来报告问题,报告问题的人既可能是团队中的测试人员,也可能是公司里其他部门的人。团队成员们都有责任盯好消息,并处理自己所负责的调试工作。监视邮件列表、以便将每个问题都能最重转达给响应人员的工作是按照一个预定的计划轮转的,并且除了工作日下午4点会收到一封邮件、提醒第二天轮到你来做这项工作之外,第二天你的桌子上还会多出一顶米奇老鼠的帽子。

I bought this hat in Disneyland a few years ago and somehow managed to convince the person operating the sewing machine to stitch the name “Dev O’Day” on the back. “It’s an Irish name,” I explained, but it also stands for “Developer of the Day”, which is the title we use for the person who monitors the mailing list.

这顶帽子是几年前我去迪士尼乐园的时候买的,并且设法说服了操作缝纫机给帽子织上名字的人,让他在帽子背面织了『Dev O’Day』这个名字。『这是个爱尔兰名字』,我是这么跟他解释的,不过这个缩写也代表『今日开发者』,亦即我们给今天盯着邮件列表的人的头衔。

One of our team members went on vacation to Disneyland the following year and brought back a back-up hat, which sits in my office. The back-up hat is occasionally brought into service when the primary Dev O’Day hat goes missing, at which point a Search and Rescue mission is undertaken to locate the hat and restore it to circulation. (It’s usually just sitting in the office of someone who was Developer of the Day recently and merely forgot to hand the hat off at the end of the day.)

我们团队里的一位成员第二年的时候也去了迪士尼乐园独家,并且买回来一定备用的帽子,这顶帽子放在我的办公室里。备份帽偶尔会在『主』帽消失的时候用来顶替它的工作,而这时『搜救行动』也会开展起来,将『主』帽重回流通之中。(通常来说,『主』帽只是被留在了最近成为『今日开发者』的某个成员的办公室里,忘了在当天结束的时候交出去而已。)

TONT 33083 当标记的含义中途发生变化的时候

原文链接:https://devblogs.microsoft.com/oldnewthing/20051206-10/?p=33083

The project leader for the initial version of Internet Explorer was well-known for wearing Hawaiian shirts. I’m told that the team managers decided to take one of those shirts and use it as an award to the team member who fixed the most bugs or some similar thing. What the team managers failed to take into account that nobody actually liked having a Hawaiian shirt hanging in their office, especially not one that was worn by somebody else. If you happened to be the person who fixed the most bugs, you sort of reluctantly accepted the shirt even though you really didn’t want it.

Internet Explorer 早期版本的项目领导人的夏威夷衫装束在公司内人尽皆知。团队管理者告诉我,他们决定拿其中一件衬衫当奖励,奖给修复了最多bug或者做了类似贡献的团队成员。但是团队管理者没有考虑到的是,并没有人喜欢在办公室里挂一件夏威夷衬衫,尤其是被别人穿过的那种。如果你碰巧修复了最多的bug,就得不怎么情愿地接受一件衬衫,即便是你并不怎么想要它。

And then a wonderful thing happened: The meaning of the shirt flipped.

然后就发生了一件奇妙的事情:衬衫的含义来了个180度的转变。

I don’t know the details. I suspect at one point, somebody who “won” the shirt just left it in somebody else’s office as a way of getting rid of it. This simple gesture was the turning point. The shirt became a symbol of disapproval. I believe the unofficial rule was that in order to get rid of the shirt, you had to find somebody who messed up at least as bad as whatever you did to earn the shirt in the first place.

我不知道事情的详细经过,估计是在某个时候,某个『赢得』了这件衬衫的人干脆把它留在了别人的办公室里,权当一种丢弃的方式。如此简单的一道行为成为了转折点,衬衫变成了不赞成的标志。我觉得这条不成文的规定是,要想把衬衫推给别人,你得找一个像自己一样因为把事情搞糟(至少跟自己的程度差不多)、因而被塞给了这件衬衫的人。

It took a while before the team managers even realized what happened to their “award”.

团队管理者过了好一阵子才发现自己的『奖励』变成了什么样子。

TONT 33103 将软盘用作信号量标记

原文链接:https://devblogs.microsoft.com/oldnewthing/20051205-09/?p=33103

In the very early days of Windows 95, the distribution servers were not particularly powerful. The load of having the entire team installing the most recent build when it came out put undue strain on the server. The solution (until better hardware could be obtained) was to have a stack of floppy disks in the office of the “build shepherd”. (The job of “Build Shepherd” was to perform the initial diagnosis of problems with the build itself or with verification testing and make sure the right developer is called in to address the problem.)

在 Windows 95 研发的初期,用来发版的服务器性能并不算强大。当新版本发布后,整个团队都去上拉取最新构建版本进行安装这件事对服务器造成了可观的压力。解决方法(在换用更强力的硬件之前)是在『构建牧羊人』的办公室里放置一摞软盘。(『构建牧羊人』的工作是对构建版本、或者验证测试进行初步的问题筛查,并确保对应的开发者能被及时叫来处理问题。)

If you wanted to install the latest build, you had to go to the Build Shepherd’s office and take one of the specially-marked floppy disks. When you finished installing, you returned the disk.

假如你想安装最新的构建版,你就需要去构建牧羊人的办公室里去取一张做了特殊标记的软盘,等安装完之后,再把软盘送回去。

In other words, the floppy disk acted as a real-world semaphore token.

换句话说,这些软盘变成了现实世界中的信号量标记。

TONT 33243 为什么(有时)UNC路径的开头允许有盘符?

原文链接:https://devblogs.microsoft.com/oldnewthing/20051122-15/?p=33243

A little-known quirk is that the file system accepts and ignores a drive letter in front of a UNC path. For example, if you have a directory called \\server\share\directory, you can say

有个鲜为人知的奇怪设计是,文件系统接受(并会忽略)UNC 路径的开头包含盘符。例如,如果你有个目录(的共享路径)是\\server\share\directory,你可以输入

dir P:\\server\share\directory

and the directory will be listed to the screen. The leading P: is ignored.

目录内容会成功列出,开头的 P: 被忽略了。

Why is that?

这是为什么呢?

Rewind to 1984 and the upcoming release of MS-DOS 3.1, which added networking support. Up to this point, all fully-qualified file specifications consisted of three components: A drive letter, a path, and a file name. Many programs relied on this breakdown and did things like “helpfully” prepend a drive letter if it looks like you “forgot” one. For example, if you told it to save the results to \\server\share\file.txt it would say, “Oh dear, that’s not good, the user forgot the drive letter! I’ll put the current drive in front to make things better,” resulting in C:\\server\share\file.txt. Other programs would prompt you with “Please enter a drive letter”, and you couldn’t say “No, there’s no drive letter, just take the path and use it.” They insisted on a drive letter, and you darn sure better give them one.

回到 1984 年,MS-DOS 3.1 即将发布,该版本新增了网络支持。到这时为止,所有完全限定的文件规范包含三个组成部分:盘符、路径和文件名。很多应用程序都依赖这种组合方式,并且如果路径看上去是用户『忘了』录入盘符的话,还会在最前面『帮忙』加上一个。例如,如果用户指定将数据保存到 \\server\share\file.txt,程序就会认为:『哎呀,这怎么行,用户忘了写盘符了!让我在最前面加上当前驱动器的盘符,这样就好了』,路径就变成了 C:\\server\share\file.txt。另外也有程序会提示用户『请输入盘符』,而用户无法告诉程序『不不,这个路径里没有盘符,直接用这个路径就行了』。程序是一定要一个盘符的,而用户不给是不行的。

(Compare the Unix programs that “helpfully” rewrite //server/volume/file as /server/volume/file because they “know” that consecutive slashes collapse, unaware of the special exception for two leading slashes.)

(相较之下,UNIX 程序则会『帮忙』将 //server/volume/file 重写为 /server/volume/file,因为他们『知道』连续斜线应当进行合并,但却不知道两道斜线开头是个例外。)

In order to retain compatibility with programs that provided this sort of “unwanted help”, the designers of the networking support in MS-DOS decided to allow the strange syntax C:\\server\share\directory and treat it as if the drive letter simply weren’t there. Some (but not all) of this quirk of path parsing persists today.

为了保持与提供这种『毫无必要的帮助』的程序的兼容性,MS-DOS 网路支持功能的设计者们决定允许 C:\\server\share\directory 这种奇怪语法的存在,并将其视为开头的盘符

TONT 33303 硬塞狗粮

原文标题:Force-feeding the dogfood

原文链接:https://devblogs.microsoft.com/oldnewthing/20051117-11/?p=33303

Windows 95 contained some new networking features, and since I was one of those crazy people who sampled every flavor of dogfood in the store, I actually tried out all of them. One of the features, a network protocol, I thought was interesting enough that I decided to help them out by forcing everybody else on the team to dogfood it.

Windows 95 包含了一些新的网络功能。鉴于我是会遍尝店里每种口味狗粮的那种人(译注:见上一篇),我是真的都试了一个遍。对于其中一个功能(某个网络协议),我觉得它很有趣,最终使我决定通过让团队里的每个人都尝一尝这份狗粮的味道的方式,来帮助对应团队的人将它做好。

Here’s how I did it.

以下是我的做法。

I had a bunch of debugging documents and other materials that people generally found useful. I put them on my machine, which acted as a file server. Anybody who wanted these files had to install the network protocol in order to get them. And the files were valuable enough that people were willing to take a chance on a new network driver just to get them. Not only did the client side of the driver get a lot of dogfood test coverage, so too did the server side, since my computer would be servicing a lot of simultaneous connections from people reading my documents. I remember finding a variety of interesting bugs this way. (And of course I ran stress over this protocol.)

我手里有一套调试用的文档、以及其它一些资料,对开发人员来说都很有用。我将这些资料放在我的机器上,并让我的机器作为一台文件服务器。任何想要获取这些资料的人,都得安装这个网络协议才能访问它。这些资料的价值,已经高到人们宁可安装一套新的网络驱动也要拿到它的程度了。如此,这个驱动不光在客户端一侧被尝了个遍,在服务端一侧也一样,因为我的机器对前来阅读这些资料的人们同时建立了大量的连接。我记得通过这种方式,得以发现了几个有趣的bug。(当然了,我也有对这个协议进行压力测试。)

I later became friends with the lead tester for the protocol, and he told me that my simple act of force-feeding the dogfood to every other member of the Windows 95 team was a key element of making their feature a success.

后来我跟这个协议的领头开发者成了朋友,他告诉我,我这种让 Windows 95 开发团队的每个人都被强塞一遍狗粮(译注:咳咳)的做法是令他们研发的功能成功的关键元素之一。

TONT 33323 遍尝商店里每种口味的狗粮

原文标题:Sampling every flavor of dogfood in the store

原文链接:https://devblogs.microsoft.com/oldnewthing/20051116-12/?p=33323

During the development of Windows 95, everybody was, of course, self-hosted and upgraded the operating system on a regular basis as new builds came out. I took it upon myself never to install the operating system twice the same way. Each time I ran setup, I would give different answers to the questions. Maybe this time, I’ll leave out Wordpad and bind NetBIOS over TCP/IP to my Xircom parallel-port network adapter. Or maybe I wouldn’t choose any networking drivers at all during setup and try to add them later. Towards the beginning of the project, nearly every run of setup would run into some strange problem, and some developer from whatever component I decided to configure randomly would be in my office at the debugger trying to figure out what happened. (Fortunately, as the project matured, the problems were rarer and rarer.)

在 Windows 95 的研发过程中,伴随着新编译版本的发布,每个人都时常对手里的版本自行托管、自行升级。我的做法则是从来不用同一种方法运行安装程序两次。每次我运行安装程序的时候,我都会对安装程序给出的提问做出不同的回答。可能这次,我会选择不安装写字板,然后把 NetBIOS over TCP/IP 协议配置在 Xircom 并口网卡上,下次则可能在安装时什么网络驱动程序也不装,等装完系统后再进行配置。在整个开发流程最开始的时候,几乎每次运行安装程序都会遇到一些奇怪的问题,然后负责我随机挑选进行配置的某个组件对应的开发者就会来到我的办公室,打开调试器,试着搞清楚到底发生了什么事。(幸而随着整个工程逐渐成熟之后,类似的问题也变得越来越罕见了。)

I was, you might say, sampling every flavor of dogfood in the store.

也可以说,我这是在遍尝商店里每种口味的狗粮。(译注:Eat your own dogfood 字面意思是『吃自家的狗粮』,在软件开发中,则指『自己开发的产品,自己得先用』,即进行内部测试。)

I would also do crazy things for nightly stress runs. My favorite was to run stress over a parallel port direct cable connection. I don’t think it ever occurred to anyone to test DCC quite this way.

有时在进行连夜的压力测试时,我也会搞一些疯狂的事情。我最喜欢的一个案例是在并口的直接电缆连接上运行压力测试,我个人认为不会有人把测试直接电缆连接功能这件事搞得那么绝。

TONT 33353 Dr. Watson 原来叫什么名字?

原文链接:https://devblogs.microsoft.com/oldnewthing/20051114-00/?p=33353

What most people probably don’t know is that Dr. Watson’s name wasn’t originally “Dr. Watson”.

大多数人可能不知道的是,Dr. Watson 的名字原本并不是 Dr. Watson。

The original name of the diagnostic tool was “Sherlock”, whose icon was a lit drop-stem pipe. I remember chatting about the Doctor with its author, the late Don Corbitt, whose office was just a few doors down from mine. In 1991, he had to change the name from “Sherlock” to “Dr. Watson”; I had forgotten why, but Danny Glasser came to my rescue and reminded me that there was already a debugging tool called “Sherlock” that had come out a few years previously. The name had to change, and the Doctor stepped in to fill Sherlock’s shoes. The icon was originally a doctor’s bag, but it changed to the stethoscope-wielding general practitioner a few months later.

这个诊断工具原来的名字是『夏洛克』(Sherlock),图标则是一只点燃了的烟斗。我还记得跟小 Don Corbitt、也就是这个软件的作者聊起过这件事,他的办公室跟我就隔着几道门。1991 年的时候,他不得不把他的工具从 Sherlock 改名为 Dr. Watson。我已经忘记为什么了,不过 Danny Glasser 帮了我一把,让我想起是因为几年前已经有一个调试工具用过 Sherlock 这个名字了。名字非换不可,于是华生博士(Dr. Watson)就顶替了夏洛克(Sherlock)的位置。新工具原本的图标是一个医师手提包,不过过了几个月就换成戴着听诊器的医生的形象了。

You should also check out Matt Pietrek’s reminiscences about Dr. Watson.

我在这里也推荐 Matt Pietrek 对于 Dr. Watson 的回忆文章。

A note about Don Corbitt. He was a tall fellow with a deep booming voice, but he never used it. Instead, he spoke in a gentle, reassuring tone, backing it up with code that was always solid. I consider it an honor to have worked with him. Taking up the mantle of keeping the Doctor up to date with the latest forensic techniques, I updated it (i.e., rewrote it from scratch) for Windows 98. I was not a member of the Windows 98 team but wrote the program as a favor to them at great personal cost. (My then-boss didn’t approve of my little side project and made his displeasure known at my next performance review.)

这里还要提一下 Don Corbitt,他是个声音低沉的高个子,不过他不怎么用这种音调说话,而是用一种礼貌而令人安心的语调与人交谈,在协助我编写代码方面非常靠得住,我认为跟他共事是一种荣誉。为了肩负起让 Dr. Watson 保持更新的责任,我面向 Windows 98 对其作了更新(也就是从头重写一遍)。我并不是 Windows 98 开发团队的一员,不过还是花费了自己很大的功夫做好了这件事来向 Windows 98 团队表示支持。(我那时候的上司对我这么做并不感冒,并且在之后的一次效率评审会上表达了这种不满。)