ruby_Ruby简介

ruby

Ruby is an object-oriented programming language developed by Yukihiro Matsumoto. Ruby is a dynamic programming language with a complex but at the same time expressive grammar. Ruby also has a core class library with a rich and powerful API.

Ruby是由Yukihiro Matsumoto开发的一种面向对象的编程语言。 Ruby是一种动态编程语言 ,具有复杂但同时具有表现力的语法 。 Ruby还具有一个核心类库,该库具有丰富而强大的API。

Ruby is inspired by other low level and object oriented programming languages like Lisp, Smalltalk, and Perl and uses syntax that is easy for C and Java programmers to learn.

Ruby受到LispSmalltalkPerl等其他面向对象的低级编程语言的启发,并且使用的语法易于C和Java程序员学习。

Ruby, a dynamic and open source programming language with a focus on simplicity and productivity, has an elegant syntax that is natural to read and easy to write.

Ruby是一种动态且开源的编程语言,其重点是简单性和生产率,它具有优雅的语法,易于阅读和编写。

Although it's easy to program in Ruby, it is not a simple language.

尽管使用Ruby编程很容易,但它不是一种简单的语言。

Ruby的功能 (Features of Ruby)

  1. Object Oriented : Every values in Ruby is an object, even the most primitive things like strings, numbers and even true and false. So, Ruby is a pure Object Oriented Language. Every object has a class and every class has one superclass.

    面向对象: Ruby中的每个值都是一个对象,即使是最原始的东西,例如字符串,数字,甚至是true和false。 因此,Ruby是一种纯粹的面向对象语言。 每个对象都有一个类,每个类都有一个超类。

  2. Dynamic : Ruby is a very dynamic programming language. Ruby programs aren't compiled like C or Java programs. All things in a program are built by the code when it is run. A program can also modify its own definitions while running.

    动态: Ruby是一种非常动态的编程语言。 Ruby程序不能像C或Java程序那样进行编译。 程序中的所有内容都是在运行时由代码构建的。 程序在运行时还可以修改自己的定义。

  3. Singleton Classes : Every object in Ruby has two classes: a regular class and a singleton class. An object's singleton class is nameless class whose only instances is that object. Singleton classes are created automatically and make Ruby simple and elegant.

    单例类: Ruby中的每个对象都有两个类: regular classsingleton class 。 对象的单例类是无名类,其唯一实例是该对象。 Singleton类是自动创建的,使Ruby简单而优雅。

  4. Metaprogramming : Everything in Ruby are objects. You can use them to learn about them or even modify them, while your program is running. This technique is called metaprogramming.

    元编程: Ruby中的一切都是对象。 您可以在程序运行时使用它们来了解它们,甚至可以对其进行修改。 这种技术称为元编程。

  5. Flexibility : Methods can be added to existing classes without sub classing, operators can be overloaded, and even the behaviour of the standard library can be redefined at runtime.

    灵活性:无需子类就可以将方法添加到现有类中,可以重载运算符,甚至可以在运行时重新定义标准库的行为。

  6. Variables and scopes : Programmer do not need to declare variables or variable scope in ruby. The name of the variable automatically determines its scope.

    变量和范围:程序员无需在ruby中声明变量或变量范围。 变量的名称自动确定其范围。



    Examples :
    var is a local variable.
    $var is a global variable.
    @var is an instance variable.
    @@var is a class variable.
    例子 :
    var是局部变量。
    $var是全局变量。
    @var是一个实例变量。
    @@var是一个类变量。

Ruby:高级功能 (Ruby: Advanced Features)

  • Exceptions for handling errors.

    处理错误的异常。

  • Garbage Collector.

    垃圾收集器。

  • OS - independent threading, which allows you to write multi-threaded applications even on operating systems such as DOS.

    操作系统-独立的线程,即使在DOS等操作系统上,也可以编写多线程应用程序。

  • You can write extensions to Ruby in C.

    您可以在C中为Ruby编写扩展。

为什么要去Ruby? (Why you should go for Ruby?)

  • Ruby is a server-side scripting language.

    Ruby是一种服务器端脚本语言。

  • Ruby can be embedded into HTML.

    Ruby可以嵌入到HTML中。

  • Ruby has similar syntax to that of many programming languages like C and Java.

    Ruby的语法与C和Java等许多编程语言的语法相似。

  • Ruby supports mostly all the platforms like Windows, Mac and Linux.

    Ruby几乎支持所有平台,例如Windows,Mac和Linux。

  • Ruby can be easily connected to Oracle, MySQL, DB2.

    Ruby可以轻松连接到Oracle,MySQL,DB2。

翻译自: https://www.studytonight.com/ruby/introduction-to-ruby

ruby

你可能感兴趣的:(编程语言,java,python,javascript,linux,ViewUI)