请注意:本页内容发布于 1495 天前,内容可能已经过时,请注意甄别。
原文链接:https://devblogs.microsoft.com/oldnewthing/20051021-11/?p=33673
Some time ago, I mentioned the dangers of disabling the desktop window. But why is it even possible to disable the desktop anyway?
之前我曾讨论过禁用桌面窗体的危险性(译注:原文链接已失效)。不过,为什么禁用桌面这件事本身是允许的呢?
This is simply an artifact of the history of philosophy of Windows operating system design.
这不过是 Windows 操作系统设计哲学中的一个人为设计罢了。
Back in the old days, memory was tight, hard drives were luxuries, the most popular CPU for the IBM PC didn’t have memory protection, and software development was reserved for the rarefied elite who could afford to drop a few thousand dollars on an SDK. This had several consequences:
过去的时候,内存是紧缺物资,硬盘是只有有钱人才用得起的东西,IBM PC 最受欢迎的 CPU 没有内存保护机制,软件开发也只是面向那些能在 SDK 上砸下几千美元的高等精英人士的事情。以上这些现实情况造成了下述影响:
- Tight memory means that anything optional had to be left behind.(内存紧缺意味着可做可不做的功能都要舍弃掉)
- Software developers were trusted not to be stupid.(人们相信软件开发者不会做傻事)
- Software developers were trusted not to be malicious.(人们相信软件开发者不会做坏事)
- Software developers were trusted to do the right thing.(人们相信软件开发者会去做正确的事)
Certainly there could have been a check in all the places where windows can be disabled to reject attempts to disable the desktop window, but that would have made one window “more special” than others, undermining the “simplicity” of the window manager. Anything optional had to be left behind.
当然了,在所有禁用窗体的流程中做检查,然后拒绝所有尝试禁用桌面窗体的尝试也不是不可以,不过那样就让(桌面)这一个窗体显得比其它窗体『更加特别』,由此便削弱了窗体管理器的『简洁性』(就像刚刚所说的那样,)可做可不做的功能都要舍弃掉。
Software developers were trusted not to make the sort of stupid mistakes that led to the desktop being disabled, the heap being corrupted, or any of the other “don’t do that” types of mistakes lurking in the shadows Windows programming. If such a serious mistake were to creep in, certainly their testing department would have caught it before the program was released. Software development was hard because nobody said this was going to be easy.
软件开发者们被给予了信任,不会做出让桌面被禁用、让堆数据损坏、或者任何『不能这样做』这类潜伏在 Windows 编程中的失误行为。如果这类严重的疏忽不小心发生了,开发团队的测试部门理当在程序正式发布前将其检查出来。软件开发是件困难的事,毕竟从没有人说过这件事很容易。
Software developers were trusted to treat their customers with respect. Because, after all, software developers who abuse their customers won’t have customers for very long. If a program put itself in the Startup group, then it was doing so not for selfish reasons but rather because the customer actually wanted it.
人们相信软件开发者会尊重他们的客户,毕竟说到底,折腾自己客户的软件开发商是活不长的。如果某个应用将自己放到启动群组里,那么它这么做就应当是由于客户的真实需求,而不是出于自私的目的。
The window manager was left fairly exposed, granting software developers the power to do things like install hooks, subclass windows that were owned by other processes, and manipulate the contents of the Startup group, with the assumption that software developers would use the power for good, not for evil. Don’t bother stopping a program from disabling the desktop window, because maybe that program is doing it for a good reason that we hadn’t thought of.
窗体管理器是开放的,给予了软件开发者们进行例如安装钩子、在其它进程的窗体中创建子类、修改启动群组的内容之类事情的权力,这也是出于对软件开发者的信任,相信他们会合理运用这些权力,而不是去做坏事。不要去管某个程序禁用了桌面窗体,毕竟可能开发者这么做,会有我们没想到的合理理由。
The world of software has changed much since those simpler days. I had a nice chat with my colleague Zeke where we discussed how philosophy has changed over the years. Maybe he’ll write a few words on the subject…
不过,软件开发早已不是早年那样简简单单的世界了。我和我的同事 Zeke 对这些年软件开发的哲学发生了哪些变化进行了一次愉快的交流,可能他会针对这个话题写几篇博文来谈谈吧。
远嚣 Comment