• Like
  • Save

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.

Like this presentation? Why not share!

Intro To Ror

on

  • 1,999 views

 

Statistics

Views

Total Views
1,999
Views on SlideShare
1,994
Embed Views
5

Actions

Likes
0
Downloads
32
Comments
0

2 Embeds 5

http://www.drhadramy.com 3
http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Intro To Ror Intro To Ror Presentation Transcript

    • An Introduction to Ruby and Rails Matthew Bohnsack Wannabe Rubyist November 9th 2005
    • Outline What is Ruby and why should I care?  What is Rails and why should I care?  Two must-have tools for Ruby development  Major Ruby features (the language in a nutshell)  Rails overview  Where to go for more information  Questions / Hacking  2 An Introduction to Ruby and Rails November 9th 2005
    • What is Ruby? Why should I care? What:  The Wikipedia answer is here.  Created/lead by Matz (Japanese)  Open Source interpreted scripting language, like Perl, Python,  Tcl, etc., but focused on being very object oriented, expressive, and bringing joy to programming. Principle of least surprise  Why:  Productivity ideas presented in Ousterhout’s 1998 paper coming  to very serious critical mass (and beyond) Learn a new language to learn new ways of thinking about code  in any language (e.g., blocks and iterators) Joy!  3 An Introduction to Ruby and Rails November 9th 2005
    • What is Rails? Why should I care? What:  Web Framework that makes building database-driven MVC-oriented web apps  easy through a template engine, ORM (ActiveRecord) and other best practices, such as test driven development, deployment tools, patterns, etc.  Much less complicated than J2EE solutions, but perhaps more so than PHP or Perl in cgi-bin.  Copy cats are being created in other languages: Python (TurboGears)  Perl (Maypole)  http://rubyonrails.org/ + book + online screencasts + online docs & tutorials  Why:  I’ve been watching the world of web development since ~ 1995, and I’ve never  seen anything like Rails in terms of buzz, momentum, adoption rate, etc. 4 An Introduction to Ruby and Rails November 9th 2005
    • Must have tool #1: irb # ~/.irbrc Interactive ruby console:  require 'irb/completion' use_readline=true  Experimenton the fly auto_indent_mode=true  Tab complete object methods … 5 An Introduction to Ruby and Rails November 9th 2005
    • Must have tool #2: ri Console-based Ruby doc tool  6 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – irb sessions follow Like all interpreted scripting languages, you can  put code into a file, chmod +x, then just execute it. But, we’ll mostly use irb sessions in this  presentation… 7 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – objects are everywhere Some languages have built-in types that aren’t  objects. Not so with Ruby. Everything’s an object: 8 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – objects have methods Bang on the tab key in irb to see the methods that are available for each object. 9 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Variables Local variables - start with lower case:   foo  bar Global variables - start with dollar sign:   $foo  $bar Constants and Classes – start with capital letter:   CONSTANT  Class Instance variables – start with at sign:   @foo  @bar Class variables – start with double at sign:   @@foo  @@bar 10 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Arrays 11 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Hashes 12 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Symbols Starts with a ‘:’  Only one copy of a symbol kept in memory  13 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Blocks & Iterators 14 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – It’s easy to build classes 15 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – It’s fun to play with classes (like the one we just made) 16 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Classes are open Example shown here uses our Hacker  class, but what happens when the whole language is open? 17 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – Other notes on Classes Ruby only has single inheritance. This  makes things simpler, but mix-ins provide much of multiple inheritance’s benefit, without the hassle. 18 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – a few gotchas Despite the principle of least surprise:   Zero isn’t false:  No increment operator (foo++). Instead use: foo += 1  foo = foo + 1  19 An Introduction to Ruby and Rails November 9th 2005
    • Ruby in a nutshell – RubyGems CPAN for Ruby?  http://docs.rubygems.org/  Examples:  gem list  gem install redcloth --version quot;>= 3.0.0quot; … Using gems in your program:   require ‘rubygems’  require ‘some_gem’ 20 An Introduction to Ruby and Rails November 9th 2005
    • Want to learn more Ruby? Excellent, simple, beginner’s tutorial:   http://www.math.umd.edu/~dcarrera/ruby/0.3/index.html Other stuff at end of talk  Start hacking  21 An Introduction to Ruby and Rails November 9th 2005
    • Quick Rails Demo – Build a TODO list application in 5 minutes Define database  rails todo  cd todo  Edit config/database.yml  ./script/generate model Todo  ./script/generate scaffold todo  Look at scaffolding  ./script/server –b www.bohnsack.com  Add due_date field, regenerate scaffolding, and check the results  ./script/console  22 An Introduction to Ruby and Rails November 9th 2005
    • Where to go for more information Books:  Online material:  First edition of Pickaxe online for free  http://www.ruby-doc.org/  why’s (poignant) guide to Ruby  http://rubyonrails.org/  Rails screencast(s)  Planet Ruby on Rails  23 An Introduction to Ruby and Rails November 9th 2005
    • The End / Questions 24 An Introduction to Ruby and Rails November 9th 2005