Tony De wrote:
> I am a Delphi programmer on the Windows and Linux platforms.  So I am
> quite acquainted with Object Oriented Programming.  An aspect of which
> Ruby first caught my interest.  And the Model-View-Controller structure
> is quite intriguing to me.  Also, Ruby coupled with Rails scaffolding.
> It's been said you can do anything (relatively) in Ruby that you can do
> in other languages, such as Java, C, Basic, etc.  But I haven't found
> any screen captures or code snippets that would actually prove this out.

I am also a Delphi programmer.  I worked at Borland supporting Delphi 
well before the release of 1.0.  Ruby is nothing like Delphi.  You do 
not have the flexibility with Ruby that any compiled language like 
Delphi or C++ allows.  Delphi is written in Delphi.  Ruby cannot be 
written in Ruby.  Ruby is interpreted and can never run as fast as 
Delphi.  Ruby is fully object oriented making things possible which 
would be shocking in Delphi.

e.g. a number is an object and can, therefore, call internal methods.
my_string = 1.to_s

The "look and feel" difference between the two is that Delphi lets you 
do whatever a computer can do.  Ruby does it FOR you.  During my growing 
pains in Ruby, which persist still :), the trick is not writing code to 
do things but to find out how Ruby does it for you.

One recent example:  I wanted to read through a large file of movie 
titles (all lowercase) and change them to title case.  Ruby's capitalize 
method only gets the first word.  How to do it?  Well, we know how we 
would do it in Delphi or C++ (much the same approach) but here is how it 
shook out in Ruby:

#l is for line and w is for word (not as number word but as string word)
File.foreach('\movies.txt') {|l| puts l.split.map{|w| 
w.capitalize}.join(" ")}

As you can see, it comes down to just describing what you want from Ruby 
and it does it.  Very nice!

Ruby will do a lot.  Most programming consists of a small subset of what 
programs can do.  We read databases.  We calculate things and manipulate 
strings.  We display results in windows or web pages. etc, etc.  Ruby 
does an exemplary job with those things.  If you want write a huge 
online video game you would not do it in Ruby.  It does, however, do 
most everything that most programs do and development time is far 
faster, the code far more compact, and much more easily maintained and 
enhanced.

For what it does, which is considerable, it is excellent.  For 
especially exotic applications, use Delphi through sockets or some such 
thing.
-- 
Posted via http://www.ruby-forum.com/.