Monkey Lives 猴子的生活

作者: 安迪·赫茨菲尔德 日期: 1983年10月 人物: 史蒂夫·卡普斯,比尔·阿特金森 主题: 软件设计、测试、技术 概要: 关于苹果第一代Macintosh的开发以及制造它的人的轶事: 低内存中的第一个位置 , 猴子的生活 Monkey Lives

The first Macintosh computer had a very small amount of memory, which made it hard to write the operating system and programs. We had to be very careful with how we used the memory. We used some of it for the system and other parts of the computer, and about 90,000 bytes was left for programs. Some big programs like MacWrite and MacPaint almost used up this amount.

第一台麦金塔计算机的内存非常小,这使得编写操作系统和程序变得困难。我们必须非常小心地使用内存。我们将其中一些用于系统和计算机的其他部分,大约90,000字节留给程序。一些大型程序(例如 MacWrite 和 MacPaint)几乎用完了这个数量。

By the fall of 1983, MacWrite and MacPaint were almost finished, but they still needed to be tested. They especially needed to be tested when there was not much memory left. MacPaint needed three special places to store information, each as big as the whole screen. This made it likely to run out of memory, especially when using another program. The problem was that it was hard to find the exact steps that would make the computer crash.

到 1983 年秋天,MacWrite 和 MacPaint 已基本完成,但仍需要测试。当内存不足时,尤其需要进行测试。 MacPaint 需要三个特殊的地方来存储信息,每个地方都与整个屏幕一样大。这使得它可能会耗尽内存,尤其是在使用另一个程序时。问题是很难找到导致计算机崩溃的确切步骤。

Steve Capps worked on a special feature called “journaling” for a tutorial disc. The Macintosh computer could use this feature to show how it works by playing back what it did in a previous session. Steve had an idea that the “journaling hooks” (special codes) used for this feature could also be used to create a testing tool. He called the tool “The Monkey”.

史蒂夫·卡普斯(Steve Capps)为教程光盘开发了一项名为“日记”的特殊功能。 Macintosh 计算机可以使用此功能通过回放上一会话中的操作来显示其工作原理。史蒂夫有一个想法,即用于此功能的“日志挂钩”(特殊代码)也可以用于创建测试工具。他称该工具为“猴子”。

There was a small computer tool called Monkey. It took random events from a journal and sent them to the computer program that was running. This made it seem like a fast and strong monkey was operating the computer, moving the mouse and typing on the keyboard in a hurry. It would click and drag things on the screen at random places. People thought Monkey was very useful for testing computer programs, so they made it better. They made it create more meaningful events, like choosing menu options, moving windows around, and other things.

有一个名为 Monkey 的小型计算机工具。它从日志中获取随机事件并将它们发送到正在运行的计算机程序。这让人感觉就像是一只又快又壮的猴子在操作电脑,飞快地移动着鼠标,敲着键盘。它会在屏幕上的随机位置单击并拖动内容。
人们认为 Monkey 对于测试计算机程序非常有用,因此他们对其进行了改进。他们让它创造了更有意义的事件,比如选择菜单选项、移动窗口等等。

The Monkey was very good at testing and also fun to watch. It moved very quickly and would draw pictures in MacPaint. We wanted to see if it could make sense in MacWrite. At first, the Monkey would sometimes make the computer crash, but we fixed the easy problems. We thought it would be a good way to test an application by seeing if it could run for all night with the Monkey. But usually, the Monkey would stop doing things after 20 minutes, because it would always choose to quit.

猴子非常擅长测试,而且观看起来也很有趣。它移动得非常快,会在 MacPaint 中画画。我们想看看它在 MacWrite 中是否有意义。起初,Monkey 有时会使计算机崩溃,但我们修复了简单的问题。我们认为通过查看应用程序是否可以与 Monkey 一起运行整晚,这将是测试应用程序的好方法。但通常情况下,猴子会在20分钟后停止做事,因为它总是会选择退出。

Bill Atkinson thought of something called “MonkeyLives”, which is like a special sign that says “The Monkey is running!” This sign helps MacPaint and other programs know when the Monkey is working. They can use this sign to make sure the Monkey can’t quit what it’s doing, and to keep it from messing with some things. This way, the Monkey can run all night or even longer, testing everything to make sure it works properly.

比尔·阿特金森想到了一种叫做“MonkeyLives”的东西,就像一个特殊的标志,上面写着“猴子正在奔跑!”此标志可帮助 MacPaint 和其他程序了解 Monkey 何时工作。他们可以使用这个标志来确保猴子不能放弃它正在做的事情,并防止它搞乱一些事情。这样,猴子就可以运行整晚甚至更长时间,测试一切以确保其正常工作。

We kept important system settings in a special part of the computer’s memory. This memory is very small and is used for special things. We started using this memory at address 256. The first part of this memory was being used for something else, but then it became free, so we used it to store a boolean value called MonkeyLives. The Monkey character became less important as computers with more memory became available, but its name stayed in the special memory area because it was the first thing we defined there.

我们将重要的系统设置保存在计算机内存的一个特殊部分中。这个内存很小,用于特殊的事情。我们开始在地址 256 处使用这块内存。这块内存的第一部分被用于其他用途,但后来它变得空闲,所以我们用它来存储一个名为 MonkeyLives 的布尔值。随着具有更多内存的计算机的出现,猴子字符变得不再那么重要,但它的名称保留在特殊内存区域中,因为它是我们在那里定义的第一个东西。
目录