编程与软件工程cs.gmu.edu
Java 深受 Objective-C 影响
Java Was Strongly Influenced by Objective-C
2010 — 2015,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 Sean Luke 保存的一篇 USENET 旧帖:Java 创始团队成员 Patrick Naughton 亲自回应,指出 Java 的设计主要受 Objective-C 影响而非 C++。文章列出了接口对应协议、super 关键字、无多重继承等具体证据,是关于 Java 语言起源的一手史料。
为什么经久不衰:由 Java 作者之一亲口讲述语言渊源,加上多年后原作者本人现身 HN 的趣事,对理解 Java 与 Objective-C/Smalltalk 的设计传承仍有参考价值。
HN 评论精选
原作者现身,确认 Naughton 的原话证明 Java 源自 Objective-C 而非 C++
天哪,这是我的 USENET 帖子。看到这里有人评论说,不管 Patrick Naughton 怎么说,他的语言其实是基于 C++ 的,我觉得很好笑——语言设计者本人说的话居然不算数!早在 90 年代我读博写这篇帖子时,Java 明显更多源自 Objective-C 而非 C++。文中提到 Newton 是因为帖子发在 comp.sys.newton.misc 版。
SeanLuke查看英文原文
Holy cow, that's my USENET posting. Will have to ask my sysadmin to record the HN spike. I do find it funny reading postings here basically saying that, regardless of what Patrick Naughton said, his language is actually based on C++. Those language creators have some nerve! :-) Reminds me of the Kurt Vonnegut scene in Back to School. Even back in the '90s, when I wrote that as a wee PhD student, it was clear that Java was derivative of Obj-C (among others) much more than C++. EDIT: all the Newton references in that passage are because it was posted in comp.sys.newton.misc (IIRC).
Java 表面像 C++,内核更多继承自 Objective-C/Smalltalk 的动态特性
Java 语言除了与 C 共享的表层语法外,和 C++ 几乎没什么共同点。Java 的接口与 Objective-C 的协议有紧密联系,但我不同意说它是'C++ 多重继承的简化'。Java 的情况类似 C++ 之于 Simula:因当时 C++ 占主导而表面相似,实际吸收了更多 Smalltalk 式语言(如 Objective-C)的动态特性,比如用 super 调用父类方法、都没有多重继承。
AdieuToLogic查看英文原文
I'm not sure how much Brad Cox[1] would like the characterization: > Objective-C is an object-oriented mutant of C But Java (the language) has little in common with C++ aside from the token-level commonality both share with B. As for Java's interfaces, those (as "zak_mc_kraken" mentions) have strong ties to Objective-C's protocols, though I disagree with the subsequent statement of them being "a simplification of C++'s multiple inheritance". IMHO, they are far closer to C++'s class/function declarations. I'd say Java had a similar influence as C++ did from Simula, introducing superficial similarities with C++ due to its dominance at the time[2], but incorporated more of the dynamics provided by Smalltalk-like languages (such as Objective-C). Note the use of "super" for calling parent methods and the lack of multiple inheritance in both. 1 - http://www.virtualschool.edu/objectivec/ 2 - Fun bit of trivia: when Java hit the scene in the late 90's, you could globally replace the word "reference" with "pointer" and the documentation would read just the same. See section 2.2.9 of http://www.oracle.com/technetwork/java/simple-142616.html for a prime example.
质疑原文:Java 的实际设计更接近 C++ 多重继承的简化
不太有说服力。也许 Naughton 热爱 Objective-C,但 Java 里留下的痕迹很少。Java 的接口既可以看作 Objective-C 协议的直接继承,也可以看作 C++ 多重继承的简化。按 Gosling 的说法,影响 Java 设计的显然是后者;Naughton 对 Objective-C 的喜好对 1995 年 Java 的最终形态影响不大。
zak_mc_kracken查看英文原文
Not very convincing. Maybe Patrick Naughton was in love with Objective C but there is little of that left in Java. Depending on which angle you look at, you could see Java's interfaces as a direct successor of Objective C's protocols or a simplification of C++' multiple inheritance. If you were to believe James Gosling, it's clearly the latter that influenced Java's design. The fact that Naughton liked Objective C hasn't had much impact on what Java ended up looking like in 1995.
Java 缺少 Categories 机制,导致工具类泛滥
最遗憾的是 Java 从未实现 Objective-C 的 Categories,Java 程序员只能永远写 StringUtil 这种塞满本该属于 String 类的方法的工具类。写了 20 年 Java,这仍然让我恼火。还有把 byte 做成有符号的。
spiralpolitik查看英文原文
The saddest thing is that Java never implemented support for Objective-C 'Categories' so Java programmers are forever doomed to write classes called StringUtil full of methods that really should be on the String class. After 20 years of Java programming this still annoys me. That and making 'byte' signed.
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选