Ruby is a fantastic programming language. From the official website,
Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, extensible, and portable.
Oh, I need to mention, it’s totally free, which means not only free of charge, but also freedom to use, copy, modify, and distribute it.
Let’s go through this blurb again:
- Ruby is interpreted (as opposed to compiled). A consequence is that Ruby has a very powerful runtime environment which allows for metaprogramming which is a very advanced (read powerful) programming technique.
- Ruby is a scripting language meaning that it is at the same time a general purpose programming language (like C++ and Java) and a language which can automate tasks in an operating system (scripts) and in applications (macros). Learn it once and apply it everywhere!
- Ruby allows quick and easy object-oriented programming. Ruby is a pure object-oriented language : everything is a object to which messages are sent (exactly like Smalltalk). Additionally, Ruby has blocks which simply allows Ruby to be used as a (very powerful) multi-paradigm programming language.
- Ruby has many features to process text files and to do system management tasks (as in Perl). Ruby has regular expressions and can manipulate operating system resources (file, processes, devices…)
- Ruby is simple [and] straight-forward compared to Java and C++ therefore it allows the (human) programmer to produce bug-free programs quickly and (more or less) effortlessly.
- Ruby is extensible and portable which means that (i) the limit is your imagination (and not the imagination of Yukihiro Matsumoto, Ruby’s (very intelligent) creator) and (ii) your programs will run on a lot of different operating systems.
- Ruby is totally free, which means not only free of charge, but also freedom to use, copy, modify, and distribute it. In other words, Ruby is opensource software.
How to learn Ruby
Ruby is a simple and elegant language and it is easy to learn if you have an open mind… The definitive book to learn Ruby is Programming Ruby – The Pragmatic Programmer’s Guide. It is available is two editions:
- The first edition covers Ruby 1.6 and is freely available online
- The second edition covers Ruby 1.8 and can be bought directly from the author’s website or Amazon.com.
I’ve just bought the second edition and I’m reading it right now.
Of course, there are a lot of tutorials online. I recommend Why’s (Poignant) Guide to Ruby.
Three reasons why I like Ruby
- It’s a beautiful language. I’ve always been a fan of Smalltalk and I find Ruby’s syntax very pretty.
- It’s an object-oriented language and I tend to think in terms of objects, attributes and methods on Mondays, Wednesdays and Fridays.
- It’s a functional language and I tend to think in terms of higher-order functions and recursion on Tuesdays, Thursdays and Saturdays.
Ruby as a first language
Perfect!
In my opinion, Ruby is the perfect programming language to teach programming at college and university level. Ruby’s syntax is clean. Ruby is powerful, modern and portable. In addition to that, I think Ruby stimulates creativity much more than mainstream pramming languages.
Ruby comes with a read-eval-print interpreter called irb which is very powerful. And there are at least two good IDE that I know of, one based on Eclipse called RDT and Eric3.
It’s time to get rid of Java and C++!!! Let our youngsters experience something beautiful instead of something, ahem, industrial…
A (very successful) spinoff
Ruby on Rails is a full-stack framework for developing database-backed web applications. It is gaining enormous acceptance thanks partly to Ruby’s elegance. In fact, I am currently developing my first RoR application right now. I’ll keep you posted.
Conclusion
The revolution is on. Learn Ruby and you’ll be happier. I have and I am ;-)
yan says
Quelques presentations interessantes sur Django et RoR ici: http://www.djangoproject.com/snakesandrubies/
Burito says
Get rid of Java and C++?
Perhaps you’re one of those open-source enthusiasts flouting again and again the merits of such types of languages. Or is it the fact that Java’s free but not open source and that C++ well dominates the scientific software market (not open source either)?
Java and C++ are very demanding when it comes to teaching: they’re not easy to master by standards for the beginner but it instills in him the concept of objects and GUIs very early . Does that mean the guy does not think functionally? I don’t think so. By the way, it’s better for them to dive straight into the popular languages of the moment which are Visual Basic, C++ and of course the unavoidable Java. It’s all about a question of market needs.The trends in modern computing justified the inclusion of C++ and then Java in academia.
Bear in mind: Java’s hard to displace. C++’s here to stay for long years to come. Let’s all see how things play out in academia in the Western part of this world…
Olivier says
I agree. Ruby IS beautiful. And it makes programming fun again!
I’m working on a Ruby project currently, trying to put together a path-finding software for a public transit system.
It is very intuitive, and metaprogramming just blows my mind.
Good continuation!
Javed Mandary says
Come on now one can get rid of JAVA .. JAVA rules :P
Kailash Balnac says
Hi Avinash
Am into learning RoR myself and am about to create my own application.
I just love migrations ! :)
Hope we can share our experiences..
Cheers
Kailash
avinash says
To Burito and Javed:
I’ve been teaching for some years now and I really think that it’s much better to introduce programming using Ruby (or Python or Scheme or Haskell…) instead of C++ and Java.
Of course, the student will afterwards need to learn Java (no real need for C++ IMHO) because of industry demands. One very important consequence of having learnt (and understood) basic programming using Ruby is that the student will be better equipped to understand advanced Java and tools (like Design Patterns & Frameworks, Refactoring, Unit Testing, Object-Relational Mapping, Version Control, etc) instead of simply:
To Yan, Olivier and Kailash:
Yeah! We have all seen the light. Now let’s build great software ;-)
Raj says
Hi
I’ve already downloaded Ruby and intend to have a look soon. One thing I’d like to know though and it applies to all interprated languages such as Perl, Python and Ruby.
How to you deploy your apps and utilities without the end user tampering with the code. I know there’s a compiler for Per from ActiveState but what about Ruby and Python. Any tool yet available to may be just encode the source?
Deploying the full runtimes of these languages of end users would be quite risky (you don’t want your end users trying Hello world on their own …), is there any way to just deploy the runtimes?
I know I can Google for these answers but I thought I’d have your views here.
Cheers
Raj
avinash says
Hi Raj,
All intepreted languages obviously require the interpreter to be installed on the client. And as we all know, interpreters require the source code.
If you don’t want people to get access to your source code (you, naughty boy ;-) ), you have IMHO two possibilities:
(1) Use a compiler! RubyScript2Exe seems very promissing.
(2) Use a code obfuscator. Here is what Google says about obfuscators. Notice that there is still a lot of work to do.
A simpler solution is to release your software as open source ;-)
Anonymous says
Thanks Avinash. Its not a question of sharing my source code :-), its more about end users in a production environment tampering with the source code of applications that are vital to the proper running of the company. I’ll give the two links a try.
Ketwaroo D. Yaasir says
oh and if you are stuck on windows(all hell breaks loose at the mention of the forbidden word), there’s an IDE(work in progress) for windows(Avinash hurls a table at me)
Linkage: http://www.sapphiresteel.com/
and it’s developed by… OMG! Huw Collingbourne! The same guy who created “The Golden Wombat of Destiny”.
Ok, it’s probably that useful.
anywho, the one thing i like about ruby are the talking foxes. yep. that and the star monkeys. all 55,000 of em. (and i’m still on chapter 1)
hrubesh says
Pointers and objects. ‘The address of my object’ is the phrase that keeps me running with programming, vb.net actually sucks. c# is ok, c++ rocks though i last programmed in c++ two years ago, i love java for it brought me in this world of objects.
Someoned mentionned about artists and programming: yeah totally true, Programming is an art, yet not everybody is an artist, I also sing in the bathroom.
I’ve got something for all of you getting into programming, I’ll rather call it coding at this stage, bcs, degrees, diplomas, certifications, whichever the way, it leads to the same direction, the driver is you. when i was a tutor, I interpreted men continuously asking for everything as baby asking to be spoon fed. Anything that is done beautifully is pure creation of the mind, supported by eager to seek and understand.
Extreme programming: I actually forgot the methodologies if this is what they are called., different projects and environment require different approaches, i saw myself doing xp when i programmed in vb.net – okay call it stupid for the programming language does not necessarily determine that, yet i am serious. It was like learning how to eat with a spoon and then comes a princess feeding you with a golden kalchoul. Too many wizards and options in an ilist that generate code is not a good thing.
My opinion, hrub.
Claris says
Hi Avinash, are you aware of any good FREE Ruby IDE running on Windows?
avinash says
Try
* RDT
* Plasmacode
* RaiRails
curiousEngine says
hmmmmmmm, i would like to see your response to the following article:
http://adamconnor.org/?p=63#comments
avinash says
Adam Connor loves LISP and therefore finds anything else less perfect. This is understandable as LISP is really beautiful (I am personally a big fan of Scheme).
That’s all.
Satish Talim says
For those interested, I have my online Ruby Study Notes here (the way I learned Ruby) –
http://rubylearning.com/
Fadilnet says
Python pwns Ruby! – that was my initial impression.
I had to make a choice and I picked Python. hmm..I think I’ll check out Ruby. I just hope not to be modded down @ /. after saying “I am for Ruby” lol.
Luke says
I have a good ruby tutorial. Actually, I will be converting to an online ruby programming book.
http://www.meshplex.org/wiki/Ruby/Ruby_on_Rails_programming_tutorials
avinash says
Nice tutorial Luke!
Keep be informed about your progress if you can.
Jordi says
I don’t think we should be so hasty in wanting to replace C++ and Java, because they are so deeply rooted in the industry. I don’t raelly know a lot about Ruby, but if it’s such a fine language, it might replace them, but it should be done with care rather than haste.
Also, while things are the way they are, I think that a language like this might indeed be a good one for teaching programming. However, I think that a language like C or C++ should also be taught to teach about how a computer works.
avinash says
Hi Jordi,
In fact, I was telling my colleagues the other day that Ruby would be a fine programming language to teach (high-level) programming and C would be extremely good to teach how a computer works.
For me, C is the new assembly and Ruby is the new Pascal and both are important…