Ruby

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    5 Favorites

    Ruby - Presentation Transcript

        • Ruby
        • A Programmer's Best Friend
      http://creativecommons.org/licenses/by/2.5/
    1. Disclaimer: This ((might|will) be|is) a Technical Talk
    2. Disclaimer: This might be a Technical Talk This will be a technical talk This is a Technical talk
    3. You decide.
    4. aizat.who?
      • Ezwan Aizat Bin Abdullah Faiz
        • [email_address]
      • Web Developer
      • Ruby, Ruby on Rails, PHP, LAMP
      • (Previous) MyOSS Meetup Organizer
    5. My Background
      • Still a University Student
        • Monash University
      • 10 years ago
        • Basic HTML
      • Took a long break
      • 5 years ago, I tried to learn
        • C++
      • 3 years ago, I learned
        • PHP
      • 1 year ago, I experimented with
        • C, Ruby, Python
      • Winner of the eGenting Competition 2006
        • using Ruby
    6. Ruby.is_a?
      • Programming Language
      • Interpreted Scripting Language
      • Duck language
      • Inspired from:
        • Smalltalk, Perl, Lisp, Python, CLU, Dylan
      • Syntax is generally like all other programming languages
    7. Ruby's History and Background
      • Developed in Japan
      • Yukihiro Matsumoto
        • Was in Malaysia last year for AsiaOSS
      • First public Release in 1995
      • Aim was in “trying to make Ruby natural, not simple,”
    8. 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. Yukihiro Matsumoto
    9. Basic Features
      • Classes, Inheritance
      • Threads
      • Cross Platform
      • Iterators and Closures
      • Garbage Collection
      • Exception Handling
      • Object Oriented
      • Regular Expressions
      • Variables are not typed
      • Powerful string operations
      • Operator Overloading
      • Introspection, Reflection, Meta programming
    10. To Ruby From Java
      • Similarities
        • Garbage Collector
        • Objects are strongly typed
        • public, private and protected methods
        • Embedded doc tools
      • Differences
        • Don't need to compile code, just run it
        • No static type checking
        • No casting
      http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-java/
    11. To Ruby From PHP
      • Similarities
        • Dynamically typed
        • eval
        • Fairly large standard library
        • Arrays and hashes work like expected
      • Differences
        • Strong typing
        • Everything is an object
        • No abstract classes or interfaces
        • Almost everything is a method call
      http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-php/
        • Ruby declared TIOBE's Programming Language of 2006
        • http://www.oreillynet.com/ruby/blog/2007/01/ruby_declared_tiobes_programmi.html
    12. TIOBE Programming Community Index
    13. TIOBE Programming Community Index In the recent past it was necessary to have a large company behind the language to get it in the spotlight (Sun with Java, Microsoft with C#), but nowadays a killer app appears to be sufficient. Viral marketing via the Internet works! The winners of the last 2 years, PHP and Java, are the losers of this year.
        • Generally its like all other programming languages,
        • Except with a few syntax changes
    14. Conditions
      • General
      • Ruby
      if condition # ... elsif condition2 # ... else # ... end b = a if condition unless condition # ... else # ... end b = a unless condition if (condition) { # ... } else if (condition2) { # ... } else { # ... }
    15. Loops
      • General
      • Ruby
      while i < 5 # ... end until i == 5 # ... end apples.each { | apple | ... } shapes.each do | shape | puts shape.polygon? puts shape.sides? end while (condition) { # ... } for (int i; i < array.length; i++) { # ... }
    16. Exception Handling
      • Ruby
      • General
      try { # ... } catch (Exception e) { # ... } finally { # ... } begin # ... rescue RuntimeException => e # ... rescue e # ... ensure # ... end
      • The Differences
        • “Ruby is simple in appearance, but is very complex inside, just like our human body”
        • Yukihiro Matsumoto
        • http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/2773
    17. Optional Syntax Full of Expression
    18. Expression
      • Parentheses are optionals (sometimes)
      • Semicolons are optional
      • Methods can include '!' and '?'
      array.uniq.sort “ Ruby IS THE BOMB”.downcase! “ Regular expressions are fun”.gsub(/fun/, 'sweet') “ Wasting space “.strip!
    19. Simpler AND Nicer looking code
    20. Everything is an Object
      • Numbers and other primitive types are not objects
      1.upto(100) { |i| puts i } 3.14159265.ciel 2.71828182845905.floor
        • Meta Programming
        • (or shooting oneself in the foot)
    21. What is Meta Programming? Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data or that do part of the work during compile time that is otherwise done at run time. In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually. Taken from http://en.wikipedia.org/wiki/Metaprogramming
    22. Magic!
      • Santize a string
      • Convert all non alphanumeric to a 'underscore'
      class String def sanitize self .gsub( / [^a-z1-9]+ /i , ' _ ' ) end end puts &quot; Ruby gives you alot of $$$ yo! &quot; .sanitize # Ruby_gives_you_alot_of_yo_
      • Need to shuffle an array?
      class Array def shuffle size.downto( 1 ) { | n | push delete_at(rand(n)) } self end end %w[ a b c d e f g ] .shuffle # [&quot;c&quot;, &quot;e&quot;, &quot;f&quot;, &quot;g&quot;, &quot;b&quot;, &quot;d&quot;, &quot;a&quot;]
        • Why Ruby?
      • Simpler and concise
      • Full of expression
      • Easier to understand
      • Productive
      • Large number of libraries
    23. But, mainly because it's a lot more FUN
    24. Who uses Ruby?
      • HP
      • Sun
      • Microsoft
      • Intel
      • NASA
      • NOAA
      • 37 signals
      • etc...
      • Whole community built around it
      • Ruby Central - Non Profit Organization
      • Ruby Conference
      • etc...
    25. Ruby on Rails
        • Convention over Configuration
        • http://www.rubyonrails.com
    26. Hottest thing to hit Web Development
      • Web Application Framework
      • Rapid Application/Iterative Development
      • AJAX ready
      • Convention over Configuration
      • Why Ruby?
        • Dynamic
        • Flexible
        • Utilizes Meta Programming heavily
        • Domain specific language
    27. Buzz Words Buzz Words Buzz Words
    28. Popular Sites
      • Basecamp
        • Project Management
      • Twitter
        • What are you doing?
    29. Why not Ruby?
    30. Several Limitations
      • Slow performance
        • not massively, just marginally
        • Benefit is better code
        • Now a days we have processing cycles to waste
        • Write it in Ruby C Extensions!
        • Fixed in Ruby 2.0
      • Limited Unicode Support
        • Fixed in Ruby 2.0
      • So when is Ruby 2.0 coming out?
        • Hopefully soon...
    31. Resources Programs
    32. IRB – Interactive Ruby
      • Experiment with Ruby from the command line
      • Write quick code snippets
      • Enhanceable using Ruby
        • Support syntax highlighting
      $ irb >> puts “Hello World” Hello World => nil >>
    33. RI – Ruby Information
      • Quick Ruby documentation
      • Takes from both the ruby core code and the external libraries (rubygems)
      $ ri String#chop! Returns a new String with the last character removed. If the string ends with , both characters are removed. Applying chop ...
    34. Resources Sites
    35. Informational
      • Ruby Progamming Language
      • http://www.ruby-lang.org
      • Wikipedia
        • all knowing, all powerful Wikipedia
        • http://www.ruby-lang.org
    36. Learning
      • Why's (Poignant) Guide to Ruby
      • http://poignantguide.net/ruby/
      • Ruby In Twenty Minutes
      • http://www.ruby-lang.org/en/documentation/quickstart/
    37. MyOSS Meetup
      • Bob Sutor
      • Speaking on Open Source, Open Standards and ODF
      • The Shift to 'Open': Boost or Brakes for Innovation and Business
      • 20 th April (next Friday)
      • Open University Malaysia (near KLCC)
      • 7:00-9:30pm
        • http://foss.org.my/projects/meetups/april-2007
        • Questions?
        • Thank You
        • [email_address]
        • Let's Dive Into Ruby

    + Aizat FaizAizat Faiz, 3 years ago

    custom

    2835 views, 5 favs, 0 embeds more stats

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 2835
      • 2835 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 5
    • Downloads 137
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags