Thursday, February 08, 2007

Ruby is…

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

Top Ruby Features according to Michael Neumann

interpreted

advantage:

* immediately executable (no waiting period while compiling)

disadvantage:

* execution speed much slower than with compiler (e.g. Pascal, C++)

object-oriented

In Ruby everything is an object (as in Smalltalk). Ruby did not use multiple-inheritance, but the same is possible through mix-in.

portabel

Ruby is highly portable, so that one and the same Ruby program runs without changes under UNIX, Windows, DOS, Mac, BeOS and others. Of course that's only true unless using platform-specific modules, like for example some GUI's for UNIX or WinGKR (Win32 GUI Kit for Ruby).

advantage:

* less expenditure (only one program had to be managed)
* wider distribution of the program (because it runs on serveral platforms)

untyped

Variables in Ruby have no type, such as in Smalltalk, BASIC or Python. Variables behave as placeholders, but data is typed. In C++ or Pascal, variables are typed (e.g. int / Integer), but the data in the memory is not, that is you cannot recognize if it's a String or an Integer. In C++ or Pascal the types are checked at compile-time, whereas Ruby checks the type at runtime, so if the object understands the message (method-call) is first known after a method-call. You do not have to declare variables, because they are automatically created when you use them.

automatic memory-management (garbage collection)

You do not have to release allocated memory in Ruby (as you have to do in Pascal/C++ with dispose/free). No longer used memory, i.e. memory-frames where no variable points to, are automatically freed by the garbage collector.

advantage:

* no memory leaks
* fewer crashs or errors
* more easier, faster and more uncomplicated programming, because you do not have to look after the memory management.

disadvantage:

* less speed (about 10%). But Ruby is an interpreted language, where 10% are not so much.

easy and clear syntax

Ruby is based among others on the syntax of Eiffel (Ada)

* well legible
* ease to understand
* easy to learn
* fewer errors

Ruby often offers an additional C++ similar syntax

* hardly changes for those, who come from C++ (Perl) to Ruby
* less code ==> faster

advanced OO-concepts and features

* singleton methods
* mix-in instead of multiple-inheritance
* operator overloading
* method-overloading (such as C++)
* exception handling
* iterators and closures
* meta-class
* build-in pattern-matching (like Perl)

other features

* Ruby is free, also for commercial applications
* many existing libraries make programming easy
* Ruby is permanently developed, without loosing backward-compatibility
* There are interfaces to Python, Perl and Java. Thus existing programs can be reused.
* Many important data-structures are available (such as dynamic arrays (lists), strings, bignum, complex, ....)
* Easy to extend through C/C++ with dynamic (DLL's) or static binding.

1 comment:

[..] said...

I dunno man..... Its kinda weird...

Me not liking it very much cos at least for me the code is not THAT understandable.

Looks good though