The Grand Unified Model (1) - Resources 大统一模型(1)-资源

作者: 布鲁斯·霍恩 日期: 1981年12月 人物: 安迪·赫兹菲尔德、鲍勃·贝尔维尔、布鲁斯·霍恩、艾伦·凯、史蒂夫·卡普斯、比尔·阿特金森、丹·史密斯、弗兰克·鲁道夫、拉里·凯尼恩、乔安娜·霍夫曼、特德·凯勒、史蒂夫·乔布斯 主题: 软件设计、起源、技术、用户界面 概要: 关于苹果第一代Macintosh的开发以及制造它的人的轶事: 资源的创造 , 大统一模型(1)-资源 The Grand Unified Model (1) - Resources

Think about the big task we had: creating a brand new way for people to interact with a computer, a whole new operating system, and special programs for a small personal computer to compete with the popular IBM PC. That was what we wanted to achieve with the Macintosh computer.

想想我们面临的艰巨任务:为人们与计算机交互创造一种全新的方式,一个全新的操作系统,以及让小型个人计算机与流行的 IBM PC 竞争的特殊程序。
这就是我们希望通过 Macintosh 计算机实现的目标。

It was 1981 and I had just finished college at Stanford University. For the past eight years, I had been working as much as I could at the Learning Research Group at a place called Xerox Palo Alto Research Center. This center was famous and many important computer scientists wanted to work or visit there. And I had just decided to leave this place to start working at Apple.

那是 1981 年,我刚刚从斯坦福大学毕业。
在过去的八年里,我一直在一个名为施乐帕洛阿尔托研究中心的学习研究小组中尽我所能地工作。
这个中心很有名,许多重要的计算机科学家都想在那里工作或访问。我刚刚决定离开这个地方,开始在苹果工作。

I used to work on powerful computers called Altos and Dorados. They had good screens, mice, and a network connection. They also had the best software development system at the time. These computers had a lot of memory, and they were fast. Building an Alto cost over $15,000, and a Dorado cost even more. Apple was going to make a new computer called Macintosh that would be simpler and have less memory and no hard disk. We had to make it cheap, under $1000, so it could compete with other computers like the IBM PC. We also wanted to create a way for the computer to work with a human using graphics and an operating system that would work on a 8 million bit-per-second microprocessor.

我曾经使用过名为 Altos 和 Dorados 的强大计算机。他们有很好的屏幕、鼠标和网络连接。
他们还拥有当时最好的软件开发系统。这些计算机有大量内存,而且速度很快。建造一辆 Alto 的成本超过 15,000 美元,一辆 Dorado 的成本甚至更高。
苹果公司打算制造一款名为 Macintosh 的新电脑,它会更简单,内存更少,而且没有硬盘。
我们必须让它便宜,低于 1000 美元,这样它才能与 IBM PC 等其他计算机竞争。
我们还希望创造一种让计算机与人类一起使用图形和操作系统的方式,该操作系统可以在每秒 800 万位的微处理器上运行。

I was lucky because I had worked on a small computer system at PARC, called the NoteTaker. Because of that, I knew what it was like to work with a small system. Even so, I was used to using Smalltalk, a system that is very easy to use and friendly. I wanted to make the Finder, the main system on Macintosh, as easy to use and flexible as Smalltalk.

我很幸运,因为我曾在 PARC 开发过一个小型计算机系统,称为 NoteTaker。
正因为如此,我知道使用小系统是什么感觉。
即便如此,我还是习惯了使用Smalltalk,这是一个非常易于使用且友好的系统。
我想让 Finder(Macintosh 上的主系统)像 Smalltalk 一样易于使用和灵活。

Smalltalk was a special kind of programming language and tools that were ahead of their time. Its library of pre-written code was very advanced and had special features for building user interfaces, windows, and graphics. Working with Smalltalk was unique - you could change your code quickly and easily, and the changes would be applied right away. I was lucky to have access to a lot of useful pre-written code and to be able to write new code or change existing code easily.

Smalltalk 是一种超前于时代的特殊编程语言和工具。
它的预编写代码库非常先进,并且具有用于构建用户界面、窗口和图形的特殊功能。
使用 Smalltalk 是独一无二的 - 您可以快速轻松地更改代码,并且更改将立即应用。
我很幸运能够访问许多有用的预先编写的代码,并且能够轻松编写新代码或更改现有代码。

But now I faced a new situation. Programmers for Macintosh would write code in two different languages, assembly code and Pascal, and would have to do it in stages: write, compile, link, and test again. This was very different from the easy, flexible way I was used to with Smalltalk. My task was to make the Finder, a program that would be used by every Macintosh user to organize and manage their files, folders, and apps. This would be the main face of the Macintosh, what users would see every day.

但现在我面临着新的情况。
Macintosh 程序员会用两种不同的语言(汇编语言和 Pascal)编写代码,并且必须分阶段进行:编写、编译、链接和再次测试。
这与我习惯的 Smalltalk 简单、灵活的方式非常不同。
我的任务是制作 Finder,每个 Macintosh 用户都可以使用它来组织和管理他们的文件、文件夹和应用程序。
这将是麦金塔电脑的主要面孔,也是用户每天都会看到的。

I didn’t enjoy the way traditional programming worked. I thought it was strange that once you wrote the code, you couldn’t easily change it. I wanted to be able to make changes to the program while it was running, without having to rewrite all of it. Even though the main program couldn’t be changed, I wanted to know what else could be changed without having to recompile the code. For example, the Finder, which is a part of the computer, needed to keep track of the files on the disk and how they relate to each other. Some information about these files, like what they look like and how they work, would need to come from the programs that created them. But what would store this information?

我不喜欢传统编程的工作方式。我觉得很奇怪,一旦你写了代码,你就不能轻易改变它。
我希望能够在程序运行时对其进行更改,而不必重写所有内容。
尽管主程序无法更改,但我想知道在不必重新编译代码的情况下还可以更改哪些内容。
例如,作为计算机一部分的 Finder 需要跟踪磁盘上的文件以及它们之间的关系。
有关这些文件的一些信息,例如它们的外观和工作方式,需要来自创建它们的程序。
但是什么会存储这些信息呢?

Alan Kay, a computer scientist, once said that any problem can be solved by adding an extra layer of complexity. I thought, “What if I could easily refer to a program’s important information, like text, pictures, and layout, separately and without being directly in the code?” If I could do that, it would allow people who don’t have access to the code (like translators, artists, and designers) to change these things without needing the code. For example, they could translate menu items from English to Norwegian, or change the application icons and pictures. This would be possible if the program was written in a way that separates this important information, or “data”, from the code.

计算机科学家艾伦·凯曾经说过,任何问题都可以通过增加额外的复杂性来解决。
我想,“如果我可以轻松地单独引用程序的重要信息,例如文本、图片和布局,而不是直接在代码中,该怎么办?”如果我能做到这一点,那么那些无法访问代码的人(例如翻译人员、艺术家和设计师)就可以在不需要代码的情况下更改这些内容。
例如,他们可以将菜单项从英语翻译成挪威语,或者更改应用程序图标和图片。
如果程序以将重要信息或“数据”与代码分开的方式编写,则这是可能的。

It would be a new and exciting feature to be able to easily make apps and the operating system work in different languages and countries, especially back in the early 1980s. At that time, no one thought about making systems work for people who spoke different languages. They just assumed everyone would speak English, and other countries would create their own systems. If the Mac could be released in other countries with menus, icons, and dates translated into different languages, it would help our computer grow in popularity. I don’t even remember exactly when I started thinking about how important this feature was, but it was something that many of us in the Mac team started talking about and agreeing on.

能够轻松地使应用程序和操作系统在不同语言和国家/地区运行,这将是一项令人兴奋的新功能,尤其是在 20 世纪 80 年代初。
当时,没有人考虑让系统为说不同语言的人工作。
他们只是假设每个人都会说英语,而其他国家会创建自己的系统。
如果 Mac 可以在其他国家发布,并将菜单、图标和日期翻译成不同的语言,这将有助于我们的计算机越来越受欢迎。
我什至不记得我是什么时候开始思考这个功能有多么重要,但 Mac 团队中的许多人开始讨论并达成共识。

I thought that the Mac should have a tool for all developers to use, which would help make apps easier to modify and manage memory better. This is why I came up with the idea of “Resources”. It would help move non-programming data to one place and let developers work with it easily, while also controlling memory use on a small part (object) by small part basis.

我认为Mac应该有一个工具供所有开发人员使用,这将有助于使应用程序更容易修改和更好地管理内存。
这就是我提出“资源”这个想法的原因。它将有助于将非编程数据移动到一个地方,让开发人员轻松使用它,同时还可以逐个小部分(对象)控制内存使用。

The Resource Manager was a solution to three main problems: managing data for the Finder, moving information that can be translated into different languages away from programs, and using memory efficiently. In those days, computers had very little memory, only 128 kilobytes. This meant that programs and files had to be stored on floppy disks, which had limited space. The Finder was especially memory-hungry because it had to show icons and swap their pictures in and out of memory as needed. The Resource Manager had to handle each of these small parts separately. I was lucky because I knew about a similar system called OOZE, which was designed to manage memory for a programming language called Smalltalk. It moved objects in and out of memory as needed. This idea inspired me to create the Resource Manager. You can learn more about OOZE here.

资源管理器解决了三个主要问题:管理 Finder 的数据、将可翻译成不同语言的信息从程序中移出,以及有效地使用内存。
那时,计算机的内存非常小,只有 128 KB。
这意味着程序和文件必须存储在空间有限的软盘上。
Finder 特别消耗内存,因为它必须显示图标并根据需要将图片移入或移出内存。
资源管理器必须单独处理这些小部分。
我很幸运,因为我知道一个名为 OOZE 的类似系统,它是为一种名为 Smalltalk 的编程语言管理内存而设计的。
它根据需要将对象移入和移出内存。这个想法启发我创建了资源管理器。您可以在这里了解有关 OOZE 的更多信息。

The Resource Manager kept track of objects in a special table called the resource map. A file on the hard drive, called a resource file, contained the information about these objects. Each object was a specific type, like a menu or a piece of text. The type of object is four bytes long, which makes it easy to read and write. Every object also had a special number, called a resource ID, that makes it unique. Additionally, objects could also have a name, which made it easier for programmers to use them.

资源管理器在一个称为资源映射的特殊表中跟踪对象。
硬盘驱动器上的文件称为资源文件,包含有关这些对象的信息。
每个对象都是特定的类型,例如菜单或一段文本。对象的类型有四个字节长,这样很容易读写。
每个对象还有一个特殊的编号,称为资源 ID,这使其具有唯一性。
此外,对象还可以有一个名称,这使得程序员更容易使用它们。

Luckily, we had a system that allowed us to store a special kind of object in memory. This object is called a “resource” and is stored in a special area of memory called a “handle”. A handle is like a label that points to a specific spot in memory. We designed this system so that we could free up memory when we’re not using it, by reusing the same space in memory. This way, we can keep track of which memory spaces are free or being used, without having to worry about whether the object is still in memory or not. This makes it easier to deal with objects that are loaded into memory only when we need them.

幸运的是,我们有一个系统,允许我们在内存中存储一​​种特殊类型的对象。
该对象称为“资源”,存储在称为“句柄”的特殊内存区域中。句柄就像一个标签,指向内存中的特定位置。
我们设计这个系统的目的是为了在不使用内存时可以通过重用内存中的相同空间来释放内存。
这样,我们就可以跟踪哪些内存空间是空闲的或正在使用,而不必担心对象是否仍在内存中。
这使得处理仅在需要时才加载到内存中的对象变得更加容易。

I wanted to find a way for different parts of the system to use resources (like fonts and images) in a flexible way. I thought it would be good if the system resources could be replaced by the application, and the application resources could be replaced by the individual documents. This would allow documents to have their own fonts, images, and other resources, applications to have their own resources, and the system to share some resources with all applications. In this way, resource files can be connected or linked, and the system can look for resources in the following order: first in the document, then in the application, and finally in the system.

我想找到一种方法让系统的不同部分以灵活的方式使用资源(如字体和图像)。
我想如果系统资源可以用应用程序来代替,应用程序资源可以用单独的文档来代替就好了。
这将允许文档拥有自己的字体、图像和其他资源,应用程序拥有自己的资源,并且系统与所有应用程序共享一些资源。
这样,资源文件就可以连接或链接起来,系统可以按照以下顺序查找资源:先在文档中,然后在应用程序中,最后在系统中。

One of my weaknesses as a software designer is that I try to fix the biggest problems. I do it by working step by step from the beginning. This means I do a lot of work without seeing results right away. I made the Finder rely on the Resource Manager, which made sense, but it added extra complexity to the Mac’s development. This was because the Finder’s development was delayed, and it took longer to finish than planned. I didn’t come up with these ideas all at once. As I learned more about resources and others started using them in the system, I realized what the Finder needed. In the end, the Resource Manager’s ideas affected how the Mac handled data in a big way.

作为一名软件设计师,我的弱点之一是我试图解决最大的问题。我从一开始就一步一步地工作。
这意味着我做了很多工作却没有立即看到结果。我让 Finder 依赖于资源管理器,这是有道理的,但它给 Mac 的开发增加了额外的复杂性。
这是因为Finder的开发被推迟了,并且完成时间比计划的要长。这些想法并不是我一下子想出来的。
随着我对资源的了解越来越多,并且其他人开始在系统中使用它们,我意识到 Finder 需要什么。
最终,资源管理器的想法在很大程度上影响了 Mac 处理数据的方式。

When I started talking to my team, Larry and Andy understood how important resources are. They realized that we would have to change our system to use the Resource Manager correctly. Larry was working on the memory manager and Andy was working on most of the Toolbox. They were already making good progress, but the Toolbox needed a big change to use resources. We all agreed on this, but I forgot to tell Bob Belleville about the changes we needed to make. I thought we could finish it quickly, so I didn’t think it was worth mentioning.

当我开始与我的团队交谈时,拉里和安迪明白资源的重要性。
他们意识到我们必须更改系统才能正确使用资源管理器。
拉里(Larry)负责内存管理器,安迪(Andy)负责工具箱的大部分工作。
他们已经取得了良好的进展,但工具箱需要进行重大更改才能使用资源。
我们都同意这一点,但我忘记告诉鲍勃·贝尔维尔我们需要做出的改变。
我以为我们可以很快完成它,所以我认为这不值得一提。

I started writing a computer program. Later, a colleague named Bob asked me what I was working on. I told him about the program, called the Resource Manager, and why it was important. He told me to stop working on it. I was very surprised. I tried to explain to him that the Resource Manager is the main part of the Mac’s computer system. Many other parts of the system, like the Toolbox and the Finder, depend on it. I couldn’t think of a way to fix all the problems we needed to solve without something like the Resource Manager.

我开始编写计算机程序。后来,一位名叫鲍勃的同事问我在做什么。
我向他介绍了这个名为“资源管理器”的计划,以及它的重要性。他告诉我停止做这件事。我很惊讶。
我试图向他解释资源管理器是Mac计算机系统的主要部分。
系统的许多其他部分,如工具箱和查找器,都依赖于它。
如果没有像资源管理器这样的东西,我想不出一种方法来解决我们需要解决的所有问题。

Bob told me to stop working on the project because he didn’t think it was important and I should focus on something else. But I wanted to use the project with another system I was working on, called the Finder. I thought it would take a lot more time to do this without the project, which is called the Resource Manager. I told Bob that I was going to keep working on it anyway.

鲍勃告诉我停止该项目的工作,因为他认为这并不重要,我应该专注于其他事情。
但我想将该项目与我正在开发的另一个系统(称为 Finder)一起使用。
我认为如果没有项目(称为资源管理器),完成此操作会花费更多时间。
我告诉鲍勃无论如何我都会继续努力。

It was a big challenge because we had very little space in our computer’s memory. Despite this limitation, I was able to write a very important part of the software, called the Resource Manager, using a low-level programming language. This meant that I could fit the whole thing into just 3,000 bytes of space, leaving a little room for any mistakes or changes that might be needed later. However, it took me longer than I thought it would to do this, and that put extra pressure on all of us.

这是一个巨大的挑战,因为我们的计算机内存空间很小。
尽管有这个限制,我仍然能够使用低级编程语言编写该软件的一个非常重要的部分,称为资源管理器。
这意味着我可以将整个内容放入 3,000 字节的空间中,为以后可能需要的任何错误或更改留出一点空间。
然而,我花费的时间比我想象的要长,这给我们所有人带来了额外的压力。

We got lucky when we found out that using resources was the answer to many problems we didn’t even know we had. Andy used a special tool to move small parts of a program to the computer’s memory, so it could run even on computers with very little memory. He also changed how the system stored and retrieved text, menus, and buttons, so they could be saved and loaded faster. Many things in the system were changed to use resources, which made it easy to store information like text strings and menus. This made it simple to make the system work in different languages and countries. Two people, Joanna and Alain, designed a system to handle different time and date formats used in different countries. Because of these changes, the Mac computer became able to work in many different languages.

当我们发现使用资源可以解决许多我们甚至不知道的问题时,我们很幸运。
安迪使用一种特殊的工具将程序的一小部分移动到计算机的内存中,这样它甚至可以在内存很少的计算机上运行。
他还改变了系统存储和检索文本、菜单和按钮的方式,以便更快地保存和加载它们。
系统中的许多内容都被更改为使用资源,这使得存储文本字符串和菜单等信息变得容易。
这使得系统在不同语言和国家/地区运行变得简单。
乔安娜和阿兰两个人设计了一个系统来处理不同国家使用的不同时间和日期格式。
由于这些变化,Mac 计算机能够以多种不同的语言运行。

Most of the information on a Mac computer was affected by a special system called the Grand Unified Model. Even temporary data, like cut and pasted text or images, was not immune. The Scrap Manager gave each piece of data a special label, called a resource type. This Mac innovation allowed multiple pieces of data, with different types, to be stored together on the computer’s clipboard. This meant that different applications could choose how to display the same data in different ways (for example, as plain text or styled text). We also made it easy to store this data on the computer’s hard drive, so we could cut and paste large amounts of information by using a temporary file called the Clipboard.

Mac 计算机上的大部分信息都受到称为“大统一模型”的特殊系统的影响。
即使是临时数据,例如剪切和粘贴的文本或图像,也不能幸免。
Scrap Manager 为每条数据赋予了一个特殊的标签,称为资源类型。
Mac 的这项创新允许将不同类型的多个数据一起存储在计算机的剪贴板上。
这意味着不同的应用程序可以选择如何以不同的方式显示相同的数据(例如,作为纯文本或样式文本)。
我们还可以轻松地将这些数据存储在计算机的硬盘驱动器上,因此我们可以使用称为剪贴板的临时文件来剪切和粘贴大量信息。

In late 1982, when I had almost finished the Resource Manager, I finally started focusing again on the Finder.

1982 年末,当我几乎完成资源管理器时,我终于开始再次关注 Finder。
目录