Good morning!

Ruby vs The World


Favorite Language?



  • 1995: Yukihiro Matsumoto, 'Matz' 
  • 2001: The Pick-Axe book
  • 2004: Ruby on Rails by DHH




There's always another story... 


Pure OO

 1.methods => => [:to_s, :inspect, ...]"a string".class => String

No special syntax # not new Vehicle()1 + 2 # => 1.+(2)


    • like interfaces, but with implementation
    • better than interfaces (Java)
    • clearer than multiple-inheritence (C++/Python) 

Elegant & Readable"\n")
// the map part, in Java:List<String> plates = new ArrayList<String>();
for(Car c: cars) {
sentence.split.reverse.join ' ' # ruby" ".join(reversed(sentence.split())) # python

Principle of Least Astonishment

 File: read, open, exists?, path


 Array/Hash/any Enumerable:   numbers.all? {|number| number.odd? }   ... none?, any?, none?, one?, include?   each, map, reduce, select/reject, sort/group/count, slice etc.
"It's so consistent that you start being able to guess how things will work, and you're right most of the time. It's beautiful. And fun. And practical."
- Steve Yegge
"My conscience won’t let me call Ruby a computer language. That would imply that the language works primarily on the computer’s terms."

Powerful Meta-Programming

  • method_missing

xml =>STDOUT, :indent=>2)xml.coder { 'Matsumoto', :nickname => 'Matz'  xml.language 'Ruby'}# ⇒ <coder><name nickname="Matz">Matsumoto</name><language>Ruby</language></coder>

  • evals and define_method

# Task: description(string), completed(boolean)Task.find(:one, :conditions => {description: 'Attend #RailsGardenBLR'})Task.find_by_description('Attend #RailsGardenBLR')Task.find_all_by_completed(true)
Task.find_or_create_by_description('Go back happy!')

Meta-Programming Gyaan

The best part: Community

  • ecosystem/open source
  • We have lots of drama too!

The best-est part: Developer Happiness

The goal of Ruby is to make programmers happy. I started out to make a programming language that would make me happy, and as a side effect it’s made many, many programmers happy.
- Matz

Happiness has a cascading effect. Happy programmers do the right thing. They write simple, readable code. They take clean, expressive, readable, elegant approaches. They have fun.
- DHH, 37Signals

Thank you!

Ruby vs the world

By Arnab Deka

Loading comments...

More from Arnab Deka