Good morning!
Ruby vs The World
@arnab_deka
http://arnab-deka.com/
Favorite Language?
![](http://www.northeastern.edu/securenu/wp-content/uploads/2013/01/Java_Logo.jpg)
![](http://ecx.images-amazon.com/images/I/31euHZManML.jpg)
![](http://www.stroustrup.com/3rd_front.jpg)
![](http://earthintegrate.com/wp-content/uploads/2012/09/best-javascript-sites.jpg)
![](http://www.rogerwendell.com/images/perl/perl_logo.jpg)
![](http://bytec0de.com/images/csharpdotnet.png)
![](http://upload.wikimedia.org/wikipedia/en/thumb/8/85/Scala_logo.png/200px-Scala_logo.png)
![](http://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Clojure-glyph.svg/512px-Clojure-glyph.svg.png)
![](http://www.whitefireseo.com/wp-content/uploads/2011/10/ruby.png)
History
-
1995: Yukihiro Matsumoto, 'Matz'
-
2001: The Pick-Axe book
-
2004: Ruby on Rails by DHH
![](http://imagery.pragprog.com/products/49/ruby.jpg?1298589710)
Speed???
vs
![](http://blog.hellobc.com/wp-content/uploads/2013/08/Slow-Food-Cycle-2006006-1-1024x768.jpg)
![](http://1.bp.blogspot.com/_hDKJgVJODPY/SrTg13wvmjI/AAAAAAAAAMA/My2qqmSZmGk/s400/Ferrari_F1_194.jpg)
![](http://img95.imageshack.us/img95/7711/ralfschumacherrubensbarnn8.jpg)
There's always another story...
![](http://www.flairandsquare.com/wordpress/wp-content/uploads/2007/08/logo.gif)
![](http://www.nzbybike.com/assets/Uploads/NZbyBike-Spaceship-Near-Kaikoura.jpg)
![](http://upload.wikimedia.org/wikipedia/en/thumb/4/40/Octocat,_a_Mascot_of_Github.jpg/220px-Octocat,_a_Mascot_of_Github.jpg)
![](http://embed.ly/static/providers/logos/scribd.png?v=5e293)
![](http://assets.huluim.com/h2o/facebook_share_thumb_default_hulu.png)
![](http://www.efbir.org/wp-content/uploads/2011/07/Justin-TV-1.png)
![](https://si0.twimg.com/profile_images/2284174758/v65oai7fxn47qv9nectx.png)
![](http://crossfithud.com/wp-content/uploads/2013/07/LS_Logo_Color_4c.jpg)
Pure OO
1.methods => => [:to_s, :inspect, ...]
"a string".class => String
No special syntax
Vehicle.new # not new Vehicle()
1 + 2 # => 1.+(2)
Mixins
- like interfaces, but with implementation
- better than interfaces (Java)
-
clearer than multiple-inheritence (C++/Python)
Elegant & Readable
cars.map(&:registration_number).reject(&:empty?).join("\n")
// the map part, in Java:
List<String> plates = new ArrayList<String>(); for(Car c: cars) { plates.add(c.registrationNumber(); }
sentence.split.reverse.join ' ' # ruby
" ".join(reversed(sentence.split())) # python
Principle of Least Astonishment
File: read, open, exists?, path
Functional
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."
_why
Powerful Meta-Programming
-
method_missing
xml = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
xml.coder {
xml.name '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
-
MINASWAN
-
ecosystem/open source
-
We have lots of drama too!
![](http://f.cl.ly/items/2E0B2q0H1C1P0N3m1J41/Screen%20Shot%202013-08-23%20at%2010.23.58%20AM.png)
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!
- Scott Pilgrim vs The World poster: http://collider.com/
- TIOBE Programming Community index: http://www.tiobe.com/
- High-traffic sites using Rails: http://qr.ae/IVYAn
- Steve Yegge's quote:
- @ErskineRob's tweet on gems
- Quote from _why in a tweet from @gazoombo
- Q&A with Matz: http://j.mp/1d9p4wK
- 37Signals: Optimize for happiness: http://j.mp/1d9pdjH
Ruby vs the world
By Arnab Deka
Ruby vs the world
- 3,648