面向对象的实现策略 [英] Implementation Strategies for Object Orientation

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

问题描述

我目前正在Squeak环境中学习Smalltalk,并且正在阅读"Squeak-ObjectLand快速之旅".我使用Python和Java的一些先验知识进入了面向对象的范式,第36页的书中的这句话使我想到:

I'm currently learning Smalltalk in the Squeak environment and I'm reading "Squeak - A Quick Trip To ObjectLand". I enter the object-oriented paradigm with some prior knowledge from Python and Java and this sentence from the book on page 36 has made me think:

Smalltalk是面向对象语言的基于类的实现.

Smalltalk is a class-based implementation of an object-oriented language.

简短的句子,但非常有趣.在OO中,所有类(如类,对象,实例)似乎都是定义明确的,似乎指向一个唯一的真实含义,您很可能会遇到通用的句子,例如对象是类的实例".
但是您很少听说实施策略.在这种情况下,面向对象概念的实现是什么意思?除了类之外,还有OO语言的实现吗?

Short sentence but very interesting. In OO all terms like class, object, instance seem to be well-defined and seem to point to the one and only true meaning and you're likely to come across generic sentences like "objects are instances of a class".
But you hear seldom about implementation strategies. What does implementation of the object-oriented concept mean in this case? Are there implementations of OO languages other than classes?

推荐答案

JavaScript是基于原型的OO语言实现.

Javascript is a prototype based implementation of an OO language.

您无需克隆类并创建该新类的实例,而是通过克隆原型来继承行为.

Instead of subclassing a class and creating an instance of that new class, you inherit behaviour by cloning a prototype.

作为历史记录,我应该补充一点,尽管Javascript可能是使用最广泛的原型使用语言,但第一种是David Ungar和Randall Smith的

As a historical note I should add that while Javascript is probably the most widely used prototype-using language, the first was David Ungar's and Randall Smith's Self language.

有几种实现 .vutbr.cz/units/UITS/prod/index.php?id = 241& notitle = 1"rel =" noreferrer>原型随处可见.我没有用过,所以我无法评论这些库.

There are several implementations of prototypes floating around for Squeak. I haven't used them, so I can't comment on the libraries.

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

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