Ruby is pretty cool. Its an interpreted language, written by Yukihiro
Matsumoto (Matz) and much popularized by a group of
guys who call themselves the 'Pragmatic Programmers'.
Must say, it is a pretty
pragmatic language.
Ruby is worth a look, because despite my limited exposure to it, I find that most tasks can be accomplished done rather easily in ruby. The number of lines of code you have to type for any application is typically much lesser than in a conventional language like c. Also most of the code is usually towards doing-the-task at hand rather than in 'house-keeping'.
As a comparison with c, ruby has got far more language built in constructs that offer (often) nicer ways of expressing a something. It may not be the elegant kernel hacker thing, but come on, often when you need to get a quick job done, what do you resort to ?... shell script... perl/python/bash ... and under windows ? hello... do I hear any wsh ... ? So ruby is like a build up on all these 'languages'. Its more powerful (as a language) than most of these and it has wide field of applicability.
"Shut up and code"
Ok. (comments are in italics)
| #prints hello 10 times | |||
| 10.times print "hello" | |||
| #check email via pop and print out the first one | |||
require 'net/pop'
pop = Net::POP3.new('server.ruby-stuff.com')
pop.start('user', 'secret') do |pop|
msg = pop.mails[0]
# Print the 'From:' header line
puts msg.header.split("\r\n").grep(/^From: /)
# Put message to $stdout (by calling <<) puts "\nFull message:\n" msg.all($stdout) end |
|||
| #open a file and print its contents | |||
f=File.new("text.txt","r")
f.each_line {|line|
puts line
}
|
|||
| #windows guys... its got ole interfacing | |||
|
require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.gohome |
|||
Yes you guessed it, its object oriented... actually they have a whole lot to say about their language and an online book to download to get you started there are command line version and things with 'rather shabby' windows based editors to play with.
Definitely worth some attention guys. You cant be writing production quality megabyte code monsters here, but its the kind of language that is great for getting a small job done fast.
[ The following is pasted from the ruby book - 'Programming Ruby - The Pragmatic Programmers Guide' ]
|
This book is a tutorial and reference for the Ruby programming language.
Use Ruby, and you'll write better code, be more productive, and enjoy
programming more.
These are bold claims, but we think that after reading this book you'll agree with them. And we have the experience to back up this belief. As Pragmatic Programmers we've tried many, many languages in our search for tools to make our lives easier, for tools to help us do our jobs better. Until now, though, we'd always been frustrated by the languages we were using. Our job is to solve problems, not spoonfeed compilers, so we like dynamic languages that adapt to us, without arbitrary, rigid rules. We need clarity so we can communicate using our code. We value conciseness and the ability to express a requirement in code accurately and efficiently. The less code we write, the less that can go wrong. (And our wrists and fingers are thankful, too.) We want to be as productive as possible, so we want our code to run the first time; time spent in the debugger is time stolen from the development clock. It also helps if we can try out code as we edit it; if you have to wait for a 2-hour make cycle, you may as well be using punch cards and submitting your work for batch compilation. We want a language that works at a high level of abstraction. The higher level the language, the less time we spend translating our requirements into code. When we discovered Ruby, we realized that we'd found what we'd been looking for. More than any other language with which we have worked, Ruby stays out of your way. You can concentrate on solving the problem at hand, instead of struggling with compiler and language issues. That's how it can help you become a better programmer: by giving you the chance to spend your time creating solutions for your users, not for the compiler. |
|||
[ The following is pasted from the ruby book - 'Programming Ruby - The Pragmatic Programmers Guide' ]
Web SitesThe official Ruby Home Page is http://www.ruby-lang.org. You can also find Ruby information at http://www.rubycentral.com. In particular, you'll find complete online references to Ruby's built-in classes and modules at http://www.rubycentral.com/ref/, and to the Ruby FAQ at http://www.rubycentral.com/faq/. While you're surfing, drop in on http://www.pragmaticprogrammer.com and see what we're up to. |
|||