为什么声称C#人员没有进行面向对象的编程? (相对于面向类) [英] Why the claim that c# people don't get object-oriented programming? (vs class-oriented)

查看:89
本文介绍了为什么声称C#人员没有进行面向对象的编程? (相对于面向类)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨晚这引起了我的注意.

This caught my attention last night.

在最新的 ALT.NET播客中,Scott Bellware讨论了如何与之相对到Ruby,像c#,java等语言.不是真正的面向对象,而是选择短语面向类".他们用非常含糊的措辞谈论这种区别,而没有详细介绍或讨论利弊.

On the latest ALT.NET Podcast Scott Bellware discusses how as opposed to Ruby, languages like c#, java et al. are not truly object oriented rather opting for the phrase "class-oriented". They talk about this distinction in very vague terms without going into much detail or discussing the pros and cons much.

这里真正的区别是什么?有什么关系?那么面向对象"还有哪些其他语言?听起来很有趣,但我不想只学习Ruby就知道我是否缺少什么.

What is the real difference here and how much does it matter? What are other languages then are "object-oriented"? It sounded pretty interesting but I don't want to have to learn Ruby just to know what if anything I am missing.

更新:在阅读了以下一些答案之后,人们似乎普遍认为参考是鸭子式的.我不确定我仍然理解的是,这最终会改变很多.尤其是如果您已经使用松散耦合等等进行了适当的tdd等等.有人可以给我展示一个我可以用ruby做的奇妙事情的例子,而我却不能用c#做到这一点,并举例说明了这种不同的oop方法吗?

Update: After reading some of the answers below it seems like people generally agree that the reference is to duck-typing. What I'm not sure I understand still though is the claim that this ultimately changes all that much. Especially if you are already doing proper tdd with loose coupling blah blah blah. Can someone show me an example of a wonderous thing I could do with ruby that I cannot do with c# and that exemplifies this different oop approach?

推荐答案

此处的鸭子输入注释更能说明Ruby和Python比C#更动态的事实.它与OO Nature无关.

The duck typing comments here are more attributing to the fact that Ruby and Python are more dynamic than C#. It doesn't really have anything to do with it's OO Nature.

(我认为)Bellware的意思是,在Ruby中,一切都是对象.甚至一堂课.类定义是对象的实例.这样,您可以在运行时为其添加/更改/删除行为.

What (I think) Bellware meant by that is that in Ruby, everything is an object. Even a class. A class definition is an instance of an object. As such, you can add/change/remove behavior to it at runtime.

另一个很好的例子是NULL也是一个对象.在红宝石中,一切都是一个对象.整个过程具有如此深的OO,因此可以使用一些有趣的元编程技术,例如method_missing.

Another good example is that NULL is an object as well. In ruby, everything is LITERALLY an object. Having such deep OO in it's entire being allows for some fun meta-programming techniques such as method_missing.

这篇关于为什么声称C#人员没有进行面向对象的编程? (相对于面向类)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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