9. ● Ruby is NOT a perfect language
● Ruby is NOT the best language for
every scenario
10. "a language can’t be
good for everyone and
every purpose, but we
can strive to make it
good for 80% of what is
needed in a
programming language"
The most important slide so far
Yukihiro ‘Matz’ Matsumoto
(creator of Ruby)
http://goo.gl/0p7tBv
12. http://www.ruby-lang.org/en/about/
"Ruby is a language of careful balance.
Its creator, Yukihiro “Matz” Matsumoto, blended
parts of his favorite languages
(Perl, Smalltalk, Eiffel, Ada, and Lisp)
to form a new language that balanced
functional programming with imperative
programming."
13. ● everyone has good ideas
● BUT not everyone perform well
Let's talk about something that
matters
http://goo.gl/60awJp
14.
15. How?
perform well := adaptability to changes
either in the early stages (prototype)
or in the subsequent evolutions
18. coding is a creative process
positive thoughts unleash creativity
if coders are happy then creativity boosts
19. Provide them tools that actually improves the
efficiency of their environment
(also, pay them well enough so that they
don't worry about the economic details)
A good way to make
coders happy
20. The code you have to actually type
is the code you wish you had.
Today’s definition for
EPIC WIN
23. “In the 1970s, researchers found that
developers tend to write roughly the
same number of lines of code every
day, regardless of what language
they're working in.”
Terseness #1
B. Boehm, Software Engineering Economics, Prentice-Hall, ISBN 0-138-22122-7, 1981.
24. Terseness #2
"the first 10 book's title, ordered alphabetically"
(it’s actually shorter than the corresponding english sentence)
25. Immediate feedback
I want to be able to “play” with the data:
Don't limit my designing skills
(testing new ideas)
Don't limit my problem solving skills
(debugging)
34. The pitfall of most frameworks
“Be the best at all the things!”
It usually ends up for the framework to be less
than average.
Even worse: “Let's do it by configuring all
the things!” (every time, from scratch)
=> a lot of time effort
37. ● console
● standalone app server (but you can
choose whatever you like)
Fully isolated development
environment
38. Code organization
Follows the MVC pattern:
The goal is to understand in almost zero time
where a file is or should be located.
app/
models/
views/
controllers/
39. Code organization #2
Tends to fight bad practices such as:
● single directory with hundreds of files
● few huge monolithic files
41. Data persistence: ActiveRecord #2
If the database table happens to contain
additional fields like "name" and "age" the
developer doesn't need to update any code in
order to perform these:
author = Author.take(name: 'PKD')
author.age # => 55
author.age = 53
author.save
42. Data persistence: ActiveRecord #3
Even relations are easily mapped with little
effort:
class Author < ActiveRecord::Base
has_many :books
end
class Book < ActiveRecord::Base
belongs_to :author
end
- authors
id: integer
- books
id: integer
author_id: integer
author.books.first
author.books.destroy_all
author.books << Book.create
43. Here are some of the tools that makes Ruby
shine.
The focus should not be placed into what
they do, but how they have been
architectured so that your effort consists only
in declaring your needs.
When you use Ruby, you
get the whole ecosystem
for free
45. $ irb
> require ‘nokogiri’
> require 'open-uri'
> doc = Nokogiri::HTML(open("http://www.nytimes.com"))
> puts doc.
css('.story h3').
map {|story| "- #{story.text.strip}"}
- Obama's Battle for Votes on Syria Strike Is Taut and Uphill
- In Egypt, a Welcome for Syrian Refugees Turns Bitter
- Facing Fury Over New Law, Stoli Says '€˜Russian? Not Really'
- Two Men, 58 Years and Counting
- Editorial: Banning a Pseudo-Therapy
- Loose Ends: My Adventures in Their Clutches
$ gem install nokogiri
46. "RSpec is testing tool
for the Ruby
programming language.
Born under the banner
of Behaviour-Driven
Development,
it is designed to make
Test-Driven
Development a
productive and
enjoyable experience"
Testing with RSpec
# spec/bowling_spec.rb
require 'bowling'
describe Bowling, "#score" do
it "returns 0 for all gutter game"
do
bowling = Bowling.new
20.times { bowling.hit(0) }
bowling.score.should eq(0)
end
end
$ rspec bowling_spec.rb --format nested
Bowling#score
returns 0 for all gutter game
Finished in 0.007534 seconds
1 example, 0 failures
47. Who uses Ruby?
● http://www.shopify.com/
● http://www.yellowpages.com/
● https://github.com/
● https://www.heroku.com/
● https://twitter.com
● http://www.hulu.com/
● http://www.scribd.com/
● http://www.slideshare.net/
● http://www.soundcloud.com/
● http://www.prada.com
Ruby is used for both web and system programming
Ruby is used by both startups and enterprise companies
(Someone you might know)