注:本文为 “” 相关文章合辑。
机翻,未校。
布莱恩·W.克尼汉(Brian W. Kernighan)—— Unix 和 C 语言背后的巨人

布莱恩·W.克尼汉在 1942 年出生在加拿大多伦多,他在普林斯顿大学取得了电气工程的博士学位,2000 年之后取得普林斯顿大学计算机科学的教授教职。
1973 年,他与 Shen Lin 合作共同完成了两个知名的 NP-complete 优化问题的解决方案:图划分问题和旅行推销员问题。
Graph partition 图形分区
在数学中,图分区是通过将图的节点集划分为互斥的组来将图简化为较小的图。在组之间交叉的原始图的边将在分区图中产生边。如果生成的边的数量与原始图相比较小,则分区图可能比原始图更适合分析和解决问题。
通常,图分区问题属于 NP 难题的范畴。这些问题的解决方案通常使用启发式和近似算法得出。然而,均匀图分区或平衡图分区问题可以证明在任何有限因子内都是 NP 完备的。
S. Lin and B. W. Kernighan.1970
An Efficient Heuristic Procedure for Partitioning Graphs
http://eda.ee.ucla.edu/EE201A-04Spring/kl.pdf
旅行推销员问题(Travelling Salesman Problem, 又称为旅行商问题)
TSP 问题是一个多局部最优的最优化问题:有 n 个城市,一个推销员要从其中某一个城市出发,唯一走遍所有的城市,再回到他出发的城市,求最短的路线。
S. Lin and B. W. Kernighan.1973
An Effective Heuristic Algorithm for the Traveling-Salesman Problem
https://www.cs.princeton.edu/~bwk/btl.mirror/tsp.pdf
布莱恩·W.克尼汉不仅是著名的 K&R(Kernighan and Ritchie)中的 K,是 AWK(Alfred Aho、Peter Weinberger 和 Brian Kernighan)中的 K,也是 AMLP(A Mathematical Programming Language,数学编程语言)的创造者之一。
在编译器 Ratfor、文档编制预处理器 Pic、Grap 和数学排版语言 Eqn 等这些重要研究成果背后都有布莱恩·W.克尼汉参与的身影。
1974 年,他写的第一本书,是和比尔・普劳格合著的《The Elements of Programming Style》,在这本书中出现了一个以他名字命名的定律 ——Kernighan’s Law。
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?
– Brian Kernighan, 1974
Kernighan’s Law:每个人都知道,调试在一开始就比编写程序困难一倍。那么,如果您在编写它时尽可能地巧妙,又如何来调试它?。
1976 年,他和比尔・普劳格合著《Software Tools》,意在向非 UNIX 系统上编写 Fortran 的程序员传播 UNIX 工具理念。
软件工具
所谓 “软件工具” 就是计算机用户为了设计和实现其所要求的实用程序而运用的一整套方法和措施。
作者选用 Raton (Rational Fortran) 这种结构语言以试图广泛地阐述设计和实现较为理想的各种程序设计方法。
了解 Fortran,PL/1,Cobol,Algol,Pascal 等一类语言的读者很快就会掌握 Ratfor 这种结构语言程序。并以这种程序为基础,去理解掌握和设计书写具有广泛使用价值的好程序;去使用现有的一些方法或者改进一些原有的方法编写出高效而可靠的应用程序。
1978 年,他与 C 语言之父丹尼斯・里奇合著了《The C Programming Language》,该书广为人知,被 C 语言开发者们尊称为 “K&R 手册” 和 “C 语言圣经”,多年来被当作 C 语言的 K&R C 非正式的标准说明。作为 编程语言入门的示范传奇程序 "Hello, World!"—— 计算机行业人踏上代码征程的初始徽章,也源于本书。
布莱恩·W.克尼还撰写了《The Unix Programming Environment》,本书对 UNIX 操作系统的编程环境做了详细而深入的讨论和指导。
布莱恩·W.克尼汉在普林斯顿大学为非计算机专业学生开设了一门介绍计算机技术基础的课程,根据课程讲义编写《D is for digital》。书中解释了当今计算和通信领域的工作方式,讨论了新技术带来的社会、政治和法律问题。
2011 - D is for digital – What a well-informed person should know about computers and communications
2017 - Understanding the Digital World – What You Need to Know about Computers, theInternet, Privacy, and Security
Hello World
1972 年,在贝尔实验室成员布莱恩·W.克尼汉撰写的内部技术文件《A Tutorial Introduction to the Language B》中首次提到了 “Hello World” 这一字符串。当时,他使用 B 语言撰写了一个用于演示外部变量的示例程序:
main( ) {
extern a, b, c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
这个程序将在终端打印出 “hello, world”,然后附上一个换行符。之所以这一短语被拆分成多个变量记录,是因为 B 语言中的每个字符常量只能容纳 4 个 ASCII 字符。
1974 年,时值 C 语言取代 B 语言,在贝尔实验室的又一内部备忘录《Programming in C: A Tutorial》中,布莱恩·W.克尼汉用 C 语言再次编写了一个 Hello World 程序作为教学示例。这一程序在他和丹尼斯・里奇于 1978 年出版的《The C Programming Language》中得到继承:
main( ) {
printf("hello, world\n");
}
由布莱恩·W.克尼汉撰写的 “Hello, world” 程序 (1978年)

在上例中,main () 函数定义了程序开始执行的位置。其主体由一条语句组成,即对 printf (print formatted,打印格式化)函数的调用,将使程序输出以参数传递给它的任何内容,在本例中是字符串 hello, world。
自此,Hello World 成为了电脑程序员学习新的编程语言的传统。但是,也有些人认为 hello, world 的字符串早于 1966 年的 BCPL 语言出现的时候已经出现。虽然相关的字词确实在发明者记录的文件出现,但是可以肯定的是,Hello World 在当时确实没有流行。因此,人们公认为布莱恩·W.克尼汉是令该字符串走进公众目光的人。
via : Hello World https://zh.wikipedia.org/wiki/Hello_World
纵观编程历史,“Hello World” 在向初学者介绍编码世界方面发挥了至关重要的作用。
虽然 “Hello World” 看似微不足道,但它不仅是一个初学者进入编程世界第一步的简单程序,也是承载着编码无限可能性之旅的开始。
—
The Origin of ‘Hello World’: A Programming History
“Hello World”的起源:编程历史
Coded Java
11-11-2024

A Simple Phrase, A Monumental Beginning
一个简单的短语,一个不朽的开始
“Hello, world!” This simple, seemingly ordinary phrase has become an iconic emblem in the world of computer programming. It’s the first program a novice programmer writes, the first message a new language utters, and the traditional greeting that marks the beginning of countless software projects. But have you ever stopped to wonder where this ubiquitous phrase originated? Its history is as intriguing as it is surprising, tracing back to the very origins of programming itself.
“你好,世界!”这个简单、看似普通的短语已成为计算机编程领域的标志性标志。这是新手程序员编写的第一个程序,是一门新语言发出的第一条信息,也是标志着无数软件项目开始的传统问候语。但是你有没有停下来想过这个无处不在的短语是从哪里来的?它的历史既有趣又令人惊讶,可以追溯到编程本身的起源。
The Dawn of Programming: From Punch Cards to Algol
编程的曙光:从 Punch Cards 到 Algol
Before we embark on the journey of “Hello, world,” let’s rewind the clock to the early days of computing, where programming was an arduous task. The era of the 1950s saw the rise of large, room-sized computers powered by vacuum tubes. These behemoths were controlled by punch cards, each card representing a specific instruction. Programming involved painstakingly punching holes into these cards, a process akin to writing in a cryptic, machine-readable language.
在我们踏上 “Hello,world” 的旅程之前,让我们将时钟倒回到计算机的早期,当时编程是一项艰巨的任务。1950 年代见证了由真空管供电的大型房间大小的计算机的兴起。这些庞然大物由穿孔卡控制,每张卡片代表一条特定的指令。编程涉及煞费苦心地在这些卡片上打孔,这个过程类似于用一种神秘的机器可读语言编写。
The early programming languages, like Assembly Language, were extremely low-level, requiring programmers to understand the computer’s inner workings at a granular level. Writing even simple programs was a Herculean feat, requiring a deep understanding of computer architecture and meticulous attention to detail.
早期的编程语言,如汇编语言,是极低级的,需要程序员在细粒度级别上理解计算机的内部工作原理。即使是编写简单的程序也是一项艰巨的壮举,需要对计算机架构有深入的理解和对细节的一丝不苟的关注。
Enter ALGOL 60, a revolutionary language that ushered in a new era of high-level programming. Born from a desire to create a universal programming language, ALGOL 60 offered a more structured and readable syntax, allowing programmers to focus on the logic of their programs rather than the intricate details of machine code. This shift towards abstraction paved the way for the development of more user-friendly languages and the evolution of programming as we know it today.
进入 ALGOL 60,这是一种开创高级编程新时代的革命性语言。ALGOL 60 诞生于创建通用编程语言的愿望,它提供了一种更加结构化和可读性的语法,使程序员能够专注于程序的逻辑,而不是机器代码的复杂细节。这种向抽象的转变为开发更加用户友好的语言和我们今天所知道的编程的发展铺平了道路。
Brian Kernighan’s Ingenious Innovation
Brian Kernighan 的巧妙创新
Now, let’s fast forward to 1972, when Brian Kernighan, a prominent figure in the world of computer science, was working on a book titled “The C Programming Language.” This book aimed to introduce the newly developed C programming language to a wider audience, making it accessible to both seasoned programmers and newcomers.
现在,让我们快进到 1972 年,当时计算机科学界的杰出人物 Brian Kernighan 正在撰写一本名为“C 编程语言”的书。本书旨在将新开发的 C 编程语言介绍给更广泛的受众,使经验丰富的程序员和新手都能使用。
Kernighan, recognizing the need for a simple and illustrative example, devised a program that would output the message “hello, world.” This seemingly insignificant program served a profound purpose: it demonstrated the basic syntax of the C language in a clear and concise way.
Kernighan 认识到需要一个简单而说明性的例子,因此设计了一个程序来输出消息 “hello,world”。这个看似微不足道的程序有一个深远的目的:它以清晰简洁的方式演示了 C 语言的基本语法。
The program itself was remarkably simple:
程序本身非常简单:
main() {
printf("hello, world\n");
}
This short snippet of code, barely a dozen characters, showcased the fundamental concepts of the C language: defining a function, using the printf function for output, and understanding basic string syntax.
这个简短的代码片段(只有十几个字符)展示了 C 语言的基本概念:定义函数、使用 printf 函数进行输出以及理解基本的字符串语法。
The “Hello, World!” Legacy: A Global Phenomenon
“你好,全世界!遗产:全球现象
Kernighan’s seemingly simple choice of “hello, world” proved to be a stroke of genius. It resonated deeply with programmers, becoming a universally recognized symbol of programming initiation.
Kernighan 看似简单的“你好,世界”被证明是天才之举。它与程序员产生了深深的共鸣,成为公认的编程启蒙的象征。
The program’s popularity spread rapidly, transcending the boundaries of the C language. Programmers across the globe started using it as a customary first program when learning new languages. The phrase “hello, world” quickly became a cornerstone of introductory programming courses, a shared experience that connected programmers across generations and languages.
该程序的受欢迎程度迅速传播,超越了 C 语言的界限。全球的程序员在学习新语言时开始将其用作习惯的第一个程序。“你好,世界”这句话很快成为编程入门课程的基石,这是一种将不同世代和语言的程序员联系在一起的共享体验。
From the Console to the Web: The Evolution of “Hello, World!”
从控制台到 Web:“Hello,World!” 的演变
The “hello, world” tradition has evolved with the advancement of technology. While the original program printed its greeting to a console, today’s web developers can display the message on a web browser. This demonstrates how the “hello, world” program has adapted and thrived alongside the rapid evolution of the programming landscape.
“hello,world”传统随着技术的进步而发展。虽然原始程序将其问候语打印到控制台,但今天的 Web 开发人员可以在 Web 浏览器上显示该消息。这表明 “hello,world” 计划如何随着编程领域的快速发展而适应和发展。
Here’s a simple HTML example that displays “hello, world” on a web page:
下面是一个在网页上显示 “hello,world” 的简单 HTML 示例:
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
This simple snippet demonstrates the fundamental principles of web development, showing how to structure a basic web page and include text elements.
这个简单的代码段演示了 Web 开发的基本原则,展示了如何构建基本网页并包含文本元素。
Beyond the Code: The Deeper Meaning of “Hello, World!”
超越代码:“Hello,World!” 的更深层次含义
The enduring appeal of “hello, world” goes beyond its technical significance. It serves as a powerful symbol of the creative potential inherent in programming. It represents the moment when a programmer bridges the gap between human intention and machine execution, turning a thought into a tangible output.
“hello,world”的持久吸引力超越了其技术意义。它是编程中固有的创造潜力的有力象征。它代表了程序员弥合人类意图和机器执行之间的差距,将想法转化为有形输出的时刻。
The phrase also embodies the collaborative spirit of the programming community. It’s a shared experience that connects programmers from different backgrounds and skill levels, uniting them through a common language of code.
这句话还体现了编程社区的协作精神。这是一种共享体验,将来自不同背景和技能水平的程序员联系起来,通过一种通用的代码语言将他们团结在一起。
Furthermore, “hello, world” signifies the boundless possibilities of technology. It serves as a reminder that the seemingly simple act of writing a program can have profound implications, leading to innovations that shape our lives and change the world.
此外,“hello,world”象征着技术的无限可能性。它提醒我们,编写程序这个看似简单的行为可能会产生深远的影响,从而带来塑造我们生活和改变世界的创新。
The Future of “Hello, World!”
“Hello,World!” 的未来
As the world of programming continues to evolve, the “hello, world” tradition is likely to endure. It will continue to serve as a gateway for new generations of programmers, a symbol of creativity and innovation, and a testament to the enduring power of the programming language.
随着编程世界的不断发展,“你好,世界”的传统可能会持续下去。它将继续作为新一代程序员的门户,创造力和创新的象征,以及编程语言持久力量的证明。
Frequently Asked Questions
常见问题解答
Q: Why is “hello, world” so popular as a first program?
Q: 为什么 “hello,world” 作为第一个节目如此受欢迎?
A: “Hello, world” is popular because it’s a simple, easy-to-understand program that introduces basic syntax and concepts of a programming language. It’s a perfect starting point for beginners, offering a tangible outcome that reinforces the learning process.
答:“Hello,world”很受欢迎,因为它是一个简单易懂的程序,介绍了编程语言的基本语法和概念。对于初学者来说,这是一个完美的起点,提供了加强学习过程的切实成果。
Q: Is there any special significance to the phrase “hello, world”?
Q: “hello,world” 这句话有什么特别的意义吗?
A: While the phrase itself isn’t inherently meaningful, its choice was deliberate. Brian Kernighan selected it because it was a straightforward and universally recognizable greeting that would resonate with programmers.
答:虽然这个短语本身没有内在的意义,但它的选择是经过深思熟虑的。Brian Kernighan 之所以选择它,是因为这是一个直截了当且普遍认可的问候语,会引起程序员的共鸣。
Q: Are there any other popular first programs besides “hello, world”?
Q: 除了 “hello,world” 之外,还有其他流行的 first 程序吗?
A: While “hello, world” is widely recognized, there are other common first programs, such as “Hello, world!” programs that display the current date and time, or programs that calculate simple mathematical operations. The choice of the first program often depends on the specific language being learned and the objectives of the introductory lesson.
答:虽然“hello,world”已得到广泛认可,但还有其他常见的 first 程序,例如显示当前日期和时间的“Hello,world!”程序,或计算简单数学运算的程序。第一个程序的选择通常取决于所学的特定语言和入门课程的目标。
Q: Can I create a “hello, world” program in any programming language?
问:我可以使用任何编程语言创建“hello,world”程序吗?
A: Yes, practically every programming language has a way to display “hello, world.” The specific code might vary depending on the language, but the underlying concept of outputting a greeting remains the same.
答:是的,几乎每种编程语言都有显示 “hello,world” 的方法。具体代码可能因语言而异,但输出问候语的基本概念保持不变。
Q: Is “hello, world” a necessary step for every programmer?
问:“hello,world”是每个程序员都必须的步骤吗?
A: While “hello, world” is a widely used tradition, it’s not mandatory. Some programmers may skip it entirely, especially if they are already familiar with basic programming concepts. However, for beginners, it can be a valuable exercise in understanding fundamental language syntax and the process of writing a program.
答:虽然“hello,world”是一个广泛使用的传统,但它不是强制性的。一些程序员可能会完全跳过它,特别是如果他们已经熟悉基本的编程概念。但是,对于初学者来说,对于理解基本语言语法和编写程序的过程来说,这可能是一个有价值的练习。
Q: What are some other ways to express “hello, world” in programming?
问:在编程中,还有哪些其他方式可以表达“hello,world”?
A: You can get creative with your “hello, world” program! You could display the message in different colors, fonts, or sizes. You could even use a graphical interface to display it in an interactive way. The possibilities are limitless, and the “hello, world” tradition encourages experimentation and exploration within the programming world.
答:您可以通过“hello,world”计划发挥创意!您可以用不同的颜色、字体或大小显示消息。您甚至可以使用图形界面以交互方式显示它。可能性是无限的,“你好,世界”的传统鼓励在编程世界中进行实验和探索。
via:
-
The History of ‘Hello, World’ - HackerRank Blog Written By Ritika Trikha | April 21, 2015
https://www.hackerrank.com/blog/the-history-of-hello-world/ -
The Origin of ‘Hello World’: A Programming History Coded Java 11-11-2024
https://theglobalpresence.com/post/the-origin-of-hello-world-a-programming-history -
List of Hello World Programs in 300 Programming Languages – MYCPLUS *Posted by M. Saqib | Updated Feb 16, 2024 *
https://www.mycplus.com/featured-articles/hello-world-programs-in-300-programming-languages/
布莱恩·W.克尼汉:引领计算机科学与编程界的巨人

被折叠的 条评论
为什么被折叠?



