优秀软件的特点

Characteristics of Great Software

Users are attracted to the Macintosh in general and to Mac OS X specifically because they feel the combination offers a superior user experience over other platforms. Macintosh computers are stylish, flexible, easy to set up, easy to maintain, and powerful. Mac OS X combines a reliable core with an intuitive design, stunning graphics, excellent security, and the features users want. Third-party applications enhance this package by delivering specific vertical solutions with sophisticated features and behaviors that are consistent with Apple guidelines.

被吸引到 Macintosh 和 Mac OS X 的用户通常是因为他们觉得这个组合相对于其他平台来说给他们提供了更好的用户体验。Macintosh计算机气派,灵活,易于安装和维护,并且功能强大。Mac OS X 具有可靠的内核,直观的设计,出色的图形系统,优秀的安全机制,以及许多用户需要的功能。第三方的应用程序以更为精细的功能增强了 Mac OS X 的体验。

In the spirit of helping you deliver outstanding solutions in your software products, the following sections present some high-level goals to strive for in your software design.

本着帮助您发布出色的软件产品的精神,下面的小节将提出一些在您的软件设计中需要努力达到的高层的目标。

For information about the technologies you can use to implement these design attributes, see Mac OS X Technology Overview.

关于可以用来实现这些设计的技术的更多信息,请参考 Mac OS X 技术概述。

Note: Although achieving all of the goals in the following sections is desirable, doing so may not be practical or necessary in all cases. In the end, the needs of your user audience should guide you towards the most relevant choices. For more information about how to define your audience, see “Know Your Audience.”

注意:尽管达到所有的目标看起来很不错,但是不是在所有的情况下都是可行或者必要的。您的选择最终是由您的客户的需求来决定的。关于定位您的客户的具体信息,请参考“了解您的客户”。

  • High Performance
    高性能
  • Ease of Use
    易于使用
  • Attractive Appearance
    吸引人的界面
  • Reliability
    可靠
  • Adaptability
    灵活
  • Interoperability
    互操作性
  • Mobility
    移动性

高性能

High Performance

Performance is the perceived measure of how fast or efficient your software is and it is critical to the success of all software. If your software seems slow, users may be less inclined to buy it. Even software that uses the most optimal algorithms may seem slow if it spends more time processing data than responding to the user.

性能能够衡量您的软件是否运行的够快,是所有软件成功的至关重要的因素。如果您的软件太慢,用户很难对购买您的产品感兴趣。如果软件花费更多的时间来处理数据而不是响应用户的操作的话,即使它采用了最优的算法,它也可能让用户感觉很慢。

Developers who have experience programming on other platforms (including Mac OS 9) should take the time to learn about the factors that influence performance on Mac OS X. Understanding these factors can help you make better choices in your design and implementation. For an overview of performance factors and links to information on how to identify problems, see Performance Overview.

即使您在别的平台上(包括 Mac OS 9)上有丰富的编程经验,您也应该花点时间来了解 Mac OS X 影响性能的因素,这样能够帮助您在设计和实现时做出更好的选择。关于影响性能的因素以及怎样定位问题的更多信息,请参考性能概述。

Here are some performance-related guidelines to keep in mind:

下面是和性能相关的一些准则:

  • Use metrics to identify performance problems. Never try to tune the performance of your software based on assumptions. Use the Apple-provided tools, such as Shark, to gather data about where your software is performing poorly. Use that data to isolate problems and fix them. You might also want to create your own tools to gather metrics that are specific to your software.
使用测试数据来确定性能问题。永远不要基于假设来调整您的产品的性能。使用 Apple 提供的工具,如 Shark,来收集产品的性能数据,并使用这些数据来分析和解决问题。您也可以创建您自己的测试工具来收集您产品特定的数据。
  • Avoid waiting until the end of your development cycle to do performance tuning. Include specific goals in your product requirements. Gather baseline metrics early and continue gathering metrics during development to measure progress against those goals. If you see performance degrading, take immediate corrective actions to fix the problem.
避免在产品开发周期的后期进行性能调整。将性能目标加入您的产品需求中,在早期就开始收集性能数据来测试是否达到预定的目标,并在开发过程中一直坚持这一行为。如果您发现性能下降,那么立即采取动作来修正它。
  • Choose modern APIs over legacy APIs. Modern interfaces are built for Mac OS X and take advantage of the latest technology and design information to deliver the best possible performance.
使用新的 API 而不是早期的 API。新的 API 针对 Mac OS X 采用了最新的技术和设计,从而提供了良好的性能。
  • Choose appropriate technologies for the task at hand. For example, Cocoa distributed objects may be easier to use, but if your program needs maximum performance over the network, CFNetwork or BSD sockets may be a better choice. See CFNetwork Programming Guide for more information.
选择合适的技术。例如,基于 Cocoa 的对象可能易于使用,但如果您的程序对网络操作的性能有很高的要求,CFNetwork 或者 BSD 套接字 API 可能是更好的选择。更多信息请参考 CFNetwork 编程指南。
  • Use threads to improve the responsiveness of your code. Taking advantage of the parallelism offered by threads can offer significant performance advantages, especially on multiprocessor systems. Technical Note TN2028, “Threading Architectures” includes an excellent overview of threading architectures. See “Threads” for more information.
使用线程来提高程序的响应速度。利用线程提供的并行机制可以显著的提高性能,尤其是在多处理器系统中。技术规范TN2028“线程架构”提供了对线程编程框架的概括性描述。更多信息请参考“线程”章节。
  • Avoid polling the system for information. Polling wastes a significant amount of CPU time and is unnecessary with most modern APIs. Most modern APIs provide asynchronous callback mechanisms to notify you when conditions change or requested data is available. Use these mechanisms instead.
避免使用轮询来获取信息。轮询机制浪费了大量的 CPU 周期,而且是完全没有必要的,因为现在的 API 可以提供异步的回调机制来让您在条件变化或者需求的数据可用时获得通知。
  • Eliminate any unnecessary I/O operations. Accessing a hard drive or optical drive is one of the slowest operations you can perform on any computer. Minimizing these operations can improve performance tremendously. See File-System Performance Guidelines for more information.
减少不必要的 I/O 操作。访问硬盘或者光驱在任何计算机上都是最慢的操作之一。减少这些操作能够显著的提高程序的性能。更多信息请参考文件系统性能指南。
  • Optimize your memory usage to take advantage of the Mac OS X virtual memory system. Understanding how virtual memory works in Mac OS X can help you make more efficient use of memory. See Memory Usage Performance Guidelines for information about the Mac OS X virtual memory system.
优化内存使用以更好的利用 Mac OS X 的虚拟内存系统。了解 Mac OS X 的虚拟内存工作机制能够帮助您更有效的利用内存。更多 Mac OS X 虚拟内存机制的信息请参考内存使用的性能指南。
  • Avoid loading resources until they are actually needed by your software. Loading resources early wastes memory and can trigger paging before the resource is ever used. Wait until you need the resource and then cache it as appropriate.
避免加载不必要的资源。过早的加载资源文件会导致内存的浪费,并且可能触发内存换页。直到需要的时候才加载资源文件,然后进行合适的缓存。
  • Use the Mach-O executable format. Mach-O is the native executable format of Mac OS X and is used by all system frameworks. Using the legacy Code Fragment Manager (CFM) executable format requires additional bridging code between your code and system libraries. This bridging incurs a small performance penalty that can add up over time.
执行文件使用 Mach-O 格式。Mach-O 是原生的执行文件格式,并且被 Mac OS X 上所有系统框架使用。如果您使用早期的 CFM(Code Fragment Manager)格式,则需要在您的执行文件和系统库之间进行桥接,这种桥接会导致额外的一点性能开销。

易于使用

Ease of Use

An easy-to-use program offers a compelling, intuitive experience for the user. It offers elegant solutions to complex problems and has a well thought out interface that uses familiar paradigms. It is easy to install and configure because it makes intelligent choices for the user, but it also gives the user the option to override those choices when needed. It presents the user with tools that are relevant in the current context, eliminating or disabling irrelevant tools. It also warns the user against performing dangerous actions and provides ways to undo those actions if taken.

易于使用的程序给用户以引人注目的,直观的用户体验。这些程序让复杂的问题变得简单,并且具有经过深思熟虑的用户接口,很容易安装和配置,因为它已经为用户做出了智能的选择,但是用户也可以做出自己的选择。它能够在游戏中只显示和当前上下文有关的部分,而隐藏或者关掉那些不相关的部分。它能够在用户做一些危险的操作时给出警告,并且可以撤销已经实施的操作。

Here are some guidelines to keep in mind when designing for ease of use:

下面是和易用性有关的一些准则:

  • In your user interface, use metaphors that represent concrete, familiar ideas. Make your metaphors obvious so that users can more easily apply a set of expectations to the computer environment. For example, Mac OS X uses the metaphor of file folders for storing documents. For more information, see “Metaphors.”
尽可能的使用隐喻来表示一些熟悉的概念。当用户一看到您的隐喻时就对计算机的环境有一个大概的映像。例如,Mac OS X 使用文件夹的隐喻来保存文档。更多信息请参考“隐喻”。
  • Focus on solutions, not features. Avoid adding features solely for competitive reasons. Make sure every feature offers real benefit to your users. See “Making Design Decisions” for additional information.
关注解决问题的方法而不是功能。避免仅仅因为市场竞争的原因加入新功能。确保程序的每个功能都能够给您的用户带来收益。 更多信息请参考“做出设计决定”一节。
  • Make sure your packaging clearly indicates the system requirements and contains everything the user needs to get started immediately. See “Packaging” for more information.
确保您的程序的安装包清晰的标明了对系统的要求,并且已经包括了使用程序所需要的一切资源。更多信息请参考“程序包”。
  • Establish intelligent default settings for your program. Avoid requiring a lengthy configuration process. Consider providing a setup assistant if you need information from the user (see “Setup Assistants” for more information). Provide your users with appropriate initial settings and give them the option to change those settings using preferences or options panels.
提供足够智能化的默认设置。避免冗长的配置过程。如果您需要从用户那获取一些信息,可以考虑提供一个配置助手(更多信息请参考 “配置助手”)。为您的用户提供合适的初始配置并允许他们在偏好设置选项里面更改这些配置。
  • Try not to overwhelm users by presenting too much information at once. Use progressive disclosure to reveal information as it is needed and give users the option to hide information they don’t consider useful. See “Managing Complexity in Your Software” for additional information.
避免一次给用户传达大量的信息,而是在需要时逐渐显示给用户,并且允许用户隐藏掉他们认为没用的信息。更多信息请参考“管理您的软件的复杂度”。
  • Bundle your application. Application bundles are the preferred mechanism for software distribution. They simplify installation and are easy to move around in the Finder. See Bundle Programming Guide for guidelines on how to support bundles.
以程序包的形式发布您的程序。程序包是推荐的软件分发机制,因为其简化了安装过程并且很容易在 Finder 中拖动。关于怎样支持程序包的指导手册请参考程序包编程指南。
  • If you are a hardware developer, support published standards for plug-and-play hardware. Mac OS X supports many published hardware standards for USB and FireWire devices such as mice, keyboards, and hard drives. If you follow these standards, new devices should “just work” when plugged into the computer and not require custom device drivers. See I/O Kit Fundamentals for information on built-in driver support.
如果您是一个硬件的开发人员,则尽量让你的即插即用硬件支持那些公开的标准。Mac OS X 支持很多 USB 和火线上公开的的硬件标准,如鼠标,键盘以及硬盘等。如果您符合这些标准,则您的新的硬件插到就计算机就可以使用而无需定制设备驱动。关于内建的驱动支持请参考 I/O Kit 基础。
  • Avoid the assumption that a single user is logged in and that the current user has access to the console. Fast user switching means that multiple instances of your application could be running simultaneously. Your application should be ready to handle this situation appropriately. See Multiple User Environments for information on how to operate safely when fast user switching is enabled.
不要假设计算机上只有单个用户登入,而且当前用户能够访问终端。快速用户切换意味着您的程序可能有多个实例在同时运行。您的程序应该合理的处理这种情况。关于快速用户切换开启时怎么安全处理这种情形的信息请参考多用户环境。
  • Provide useful error messages to users when something does go wrong. An error message should clearly convey what happened, why it happened, and the options for proceeding. Offer a workaround if one is available and do whatever you can to prevent the user from losing any data. See “Alerts” for more information on how to provide useful error messages.
提供有意义的出错信息。错误信息应该清楚地说明发生了什么事情,为什么为发生,以及用户接下来能做些什么。如果可能的话提供一个替代方案,并且尽一切可能防止用户数据的丢失。关于如何提供有效的错误提示的更多信息请参考“告警”一节。
  • Use display names in your user interface in place of raw pathnames and filenames. Display names take into account the user’s established language preferences and filename extension preferences. See File System Overview for more information on display names and guidelines on how to support them.
使用显示名而不是原始的路径名和文件名。显示名会考虑到用户的语言环境和文件扩展名设置。关于显示名以及怎样在您的程序中支持显示名的更多信息请参考文件系统概述。
  • Let users explore the features of your application without causing irreversible damage to their data. Support features such as Undo and Redo. You might also want to support a Revert feature for files.
让用户可以尝试程序的新功能而不用担心毁坏数据。在程序中支持撤销和重复操作的功能,对于文件您可能需要支持恢复功能。
  • Internationalize your software. Provide localized versions whenever possible. Users feel more comfortable using a program that is in their native language. See “Internationalization” for additional information.
提供国际化支持。尽可能的提供程序的本地化版本。使用母语语言的程序对用户来说更为愉快。更多信息请参考“国际化”。
  • Make your application accessible to people with disabilities. Assistive applications interact with your application and allow people with disabilities to use it. Although much support for accessibility is provided automatically by the system, there are things you can do to improve that support. See Getting Started With Accessibility for an overview of available information.
支持具有身体缺陷的人士。辅助程序能和您的程序交互从而允许有障碍的人士也能够使用您的程序。尽管很多辅助功能都有系统自动提供,但是您仍然可以做一下工作以让您的程序支持得更好。更多信息请参考辅助功能初步。
  • Provide appropriate documentation for your software. Apple Help is an HTML-based help system that lets you integrate documentation into your application. See Apple Help Programming Guide for information on how to incorporate Apple Help into your applications.
提供帮助文档。Apple 帮助系统是一个基于 HTML 的帮助系统,能够让您将帮助文档集成到您的程序中。关于 Apple 帮助的具体信息,请参考 Apple 帮助系统编程指南。

For high-level information on designing an easy-to-use interface, see “Human Interface Design Principles.”

关于设计易于使用的用户接口的更高层的信息,请参考“人机接口设计准则”。

吸引人的界面

Attractive Appearance

One feature that draws users to the Macintosh platform, and to Mac OS X in particular, is the stylish design and attractive appearance of the hardware and software. Although creating attractive hardware and system software is Apple’s job, you should take advantage of the strengths of Mac OS X to give your own software an attractive appearance.

吸引用户使用 Macintosh 平台和 Mac OS X 系统的一个重要特性就是硬件和软件特有的格调和吸引人的外观。尽管生产吸引人的硬件和系统软件是 Apple 的事情,但您仍然可以利用 Mac OS X 来给您自己的软件一个漂亮的界面。

The Finder and other applications that come with Mac OS X use high-resolution, high-quality graphics and icons that include 32-bit color and transparency. Make sure that your applications also use high-quality graphics both for the sake of appearance and to better convey relevant information to users. For example, the system uses pulsing buttons to identify the most likely choice and transparency effects to add a dimensional quality to windows.

Finder 和其他 Mac OS X 系统提供的程序使用的是高分辨率,高质量的,支持透明和 32 位色的图标。确保您的程序同样使用高质量的图片,不仅是为了程序的好看,也是为了更好的向用户传递信息。例如,系统使用闪烁的按钮来标识最可能的选择以及使用透明效果来给窗口增加立体感。

Here are some guidelines to keep in mind as you design the appearance of your software:

下面是程序界面设计的一些准则:

  • Follow the guidelines in Part III of this document when designing your user interface. The guidelines offer advice on how to lay out content and design the visual appearance of your software.
    遵守本文档第三部分给出的指导准则。这些准则给出了怎样布局和设计您的程序界面的建议。
  • From packaging to user interface polish, make sure your software looks professionally designed.
    从程序安装包到用户界面,让您的程序看起来经过了专业的设计。

    • Use high-quality graphics and icons. If needed, contract with a professional graphic design firm to create these for you.
      使用高质量的图片和图标。有必要的话,联系专业的设计公司来为您设计。
    • Adopt standard Mac OS X user-interface elements, such as controls, menus, and dialogs. Do not implement your own custom controls or dialogs to replace those provided by the system.
      采用标准的 Mac OS X 用户接口元素,例如控件,菜单,对话框等。不要试图用自己实现同样功能的控件。
    • Refer to the guidelines in this document if you absolutely need a control that is not provided by the system and read “Extending the Interface” before you decide to create a new element or change the behavior or an existing element.
      如果您一定需要一个定制的控件而不是系统提供的标准控件,请仔细阅读本文档。在您决定创建一个新的界面元素或者更改一个现有的界面元素的行为之前确保您已经阅读“扩展用户接口” 一节。
  • Use 32-bit color. Mac OS X is optimized to provide the best performance for 32-bit color. You don’t have to limit yourself to an 8-bit color palette for visual elements. Support for 8-bit graphics is minimal and available mostly to support legacy applications.
    使用 32 位色。Mac OS X 为 32 位色经过了性能上良好的优化。不要仍然采用 8 位色的调色板。Mac OS X 仍然支持 8 位的调色板只是为了和遗留的程序兼容。
  • Use Interface Builder to design your user interface. Even if you do not use the resulting nib files, you can use the metrics provided by Interface Builder to lay out your views and controls precisely in your code. See Interface Builder for an introduction to this application’s features.
    使用 Interface Builder 来设计用户接口。即使您并不使用最后的 nib 文件,您也可以使用 Interface Builder 提供的工具来在代码中对您的视图和控件进行精确的布局。关于 Interface Builder 的更多信息请参考 Interface Builder 一节。
  • Render your text and graphics using modern APIs such as Quartz, Cocoa, ATSUI, and OpenGL. Avoid using legacy drawing APIs such as QuickDraw.
    使用新的 API 来渲染字体和图片,如 Quartz, Cocoa, ATSUI 和 OpenGL 等。避免使用早期的 API 如 QuickDraw 等。

可靠

Reliability

A reliable program is one that earns the user’s trust. Such a program presents information to the user in an expected and desired way. A reliable program maintains the integrity of the user’s data and does everything possible to prevent data loss or corruption. It also has a certain amount of maturity to it and can handle complex situations without crashing.

可靠的程序才会赢得用户的信任。这样的程序总是将信息以用户期望的方式呈献给用户,总是能够保证用户数据的完整性并且尽一切可能的防止用户数据的丢失和损坏。可靠的程序能够处理很复杂的情况而不会崩溃。

Reliability is important in all areas of software design, but especially in areas where a program may be running for an extended period of time. For example, scientific programs often perform calculations on large data sets and can take a long time to complete. If such a program were to crash during a long calculation, the scientist could lose days or weeks worth of work.

可靠性在软件设计中十分重要,尤其是一个程序需要长期的运行时。例如,进行科学计算的程序经常需要很长时间来计算大量的数据。如果这样的程序在长期计算的过程中崩溃了,就可能浪费了科学家们好几个星期的工作。

Here are some guidelines to keep in mind as you design your software for reliability:

下面是在软件设计中关于可靠性的一些准则:

  • Make sure your user interface behaves in a predictable way. The same set of actions should generate the same results each time. See “Consistency” for additional information.
确保用户接口的行为可预期。同样的操作应该导致同样的结果。更多信息请参考“一致性”一节。
  • Provide predictable output from your documents. For printing, make sure that the content the user sees on the screen is what gets printed. (Note that the Mac OS X printing dialogs provide a print preview option for you.)
提供可预期的文档输出结果。例如打印,确保用户在屏幕所见的内容和打印出来的内容一致。(注意 Mac OS X 的打印对话框为您提供了打印预览的选项。)
  • Reduce or eliminate data loss when importing or exporting documents. If your program imports or exports files associated with other applications, make sure you fully support the file format. If your application cannot import all data from a given file format, warn the user that data loss may occur and offer the option to work on a copy of the original file.
减少或者消除导入或者导出文档时的数据丢失。如果您的程序需要导入或者导出和别的程序相关的文件,请确保您已经完全支持了该文件格式。如果您的程序不能导入给定文件格式的所有数据,您应该警告用户数据可能丢失并且提供选项以维护一份原文件副本。
  • Test your software under a wide variety of conditions and verify that it responds appropriately. Simulate the network going down or a mounted volume disappearing and ensure that your software adapts appropriately.
在多种条件下对您的程序进行广泛测试以确保工作正常。模拟网络断开和已经打开的卷消失的情况来确保您的程序可以正确处理这些情况。
  • Make sure your packaging clearly indicates the system requirements for your software. Don’t assume your software runs on lower-end hardware until you test it on that hardware. Similarly, indicate which versions of Mac OS X you support.
确保您的程序安装包清楚地标明了对系统的要求。除非您已经在低端硬件上测试过,否则不要假设您的程序可以在这些硬件上工作。类似的,标明您的程序支持的Mac OS X版本。
  • Anticipate errors and handle them gracefully. If a function returns a result code, check it to see if there was a problem and respond appropriately. You can also use exception handlers to catch errors; however, use them sparingly. Exception handlers increase the memory footprint of your application, which can degrade performance.
预先处理错误。检查函数的返回值来确定是不是有错误发生。您也可以使用异常处理机制来捕捉错误。然而, 尽量少用。异常处理增加了内存占用量,会降低您的程序性能。
  • Validate user input to ensure that it is what you expect. Formatter objects help ensure that users enter numbers and dates correctly. (For information on formatting data in a Carbon application, see Data Formatting Guide for Core Foundation. For information on formatting data in a Cocoa application, see Data Formatting Programming Guide for Cocoa.) Your own code should validate user-entered data to prevent it from causing problems later. See “The Functions of Specific Keys” for information on how a user uses specific keys to enter data.
验证用户的输入以确保它符合您的预期。Formatter对象能够帮助您确保用户正确的输入了数字和日期。(关于Carbon程序中格式化数据的更多信息,请参考 Core Foundation 中的格式数据编程指南。关于Cocoa程序中的格式化数据信息,请参考 Cocoa 中的格式数据编程指南。)您的代码也应该验证用户输入的数据以免程序出错。关于怎样要求用户使用指定按键输入数据的更多信息请参考“指定按键输入”。
  • Use the Apple-provided performance and debugging tools to find memory leaks and other problem areas in your code. These tools can uncover hidden bugs that you did not know you had.
使用 Apple 提供的性能和调式工具来寻找代码中的内存泄露和其他问题。这些工具能帮您找到您自己还没有意识到的 bug。
  • Choose modern APIs over legacy APIs. Modern APIs provide better handling of system configuration changes than legacy APIs.
使用新的 API 代替早期的 API。新的 API 比老的 API 能更好的处理系统配置的改动。
  • Prefer system and standards-based APIs to your own custom APIs. See “Using Mac OS X Technologies” for additional information.
尽可能的使用系统提供的或者基于标准的 API 而不是您自己定制的 API。更多信息请参考“使用 Mac OS X 技术”。

灵活

Adaptability

An adaptable program is one that adjusts appropriately to its surroundings; that is, it does not stop working when the current conditions change. If a network connection goes down, an adaptable program lets the user continue to work offline. Similarly, if certain resources are locked or become unavailable, an adaptable program finds other ways to meet the user’s request.

一个灵活的程序就是能够适应它的环境的程序,也就是说,即使目前的情况改变了,它仍然能够工作。如果网络连接断开了,一个具有良好的适应性的程序可以让用户继续在脱机模式下工作。类似的,如果某个资源被锁定或者不可用,具有良好适应性的程序会寻找其他途径来满足用户的要求。

One of the strengths of Mac OS X is its ability to adapt to configuration changes quickly and easily. For example, if the user changes a computer’s network configuration from System Preferences, the changes are automatically picked up by applications such as Safari and Mail, which use CFNetwork to handle network configuration changes automatically.

Mac OS X一个强大的地方就是能够快速方便的适应配置环境的变化。例如,如果用户在系统偏好设置中改变了网络的配置,使用CFNetwork框架的应用程序如Safari,Mail都能自动的应用新的网络配置。

Here are some guidelines to keep in mind as you design your software to be adaptable:

下面是设计具有良好适应性程序的一些准则:

  • Build forgiveness and intelligence into your interface. Make sure your software can handle cases in which a file-system volume or the network disappears. Offer the user an option for saving files to a different volume or reconnecting to the network later.
在您的接口设计中提供容错性和灵活性考虑。确保在文件系统中的卷宗或者网络断开时您的软件能够提供将文件保存到其他卷宗或者稍后重新连接的选项。
  • Avoid making assumptions about available hardware and access to that hardware. Hardware configurations can vary greatly based on the computer, country, and user. For example, not every Macintosh is equipped with Velocity Engine on the processor. Similarly, not all keyboards have the same set of keys. Hardware can also be added or removed at runtime. Use the I/O Kit interfaces to detect available device configurations. See Accessing Hardware From Applications for more information.
避免假设硬件的存在并直接访问该硬件。硬件配置很大程度上随计算机、国家、用户的不同而不同。例如,不是每个 Macintosh 计算机都在处理器上装备了加速引擎(速度计)。类似的,不是所有的键盘都是同样的键盘配置。用户可能在运行时增加和删减硬件。使用 I/O Kit 接口来检测可用的设备配置。更多信息请参考在程序中访问硬件。
  • Avoid making assumptions based on the current user’s locale. Be prepared to handle different date, time, and number formats. Also, don’t assume that the address format of the current user is the only address format in use. For example, the user may store contacts with foreign addresses in Address Book.
不要只考虑当前用户的语言环境。处理不同格式的日期、时间和数字。同样,不要假设当前用户的地址格式就是唯一使用的地址格式。例如,用户在地址簿中保存的联系人中可能具有国外地址。
  • Avoid making assumptions about your execution environment. If your program is running in a NetBoot environment, your access to the system resources may be limited or read-only. For example, in a typical NetBoot environment, only the user’s home directory is writable.
不要对您的运行环境做出假设。如果您的程序运行在网络启动的环境中,系统资源可能只能只读地访问,甚至不能访问。例如,在典型的网络启动环境中,只有用户的主目录是可写的。
  • Use Bonjour to automatically discover devices and network services on IP networks. Don’t make the user type in an IP address or configure a DNS server.
  • Be sensitive to changes in screen availability and resolution. Mac OS X supports hot-plugging of monitors and notifies applications of the changes through Quartz Services. Your software should respond appropriately by adjusting window locations and dimensions as described in “Window Behavior.”
随时检测屏幕的可用性及其分辨率。Mac OS X 支持热插拔显示器,并且通过 Quartz 服务来通知应用程序这一变化。您的程序需要正确的调整窗口的位置和坐标,具体信息请参考“[[macos:window-behavior|窗口的行为”。
  • Use modern system APIs. Apple works to ensure that its modern system APIs properly handle configuration changes. Although some legacy APIs may also support configuration changes, that support may change in future releases.
使用新的系统 API。Apple 只保证新的系统 API 能够正确的处理配置的改变。尽管有些早期的 API 也能支持这一点,然而在将来的版本中他们可能不再支持。
  • Avoid writing custom device drivers. The I/O Kit contains working drivers to support many standard protocols and device types. Relying on these drivers means your hardware should automatically work with each new version of Mac OS X.
避免编写定制的设备驱动。I/O Kit 已经包含了很多标准的协议和设备的驱动。如果使用这些标准驱动意味着您的硬件可以工作在每个新版本的 Mac OS X 中。

互操作

Interoperability

Interoperability refers to a program’s ability to communicate across environments. This communication can occur at either the user or the program level and can involve processes on the current computer or on remote computers. At the program level, an interoperable program supports ways to move data back and forth between itself and other programs. It might therefore support the pasteboard and be able to read file formats from other programs on either the same or a different platform. It also makes sure that the data it creates can be read by other programs on the system.

互操作指程序和环境交互的能力。这种交互可以发生在用户身上也可以发生在程序身上。可以和当前计算机的进程也可以和远程计算机的进程交互。在程序级别,一个可互操作的程序意味着支持和其他程序交换数据。程序支持剪贴板,可以从相同平台或者不同平台的程序中读入不同格式的文件,并可以确保自己创建的数据能够被系统其他的程序读取。

Users see interoperability in features such as the pasteboard (the Clipboard in the user interface), drag and drop, AppleScript, Bonjour, and services in the Services menu. All these features provide ways for the user to get data into or out of an application.

用户可以从粘贴版,拖拽,AppleScript,Bonjour以及服务菜单项中的服务来获知程序的互操作性。所有的这些功能都向用户提供了在程序外获取数据的方式。

Here are some guidelines to keep in mind as you design your software for interoperability:

下面是在设计过程中关于互操作性的一些准则:

  • Avoid custom file formats whenever possible to ensure that users can easily exchange documents with users of other programs. If you must use custom file formats, provide import and export capabilities to allow users to exchange data with other applications.
避免使用自定义的文件格式,从而让用户可以方便的和其他程序的用户交换文档。如果您必须使用自定义的文件格式,则提供导入和导出的功能以允许用户和其他的程序交换数据。
  • Use the same file format on all supported platforms. Make sure documents created by your application on one platform can be read by your application on other platforms.
在所有支持的平台上使用同样的文件格式。确保在一个平台上您的程序创建的文件能够在另外一个平台被您的程序打开。
  • Support filename extensions to ensure that users on other platforms can recognize and open your files. See File System Overview for more information on the importance of filename extensions.
支持文件扩展名以确保其他平台的用户能够识别和打开您的文件。文件扩展名的更多信息请参考文件系统概述。
  • Use standard protocols for data interchange whenever possible. XML is a preferred format for exchanging data among applications and platforms because it is cross-platform and widely supported. Mac OS X also supports numerous network protocols, as listed in Mac OS X Technology Overview.
尽可能的使用标准的协议来进行数据交互。XML是数据交互首选的格式,因为它可以跨平台并且被广泛支持。Mac OS X同样支持大量的网络协议,见Mac OS X技术概述。
  • Save configuration data using the Mac OS X preferences system implementations offered by Cocoa and Core Foundation. These implementations store configuration data in plain-text files, which gives the user the opportunity to modify the data either directly or with a script.
使用Cocoa和Core Foundation提供的Mac OS X配置系统实现来保存配置数据。这些实现将配置数据保存为纯文本文件,从而让用户可以直接或者通过脚本来修改这些数据。
  • Design your AppleScript object model carefully to allow for flexibility and future expansion. Good AppleScript integration requires some thought as to how users or other programs might interact with your data. It also requires careful integration with your program’s data structures. See Scripting Interface Guidelines for more information.
仔细设计您的AppleScript对象模型以具有灵活性和扩展性。良好的AppleScript集成需要考虑用户和其他程序可能怎样和您的数据交互,同时也需要对您的程序的数据结构进行集成。更多信息请参考脚本接口设计指南。

For more information on how to leverage Mac OS X features and technologies in your application, see “[[macos:using-mac-os-x-technologies|Using Mac OS X Technologies].”

关于在程序中使用Mac OS X功能和技术的更多信息,请参考 “使用Mac OS X技术。”

移动性

Mobility

Designing for mobility has become increasingly important as laptop usage soars. A program that supports mobility doesn’t waste battery power by polling the system or accessing peripherals unnecessarily, nor does it break when the user moves from place to place, changes monitor configurations, puts the computer to sleep, or wakes the computer up.

随着手提电脑的使用,对移动性的支持变得越来越重要。一个良好支持移动性的程序既不会轮询系统或者作不必要的访问来浪费电池,也不会在用户移动,显示器更改,计算机睡眠或者计算机唤醒时崩溃。

To support mobility, programs need to be able to adjust to different system configurations, including network configuration changes. Many hardware devices can be plugged in and unplugged while the computer is still running. Mobility-aware programs should respond to these changes gracefully. They should also be sensitive to issues such as power usage. Constantly accessing a hard drive or optical drive can drain the battery of a laptop quickly. Be considerate of mobile users by helping them use their computer longer on a single battery charge.

为了支持移动性,程序需要能够适应不能的系统配置,包括网络配置的改动。在计算机运行时,可能有很多硬件插入或者拔出。支持移动性的程序必须合适的响应这些变化。这些程序还必须考虑电源的使用。长时间的访问硬盘或者光驱将很快用光手提电脑的电池。这些程序需要为移动用户考虑,帮助他们的电脑在一块电池的情况下运行的时间更长。

Here are some guidelines to keep in mind as you design your software to support mobility:

下面是设计过程中关于移动性的一些准则:

  • Avoid polling for events. Polling the system needlessly wastes CPU time, which in turn wastes battery power on portable systems. Most modern APIs have ways of notifying your program when something interesting happens. Register to receive these notifications and respond to them as appropriate; otherwise (if your program has nothing to do), it should be completely idle.
免轮询事件。无谓的轮询系统将浪费CPU时间,在移动平台上就是浪费电池。很多新的API都提供了在您感兴趣的事件发生时通知您的功能。您可以在系统注册以接受这些通知并响应这些通知,否则(如果您的程序没什么要做的话),程序应该是完全空闲的。
  • Try not to require that the user insert the program CD when using your software. Give the user an option to install everything on a local hard drive.
不要强迫用户必须插入光盘才能运行您的程序。您应该给用户提供选项,以把一切都安装在本地的硬盘上。
  • Minimize access to files on the hard drive or on an optical drive. In addition to improving performance, you can reduce battery consumption by letting the drives spin down more frequently.
减少对硬盘和光驱上文件的访问。这样不仅能提高程序的性能,也能够减少电池的消耗。
  • Use modern networking interfaces to adapt to network configuration changes. Mobile users may change locations or wireless access points at any time. Use CFNetwork and other modern interfaces to handle these configuration changes for you.
使用新的网络接口API来适应网络配置的变化。移动用户可能在任何时候更改位置和无线接入点。使用CFNetwork和其他的新的网络接口API来处理这些变化。
  • Be forgiving when accessing the file system, in case network volumes go offline. If a network volume disappears, notify the user and provide an option to save files to a different volume.
访问文件系统时提供一定的容错度。当网络卷断线时。通知用户并且提供将文件保存到其他卷的选项。
  • Be sensitive to screen resolution changes and the plugging in and unplugging of monitors. Mobile users may need to plug in a projector or other device that requires a different resolution, so do not assume a fixed screen size in your software. If a monitor disappears, adjust the position of any windows that were on that monitor so that they remain visible.
检测屏幕分辨率的改动和显示器的插入及拔出。移动用户可能会连接不同分辨率的投影仪或者其他设备,所以不要在您的软件中总是假设一个固定的分辨率。如果一个显示器不可用了,调整那个显示器上所有窗口的位置以让这些窗口仍然可见。

[转]二.优秀软件的特点相关推荐

  1. [组图]S60十大优秀软件精心推荐(二)(转)

    这是一款symbian智能手机十分优秀的电子书软件.不但可以欣赏纯文本的文字作品,而且可以欣赏文图并茂的漫画.支持的格式为UMD格式.具备丰富的阅读功能.阅读模式可以在自动浏览和手机浏览?淝谢弧?梢陨 ...

  2. 软件推荐:16个你还没用过的优秀软件(多个类别)

    相信大家都知道这样的一句话:工欲善其事,必先利其器.因此下面小编将搜集到的多款优秀软件推荐给大家.这些软件可以简单分为视频类.效率提升类.阅读笔记写作类.运动健康类.英语学习类和计算机专业相关类. 一 ...

  3. tp5支持啥数据库_MS Access数据库是被严重低估的一款优秀软件

    了解我的朋友,都知道我是个计算机编程爱好者,我没事愿意鼓捣一些计算机软件编程,没事爱在朋友圈里发一发编程的截图,经常惹来一阵阵赞叹. 每当给我点赞的朋友们问我用什么编程语言开发的时候,我都如实相告-- ...

  4. 福师计算机应用基础在线作业二及答,福师《计算机应用基础》在线作业二 下列软件中属于应用软件的是.docx...

    福师<计算机应用基础>在线作业二 下列软件中属于应用软件的是.docx 计算机应用基础计算机应用基础1 1 单选题单选题1 下列软件中属于应用软件的是() D A 操作系统B 编译程序C ...

  5. 【华为云技术分享】如何做一个优秀软件-可扩展的架构,良好的编码,可信的过程

    1.可信软件的基础是软件优秀 可信突破是阶段性工作,可信只是优秀软件的一部分,单独追求可信是缘木求鱼. 2.什么是优秀软件 要系统的考虑如何开发优秀软件 对外:功能多,性能好,用户体验好,生态丰富 内 ...

  6. GitLab CTO:开源是打造优秀软件的核心

    开源正在吞噬整个互联网,成为互联网技术的默认选择. 2018年是"开源(Open Source)"这个专用名词诞生的第20个年头.由开源社主办的2018中国开源年会COSCon'1 ...

  7. 计算机的二三事——软件篇

    计算机的二三事--软件篇 写在前面 第一部分 操作系统 1.1 操作系统(OS) Windows MacOS Linux 1.2 操作系统的架构(x86(32位)/x64(64位)/arm(64位)) ...

  8. Joel谈优秀软件开发-摘录

    Joel谈优秀软件开发这本书在图书馆近日稍微看另一部分,更像一个散文集,讲了软件开发中的方方面面.下面是一些记录,书本中提到的一些网址摘录在下面,大家有空的可以去看看,有些挺不错的. 1.Ken Ar ...

  9. 二、软件项目开发计划书-模板

    二.软件项目开发计划书 1.引言 1 1.1编写目的 1 1.2项目背景 1 1.3定义 2 1.4参考资料 2 2.项目概述 2 2.1工作内容 2 2.2条件与限制 2 2.3产品 2 2.4运行 ...

最新文章

  1. ESXi6.5环境搭建(五:常见问题及解决方案实验总结)
  2. Python中遍历整个列表及注意点(参考书籍Python编程从入门到实践)
  3. docker镜像启动后端口号是多少_14,Docker容器必知必会,你会了吗?
  4. C# ConcurrentBag实现
  5. 安卓自定义边栏英文索引控件
  6. java8 streams_使用Java 8 Streams进行编程对算法性能的影响
  7. Bootloader传参数到Kernel
  8. HDU各种比赛题题解(一)
  9. java 计算器 junit测试_测试工具之JUnit4 结合Mockito模拟测试代码
  10. mysql觸發器_mysql觸發器案例
  11. VSTO入门学习笔记5-数组
  12. Android 读取按键及Touch Panel
  13. cmd打开计算机窗口,如何打开命令行窗口,详细教您电脑怎么打开cmd命令行窗口...
  14. Thinkpad笔记本键盘拆卸
  15. WIN10进不了BIOS的解决办法
  16. 西门子PLC——CANopen系统通信解决方案
  17. JavaScript首次体验
  18. bzoj1022: [SHOI2008]小约翰的游戏John 博弈
  19. 不为人知的几个微信实用技巧
  20. 编译原理 实验三 LR(1)分析法 Java

热门文章

  1. marquee详细属性
  2. MATLAB下配置C和C++编译器(MinGW)
  3. IE与Firefox火狐的CSS兼容大全
  4. Spring-StopWatch的使用
  5. bbp代码python_如何正确计算加密债券价格的BBP(Bollinger波段百分比)?
  6. 医疗器械经营与服务类毕业论文文献有哪些?
  7. 使用74LS245驱动8×8LED点阵屏显示数字
  8. C++设计模式 | Factory工厂模式(简单工厂、工厂方法、抽象工厂)
  9. ASP.NET控件集合
  10. [年终总结] 2023,希望一切都能够好起来