Ruby Language Overview

Source: Internet
Author: User
Tags garbage collection inheritance mixed

Ruby is an object-oriented programming language, and she pursues "easy and fast object-oriented programming." Ruby is an interpreted language, so you can program quickly without compiling. While Ruby has a powerful text-processing function like Perl, she's not just a toy, you can use her for practical programming. In addition, you can easily use the C language to extend Ruby's functionality, so you can use it as a front-end for various libraries.

If you ever "want a simple object-oriented language", or that "Perl's functionality works, but its syntax is unbearable", or that "Lisp is a good idea, but parentheses are really annoying, and at least the formula should be written in the usual style." Well, Ruby might make you happy.

Since the conclusion, Ruby has the following advantages:

Interpreter

Ruby is an interpreted language, and its programs can be easily executed without compiling it.

Variable has no type

Ruby's variables have no type, so you don't have to worry about matching static types. Accordingly, the error checking function also weakens.

No variable declaration required

All variables are immediately available without a declaration. In addition, from the variable name can determine what is the variable (local variables, global variables, instance variables).

Simple syntax

Syntax is simpler, similar to ALGOL system syntax.

No memory management required

Has a garbage collection (garbage collect,gc) feature that automatically reclaims objects that are no longer in use.

Everything is an object.

Ruby was designed as a pure object-oriented language from the outset, so everything that is headed by basic data types such as integers is an object, and they all have a unified interface for sending information.

Class, inheritance, method

Ruby certainly has the basic function of object-oriented language.

Special methods

You can add a method to an object. For example, you can write down the action of the GUI button when it is pressed as a method, and use it for object-oriented programming of the prototype library (Prototypebase).

Mixed inserts with modules (mixin)

Ruby intentionally discarded multiple inheritance, but had a mixed insert feature. Use modules to transcend class boundaries to share data and methods.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.