Okay, I'm Starting to Like Ruby

I was just playing around with Ruby and just guessing at how things might work. I was fairly impressed that this just worked:


value = gets
puts value



It just prints out whatever text you enter. Yeah, it's simple, but the fact is that it works without even looking like code. I was also really happy to find out that this works:


def test_function
    "Hello"
end

puts test_function



The effect here is subtle, but note how there's no "return" in the function. I really love the fact that the language works so hard to eliminate noise. I'm starting to come around.  :)
Design Element
Okay, I'm Starting to Like Ruby
Posted Oct 4, 2005 — 5 comments below




 

Jeff Watkins — Oct 04, 05 409

Scott, you might consider looking at TurboGears. It's a Python "megaframework" -- basically a bunch of Python projects layered together to make a really nice Web application development environment.

It's still in its infancy, but I think it has real promise. I can't say I'm completely enamoured with the Python syntax (don't like colons or the lack of semicolons), but it's a really fast environment to write code on the order of Cocoa fast.

Plus there's a ton of python code out there...

Chris — Oct 04, 05 410

There is a lot of cool in Ruby. Get the pickaxe book. It's culturally compatible with Objective-C in many ways, and in many ways it's better. Ruby's object system and dynamic method dispatch also makes immediate sense to an Objective-C developer -- they're both Smalltalk-derived.

Mr eel — Oct 04, 05 414

Ruby isn't a noisy or crufty language, which I really enjoy. As a comparison, as much as I like javascript, it is very messy compared to Ruby. Lots of semi-colons and brackets.

Ruby's emphasis seems to be on less code. This means both in the syntax (no semi-colons, hooray!), and language features that short-cut alot of coding.

A good example are the blocks and iterators. I very rarely write a for loop in Ruby. I find that the code tends to be very terse and generally more readable.

That said, sometimes it doesn't always work well. In some situations the code can be too terse, and so a bit more difficult to read if you aren't familiar with Ruby. Luckliy this is pretty rare.

Ahem... yes! A lovely language :)

Jo — Oct 06, 05 419

Want to use Ruby & Cocoa for your Mac OS X app? See here: www.infinitenil.com/developers.html (the RubyCocoa framework).

Peter — Oct 06, 05 420

Some cool Ruby code snippets can also be found here: www.rubyquiz.com and www.rubygarden.org/ruby?RubyOnlineCookbook. Quite a good quick ref site is www.rubycentral.com/ref/: array1 << array2; puts array1.flatten! One of my favorite Ruby info sites is redhanded.hobix.com! Enjoy!




 

Comments Temporarily Disabled

I had to temporarily disable comments due to spam. I'll re-enable them soon.





Copyright © Scott Stevenson 2004-2015