Java 100%面向对象吗? [英] Is Java 100% object oriented?

查看:130
本文介绍了Java 100%面向对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java具有原始数据类型,它不是像Ruby中的对象派生的那样。那么我们可以将Java视为100%面向对象的语言吗?另一个问题:为什么Java不以对象方式设计原始数据类型?

Java has primitive data types which doesn't derive from object like in Ruby. So can we consider Java as a 100% object oriented language? Another question: Why doesn't Java design primitive data types the object way?

推荐答案

当Java首次出现时(版本1.x) )JVM非常非常慢。
不将原语作为一等对象实现是他们为速度目的而采取的妥协,尽管我认为从长远来看这是一个非常糟糕的决定。

When Java first appeared (versions 1.x) the JVM was really, really slow. Not implementing primitives as first-class objects was a compromise they had taken for speed purposes, although I think in the long run it was a really bad decision.

面向对象对许多人来说也意味着很多东西。
你可以拥有基于类的OO(C ++,Java,C#),或者你可以拥有基于原型的OO(Javascript,Lua)。

"Object oriented" also means lots of things for lots of people. You can have class-based OO (C++, Java, C#), or you can have prototype-based OO (Javascript, Lua).

100%面向对象并不意味着太多,真的。 Ruby也会遇到你不时会遇到的问题。

100% object oriented doesn't mean much, really. Ruby also has problems that you'll encounter from time to time.

让我困扰Java的是它没有提供有效提取想法的方法,以扩展它遇到问题的语言。每当提出这个问题时(见Guy Steele的成长语言),哦,不,但Joe Sixpack怎么样?给出了论证。即使你设计的语言可以防止自己在脚下射击,但偶然复杂性和真实复杂性之间存在差异(参见 No Silver Bullet )和平庸的开发者总能找到创造性的方式来拍摄自己。

What bothers me about Java is that it doesn't provide the means to abstract ideas efficiently, to extend the language where it has problems. And whenever this issue was raised (see Guy Steele's "Growing a Language") the "oh noes, but what about Joe Sixpack?" argument is given. Even if you design a language that prevents shooting yourself in the foot, there's a difference between accidental complexity and real complexity (see No Silver Bullet) and mediocre developers will always find creative ways to shoot themselves.

例如Perl 5不是面向对象的,但它具有足够的可扩展性,允许 Moose ,这是一个非常允许的对象系统处理面向对象复杂性的先进技术。 语法糖没问题。

For example Perl 5 is not object-oriented, but it is extensible enough that it allows Moose, an object system that allows very advanced techniques for dealing with the complexity of OO. And syntactic sugar is no problem.

这篇关于Java 100%面向对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆