http://www.ntecs.de/old-hp/s-direktnet/rb/ruby.pdf
Ruby가 어떤 점에서 다른 language 들(esp. Python, Perl)에 비해 뛰어난지를 설명하는 article이다. syntax로부터 library까지 여러가지 내용이 있지만, 인상깊었던 것들만 요약하면 다음과 같다.
What is Ruby?
- modern, interpreted and object-oriented programming language
- Ruby > (Smalltalk + Perl) / 2
- developed, having Perl, Python, Smalltalk and Eiffel in mind
Easy to learn
- has good tutorial
- easy syntax
- clean, readable but short
Syntax
- variables only contain references to objects
- all constructs have a value (e.g. if-construct)
- variable name convention defines characteristics of variable (capital letter, small letter, $, @)
(Perl use my, local, ...)
- iterator, blocks with method
- exception model support post-condition (begin-rescue-ensure-end)
- dynamic type checking
OO Features
- instance variables (member variable in C++) are only accessible from insdie the class (maybe getter-, setter- methods)
- attr_accessor function of module Module dynamically creates a getter- and setter- method for each parameter
- extend existing class in adding a whole class
- support only single inheritance
- support mix-in (alternate multiple inheritance): every module can be included into a class
Library
- Perl-like Regular expression
- DB access (MySQL, Msql, PostgreSQL, Interbase, Oracle)
Language Extension
- C/C++ extension
- Ruby/Python