玻璃市警句#22 的意义

发布于 2024-08-22 14:47:04 字数 240 浏览 6 评论 0原文

来自 Alan J. Perlis 的编程警句

22。一个好的系统不能有一个弱命令语言。

这意味着什么?这个原则有哪些好的例子?

我在哪里可以了解有关如何实现满足此标准的命令语言的更多信息?

From Epigrams in Programming by Alan J. Perlis:

22. A good system can't have a weak command language.

What does this mean? What are good examples of this principle?

Where can I learn more on how to implement a command langauge that meets this criteria?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀟灑尐姊 2024-08-29 14:47:04

您必须了解制定该内容的一些背景。链接的文章于 1982 年才发表,其中任何一篇警句都可能有几十年前的历史。然而,即使 1982 年也比我的时代早,我对当时的相关印象是:

  • 计算机系统对于特定任务更加高度专业化。
  • 系统有专门的操作员(不是程序员)接受过特定系统的培训。
  • 一个系统的知识不容易转移到另一个系统。 (今天,您针对特定程序培训操作员,但很少针对特定硬件+操作系统组合进行培训。换句话说,系统变得更加相似并采用了标准和约定。)

“命令语言”只是意味着 shell 脚本今天。请记住,在 shell 提示符处输入“commands”。

抛开这些基础知识,这是我在谈论 The Unix Way™。

相比之下,Windows 程序在自动化方面要困难得多,而且许多程序(甚至操作系统)需要 GUI 来更改某些设置。 (对于 Microsoft PowerShell 的态度有所改变,但它仍然缺少其他操作系统在遵循这一原则方面数十年的经验。)

此外,当任何用户的基本操作模式是你系统的命令语言(就像 1982 年的 Unix 一样),那么你的命令语言在另一个方面很强大:所有用户都知道如何使用它,而不必学习单独的工具。在这种情况下,系统所能做的事情都是命令语言无法完成的,因为命令语言实际上就是系统

据我所知,没有任何资源可以阐明所有这些想法,并且您可以将其用作实现您自己的命令语言的路线图。这个概念比写在石头上更空灵,就像其他警句一般也是如此。我鼓励您阅读一般的 Unix、shell(例如 POSIX 的 sh 标准,以及 bash 等其他标准)、其他 shell 脚本语言(任何带有 shebang 行的语言,例如 Perl 和 Python)等等。

You have to know some of the context in which that was formulated. The linked article was only published in 1982 and any single one of those epigrams could be decades older. However, even 1982 was before my time, and my relevant impressions of then are:

  • Computer systems were more highly specialized to a specific task.
  • Systems had dedicated operators (who weren't programmers) trained on specific systems.
  • Knowledge of one system did not easily transfer to another system. (Today you train operators on specific programs, but rarely on specific hardware+OS combinations. In other words, systems have become more similar and adopted standards and conventions.)

The "command language" just means shell scripting today. Remember that at a shell prompt you enter "commands".

Those basics out of the way, this is speaking to me about The Unix Way™.

Compare to how Windows programs can have a much harder time with automation and many programs (and even the OS) require a GUI to change some settings. (The attitude towards that is somewhat changing with Microsoft PowerShell, but it's still missing the decades of experience in following this principle that other operating systems have.)

Futhermore, when the basic mode of operation for any user is your system's command language (as it was for Unix in 1982), then your command language is strong in another way: all users know how to use it and don't have to learn separate tools. In that situation there's nothing the system can do which the command language can't accomplish, because the command language effectively is the system.

I know of no single resource that spells out all of these ideas and that you can use as a roadmap to implement your own command language. The concept is more ethereal than written in stone, as the other epigrams also are in general. I encourage you to read about Unix in general, shells (e.g. POSIX's standard for sh, and others such as bash), other shell scripting languages (anything with a shebang line, such as Perl and Python), and so forth.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文