Ignite

478 views

Published on

A short i

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
478
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Ignite

  1. 1. RUBY-FIED !! By @phoenixwizard Ignite Talks @kuliza
  2. 2. RUBY ? What are we talking about ?
  3. 4. PHEELOSOPPHHY Often people, especially computer engineers, focus on the machines. They think, "By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something." They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves. Principal OF Least Astonishment (POLA) And after two years of C++ programming, it still surprises me. ( Matsumoto said this NOT @phoenixwizard )
  4. 5. As of 2010, there are a number of complete or upcoming alternative implementations of Ruby, including YARV, JRuby, Rubinius, IronRuby, MacRuby, and HotRuby.
  5. 6. Seeing Everything as an Object “ I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python3.” 5.times { print "We *love* Ruby -- it's outrageous!" }
  6. 7. Blocks, a Truly Expressive Feature search_engines = %w[Google Yahoo MSN].map do |engine| "http://www." + engine.downcase + ".com" end
  7. 8. Ruby’s Visual Appearance var could be a local variable. @var is an instance variable. $var is a global variable.
  8. 9. <ul>[1, 2, 3] * 3 == [1, 2, 3, 1, 2, 3, 1, 2, 3] %w{this is a test} * &quot;, &quot; # => &quot;this, is, a, test&quot; h = { :name => &quot;Fred&quot;, :age => 77 } h.map { |i| i * &quot;=&quot; } * &quot;n&quot; # => &quot;age=77nname=Fred&quot; </ul>
  9. 10. &quot;[%s]&quot; % &quot;same old drag&quot; # => &quot;[same old drag]&quot; x = %w{p hello p} &quot;<%s>%s</%s>&quot; % x # => &quot;<p>hello</p>&quot;
  10. 11. Use enumerations to cut down repetitive code (DRY) %w{rubygems daemons eventmachine}.each do |x| require x end
  11. 12. Use enumerations to cut down repetitive code (DRY) %w{rubygems daemons eventmachine}.each do |x| require x end
  12. 13. Rescue blocks don't need to be tied to a 'begin' def x # ... rescue # ... end
  13. 14. FRAMEWORKS (OTHER THAN RAILS) LET ME FIRST TALK OF RAILS FOR FEW SECONDS !! THE WEB DEVOLPMENT THAT DOESNT HURT
  14. 16. mERp Like Ruby on Rails, Merb is an MVC framework. Unlike Rails, Merb is ORM-agnostic, JavaScript library agnostic, and template language agnostic, preferring plugins that add in support for a particular feature rather than trying to produce a monolithic library with everything in the core. In fact, this is a guiding principle of the project, which has led to third-party support for the ActiveRecord, DataMapper, and Sequel ORMs.
  15. 17. Vintage Vintage is a very small web framework written in Ruby based on the original idea of Merb: Mongrel serving up ERb (Embedded Ruby) templates. The idea has been expanded and now Vintage helps you serve up ERb, HAML, Textile, Markdown, and Markaby templates.
  16. 18. Ruby is Productive and Fun For me, the purpose of life is, at least partly, to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy. I consider a programming language as a user interface, so it should follow the principles of user interface. Yukihiro Matsumoto (a.k.a. “Matz”), 2000, emphasis added
  17. 19. What are the principles of good user interface? Here are the three principles with supporting quotes by Matz: Principle of Conciseness : “I want computers to be my servants, not my masters. Thus, I’d like to give them orders quickly. A good servant should do a lot of work with a short order.”
  18. 20. Principle of Consistency : “... a small set of rules covers the whole Ruby language. Ruby is a relatively simple language, but it’s not too simple. I’ve tried to follow the principle of ‘least surprise.’ Ruby is not too unique, so a programmer with basic knowledge of programming languages can learn it very quickly.” Principle of Flexibility : “Because languages are meant to express thought, a language should not restrict human thought, but should help it. Ruby consists of an unchangeable small core (that is, syntax) and arbitrary extensible class libraries....”

×