英文:
Does Google's go-language address the problems in Paul's Graham's post 'Why Arc isn't Especially Object Oriented'?
问题
谷歌的Golang是否解决了保罗·格雷厄姆在他的文章《为什么Arc不是特别面向对象》中提到的语言问题?
英文:
Does Google's Golang address the problems with languages addressed in Paul's Graham's post 'Why Arc isn't Especially Object Oriented'?
答案1
得分: 9
我的初始感觉是“现在还为时过早”。
> 1) 如果你使用的是静态类型语言,没有词法闭包或宏,那么面向对象编程会很有趣。在某种程度上,它提供了绕过这些限制的方法。(参见格林斯潘的第十条规则。)
Go支持函数字面量(参见文档),如果我理解正确的话,它允许你将函数作为参数传递,无论是在其他地方定义的还是即兴创建的。
> 2) 面向对象编程在大公司中很受欢迎,因为它适合他们编写软件的方式。在大公司中,软件往往由大型(经常变动的)中等水平的团队编写。面向对象编程对这些程序员施加了一种纪律,防止他们中的任何一个人造成过多的破坏。代价是生成的代码充斥着协议并且存在大量重复。对于大公司来说,这并不是太高的代价,因为他们的软件可能本来就会臃肿并且充满重复。
这个观点太主观了,无法回答。
> 3) 面向对象编程看起来会产生很多工作量。在扇形纸上的那些日子里,有一种类型的程序员只会在一页上放五到十行代码,前面有二十行精心格式化的注释。面向对象编程对这些人来说就像毒品一样:它让你将所有这些脚手架直接嵌入到源代码中。一个Lisp黑客可能通过将一个符号推入列表来处理的事情,变成了一个包含了整个文件的类和方法。因此,如果你想让自己或别人相信你正在做很多工作,这是一个很好的工具。
由于Go不是一个真正的面向对象语言,你可以用任何你熟悉的方式解决问题。
> 4) 如果一种语言本身就是一个面向对象的程序,它可以被用户扩展。也许吧。或者,通过提供面向对象编程的子概念,你甚至可以做得更好。例如,重载并不是与类密切相关的。我们会看到。
Go似乎对对象有一种有趣的方法,你不需要担心/开发大型对象树。它看起来语言中提供了工具,以面向对象的方式组织数据,而不会将你限制在纯粹的面向对象环境中。
> 5) 面向对象的抽象与某些特定类型的程序领域非常契合,比如模拟和CAD系统。
...
英文:
My initial feeling towards this is "It is too soon to tell"
> 1) Object-oriented programming is exciting if you have a
> statically-typed language without
> lexical closures or macros. To some
> degree, it offers a way around these
> limitations. (See Greenspun's Tenth
> Rule.)
Go supports Function literals (see docs) which if I am reading this correctly allow you to pass functions as params, whether defined elsewhere or created ad-hoc.
> 2) Object-oriented programming is popular in big companies, because it
> suits the way they write software. At
> big companies, software tends to be
> written by large (and frequently
> changing) teams of mediocre
> programmers. Object-oriented
> programming imposes a discipline on
> these programmers that prevents any
> one of them from doing too much
> damage. The price is that the
> resulting code is bloated with
> protocols and full of duplication.
> This is not too high a price for big
> companies, because their software is
> probably going to be bloated and full
> of duplication anyway.
This point is far to subjective to answer.
> 3) Object-oriented programming generates a lot of what looks like
> work. Back in the days of fanfold,
> there was a type of programmer who
> would only put five or ten lines of
> code on a page, preceded by twenty
> lines of elaborately formatted
> comments. Object-oriented programming
> is like crack for these people: it
> lets you incorporate all this
> scaffolding right into your source
> code. Something that a Lisp hacker
> might handle by pushing a symbol onto
> a list becomes a whole file of classes
> and methods. So it is a good tool if
> you want to convince yourself, or
> someone else, that you are doing a lot
> of work.
Since go isn't a truly object oriented language, you can probably solve the problem in whatever fashon you are comfortable with.
> 4) If a language is itself an object-oriented program, it can be
> extended by users. Well, maybe. Or
> maybe you can do even better by
> offering the sub-concepts of
> object-oriented programming a la
> carte. Overloading, for example, is
> not intrinsically tied to classes.
> We'll see.
Go seems to have an interesting approach to objects, where you are not required to worry / develop large object trees. It looks like the tools are present in the language to structure your data in an object oriented fashion without locking you in to a pure object oriented environment.
> 5) Object-oriented abstractions map neatly onto the domains of certain
> specific kinds of programs, like
> simulations and CAD systems.
...
答案2
得分: 5
保罗有一些有趣的观点,总的来说,我读过他很多的思考。在这个问题上,我们有分歧。他是一个Lisp迷,也是一个糟糕的程序迷。他似乎把难以理解的程序说成是伟大程序员的作品。是的,我意识到情况比这更微妙,但归根结底就是这样。在一天结束时,你的代码要么易于使用,要么不易于使用。而一些程序员,被保罗认为是伟大的程序员,能够忍受更多的糟糕代码,仍然能够理解代码的意图。这是一种技能,但绝对不是一个优秀程序员所需要的唯一技能。
说到Arc,它很糟糕,除非我弄错了,甚至Lisp社区的人也这么认为——我的观点是即使聪明人也会犯错。
再次强调,保罗是个聪明的人,但他在这篇特定的文章中的整体方法似乎有些偏离轨道。
英文:
Paul has some interesting points, in general, I've read a lot of his musings. In this matter, we disagree. He's a lisp nut, and a crappy program nut. He seems to pawn off hard to understand programs as the work of great programmers. Yes, I realise it's more nuanced than that, but it really boils down to just that. At the end of the day, either your code is easy work with, or it's not. And some programmers, programmers that Paul would deem great, will be able to put up with more crap than others and still be able to make heads or tails of what the code intends. It's a skill, but most assuredly not the only one a good programmer needs.
Speaking of Arc, it sucks, and unless I'm mistaken even people in the Lisp community think so -- my point here being that even smart people make mistakes.
Again, Paul is a smart guy, but his entire approach in this particular piece is off the mark it seems.
答案3
得分: 1
等一下,不过,Go真的是面向对象的吗?在这方面它似乎完全不关心。你可以在Go中使用面向对象编程(OOP),函数式编程(FP)或命令式编程。我的意思是,像Prolog风格的“编程”可能有点牵强,但除此之外...
实际上,我认为Go在这方面与Scala相似:有一些面向对象的范例存在,但也有一些匿名函数和类型转换存在。
英文:
Wait up, though, is Go really object-oriented? It seems entirely agnostic on that front. You can use OOP or FP or Imperative programming within Go. I mean, prolog-style "programming" would be a stretch, but otherwise...
In fact, I'd argue that Go resembles scala in this respect: there's some object paradigms lying around, and yet, there are also lambdas and typecasing lying around.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论