Ruby概述

Ruby的历史 (History of Ruby)

Yukihiro Matsumoto "Matz", a software programmer, and a Japanese Computer Scientist developed and designed Ruby in the mid-1990s. There is an engrossing story behind naming the language as "Ruby". An online chat session was taking place between Matz and Keiju Ishitsuka(Matz's Colleague) during which two names were proposed for the language before writing any code on it, one was Coral and later was Ruby. The later one was selected as Ruby was the birthstone of one of the colleagues of Matsumoto.

软件程序员松本幸弘(Yukihiro Matsumoto)“ Matz”是一名软件程序员,日本计算机科学家在1990年代中期开发和设计了Ruby。 将语言命名为“ Ruby”背后有一个引人入胜的故事。 Matz和Keiju Ishitsuka(Matz的同事)之间进行了在线聊天,在此过程中为该语言提出了两个名称,然后编写了任何代码,一个是Coral,后来是Ruby。 后来的一位被选为Ruby是松本一位同事的诞生石。

Ruby 0.95 was the first version of the Ruby which was released in 1995, then various substantial versions were released in the following years:

Ruby 0.95是1995年发布的Ruby的第一个版本,随后的几年中又发布了各种重要版本:

In 1996, Ruby 1.0 was released.

1996年,Ruby 1.0发布。

In 1998, Ruby 1.2 was introduced to the market.

1998年,Ruby 1.2投放市场。

Ruby 1.4 and Ruby 1.6 were released in 1999 and 2000 respectively.

Ruby 1.4和Ruby 1.6分别于1999年和2000年发布。

After this many versions were introduced with better features and the latest version of Ruby is Ruby 2.6.0 which was released on Christmas, 2018.

在引入了许多具有更好功能的版本之后,Ruby的最新版本是Ruby 2.6.0,该版本于2018年圣诞节发布。

Ruby的功能 (Features of Ruby)

  • Object-Oriented

    面向对象

    Object-Oriented programming used programming standard which employs Objects and their interactions to develop Applications and Computer Programs. Ruby is an object-oriented language with some procedural features. The fundamental features supported by Rudy are:

    面向对象的编程使用了编程标准,该标准利用对象及其交互来开发应用程序和计算机程序。 Ruby是一种具有一些过程功能的面向对象语言。 Rudy支持的基本功能是:

    • Abstraction: Abstraction is clarifying complex reality by modeling classes suitable to the problem.抽象 :抽象通过建模适合该问题的类来阐明复杂的现实。
    • Polymorphism: Polymorphism simply refers to many forms. An object or function/method can be used in different ways for different data inputs.多态性 :多态性简单地指许多形式。 对象或功能/方法可以以不同的方式用于不同的数据输入。
    • Encapsulation: Encapsulation is a process of preventing an object from unauthorized access by hiding the values or state of that particular object.封装 :封装是通过隐藏特定对象的值或状态来防止对象受到未经授权的访问的过程。
    • Inheritance: It is a way to create new classes by deriving the properties of existing classes. It is like a Parent-child scenario.继承 :这是一种通过派生现有类的属性来创建新类的方法。 这就像一个亲子场景。
  • Supports Mixins and Metaclasses

    支持混合和元类

    Mixin is a feature of OOPS which allows Methods of a class to be used by another class without declaring Method's class as the parent class of that class which is accessing its methods. This feature is known as Mixin.

    Mixin是OOPS的一项功能,它允许一个类的方法由另一个类使用,而无需将Method的类声明为正在访问其方法的该类的父类。 此功能称为Mixin。

    A metaclass is a kind of class whose objects are also a class. An ordinary class defines the behavior of certain instances but a metaclass defines the behavior of precise classes and their objects.

    元类是一种类,其对象也是一个类。 普通类定义某些实例的行为,而元类定义精确类及其对象的行为。

  • Supports Dynamic Typing and Duck typing

    支持动态打字和鸭子打字

    Ruby supports dynamic typing which means that the data type of the variable is checked or verified at the run time. Here, most of the times, the type of the variable or object is not specified at the run time.

    Ruby支持动态类型化,这意味着在运行时检查或验证变量的数据类型。 在大多数情况下,在运行时未指定变量或对象的类型。

    Duck typing can be simply defined as the process of determining if an object can work for the specified purpose or not.

    鸭子类型可以简单地定义为确定对象是否可以用于指定目的的过程。

  • Interpreted language

    口译语言

    Ruby is an Interpreted language which means that most of its instructions are executed directly and freely without prior compiling the program into its native machine or byte code.

    Ruby是一种解释语言,这意味着它的大多数指令都可以直接自由执行,而无需事先将程序编译成其本机或字节码。

  • Garbage Collection

    垃圾收集

    Ruby supports Garbage Collection which is a kind of Automatic Memory Management and means that it allocates the memory to the variable automatically and deallocates the same when memory is not in use. It is the antonym of Manual Memory Management in which the programmer needs to allocate and deallocate memory to the object through instructions.

    Ruby支持Garbage Collection,这是一种自动内存管理,这意味着它会自动将内存分配给变量,并在不使用内存时将其取消分配。 它是“手动内存管理”的反义词,程序员在其中需要通过指令为对象分配和释放内存。

Ruby的优势 (Advantages of Ruby)

  1. It has less number of lines of code which makes it an elegant yet powerful language.

    它具有更少的代码行数,这使其成为一种优雅而强大的语言。

  2. It permits easy creation of Web Application which requires fewer efforts and makes programming easy.

    它允许轻松创建Web应用程序,而这需要较少的工作量并使编程变得容易。

  3. The syntax of Ruby is very close to Spoken language thus making it simple to remember and code.

    Ruby的语法非常接近口语,因此易于记忆和编码。

Ruby的缺点 (Disadvantages of Ruby)

  1. It is a scripting Interpreted language and scripting languages are slower when compared to the Compiled languages.

    它是一种脚本语言与编译语言相比,口译语言和脚本语言要慢。

  2. Most of its code is generated at runtime which makes it difficult to be read while debugging.

    它的大多数代码都是在运行时生成的,这使得调试时很难阅读。

翻译自: https://www.includehelp.com/ruby/overview.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值