Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Ruby programming language


 Contents
Ruby is an object-oriented programming language. It combines syntax inspired by Ada and Perl with Smalltalk-like object oriented features, and also shares some features with Python, Lisp and CLU. It was originally designed as an interpreted language, though in its JRuby implementation it may be compiled.

1 History

The language was created by Yukihiro "Matz" Matsumoto, who started working on Ruby on February 24, 1993 and released it to the public in 1995. He chose the name to reflect the language's Perl heritage. According to the author, he designed Ruby to follow the principle of least surprise (PoLS), meaning that the language should be free from the traps and inconsistencies that plague other languages. As of February 2004, the stable version is 1.8.1.

2 Philosophy

Ruby is object-oriented: every bit of data is an object, including types that are designated "primitive" in other languages such as integerThe integers consist of the positive natural numbers (1, 2, 3, …) the negative natural numbers (−1, −2, −3,. and the number zero. The set of all integers is usually denoted in mathematics by Z (or Z in blackboard bold, ), which sts. Every function is a method. Named values (variables) designate references to objects, not the objects themselves. Ruby supports inheritanceSee inheritance (computer science) for other computing uses of inheritance. In object-oriented programming of computer science, an inheritance is a way to form new classes or objects using pre-defined objects or classes where new ones simply take over old with dynamic dispatchIn computer science, dynamic dispatch is the process of mapping a method call to a specific sequence of code at runtime (i. dynamically), often in cases where the appropriate method cannot be determined at compile-time (i. statically). It is used in objec, mixinIn computer science, a mixin is a group of functions which can be mixed into a class and become methods. They allow certain classes to take on certain functionality, in an object-oriented programming language that supports multiple inheritance, just as ifs, and singleton methodIn computer science, the singleton design pattern is designed to restrict instantiation of a class to one (or a few) objects. This is useful when exactly one object is needed to coordinate actions across the system. Sometimes it is generalized to systemss (belonging to a class rather than an instance). Though Ruby does not support multiple inheritanceSome programming languages allow multiple inheritance in which a class can inherit behaviors and features from more than one superclass. This contrasts with single inheritance where a class inherits from only one superclass. Multiple inheritance can cause, classes can import moduleA module is a software entity that groups a set of (typically cohesive) subprograms and data structures. Modules promote encapsulation (i. information hiding) through a separation between the interface and the implementation. The module interface expresses as mixins. Procedural syntax is possible, but anything done in Ruby procedurally (ie. outside of the scope of a particular object) is actually done to the Object class. Since this class is parent to every other class, the changes become visible to all classes and objects.

Ruby has also been described as a multi-paradigm programming language: it allows you to program procedurally (defining a function/variable outside a class makes it part of the root 'self' Object), object-orientated (everything is an object) or functionally (anonymous functions, closures, continuations, all expressions return a value, when no return statement is present, functions return the last value evaluated). It has rich support for introspection, reflection and metaprogramming.

According to the Ruby FAQ, "If you like Perl, you will like Ruby and be right at home with its syntax. If you like Smalltalk, you will like Ruby and be right at home with its semantics. If you like Python, you may or may not be put off by the huge difference in design philosophy between Python and Ruby/Perl."



Read more »

Non User