• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Rails 3 Beginner to Builder 2011 Week 1
 

Rails 3 Beginner to Builder 2011 Week 1

on

  • 13,946 views

This is the first of 8 presentations given at University of Texas during my Beginner to Builder Rails 3 Class. For more info and the whole series including video presentations at my blog: ...

This is the first of 8 presentations given at University of Texas during my Beginner to Builder Rails 3 Class. For more info and the whole series including video presentations at my blog:


http://schneems.tumblr.com/tagged/Rails-3-beginner-to-builder-2011

Statistics

Views

Total Views
13,946
Views on SlideShare
4,008
Embed Views
9,938

Actions

Likes
6
Downloads
154
Comments
2

16 Embeds 9,938

http://ontwik.com 5324
http://schneems.com 4490
http://teamco-anthill.blogspot.com 33
http://www.schneems.com 23
url_unknown 17
http://www.helpified.com 13
http://schneems.tumblr.com 11
http://localhost 10
http://www.slideshare.net 5
http://teamco-anthill.blogspot.de 4
http://translate.googleusercontent.com 2
https://helpified.com 2
http://teamco-anthill.blogspot.jp 1
http://xzgkjn.net 1
http://www.thinkbohemian.com 1
http://teamco-anthill.blogspot.co.uk 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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

12 of 2 previous next

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

Rails 3 Beginner to Builder 2011 Week 1 Rails 3 Beginner to Builder 2011 Week 1 Presentation Transcript

  • Beginner To Builder Week 1 Richard Schneeman @schneemsJune, 2011Friday, June 10, 2011
  • Background • Georgia Tech • 5 Years of Rails • Rails dev for Gowalla@SchneemsFriday, June 10, 2011
  • About the Class • Why? • Structure • Class & Course Work • Ruby through Rails • 8 Weeks • 1 hour@SchneemsFriday, June 10, 2011
  • Rails - Week 1 • Ruby • Versus Rails • Data Types • Rails Architecture • MVC (Model View Controller) • ORM (Object Relational Mapping) • RESTful (REpresentational STate)@SchneemsFriday, June 10, 2011
  • Rails - Week 1 •Workspace • Version Control - Keep your code safe • RubyGems - Use other’s code • Bundler - Manage Dependencies • RVM - Keep your system clean • Tests - make sure it works@SchneemsFriday, June 10, 2011
  • Ruby Versus Rails • Ruby - Is a programming Language • Like C# or Python • Can be used to program just about anything • Rails - Is a Framework • Provides common web functionality • Focus on your app, not on low level details@SchneemsFriday, June 10, 2011
  • Rails is a Web Framework • Develop, deploy, and maintain dynamic web apps • Written using Ruby • Extremely flexible, expressive, and quick development time@SchneemsFriday, June 10, 2011
  • Technologies • Html - creates a view • Javascript - makes it interactive • css - makes it pretty • Ruby - Makes it a web app@SchneemsFriday, June 10, 2011
  • @SchneemsFriday, June 10, 2011
  • Ruby Resources • why’s (poignant) guide to ruby • Free, quirky • Programming Ruby (Pickaxe) • Not free, encyclopedic@SchneemsFriday, June 10, 2011
  • Ruby Resources • Metaprogramming Ruby • Skips basics • Unleash the power of Ruby@SchneemsFriday, June 10, 2011
  • Interactive Ruby Console (IRB) or http://TryRuby.org/@SchneemsFriday, June 10, 2011
  • Ruby Strings • Characters (letters, digits, punctuation) surrounded by quotes food = "chunky bacon" puts "Im hungry for, #{food}!" >> "Im hungry for, chunky bacon!" "Im hungry for, chunky bacon!".class >> String@SchneemsFriday, June 10, 2011
  • Ruby (numbers) 123.class >> Fixnum (123.0).class >> Float@SchneemsFriday, June 10, 2011
  • Ruby Symbols •Symbols are lightweight strings • start with a colon • immutable :a, :b or :why_the_lucky_stiff :why_the_lucky_stiff.class >> Symbol@SchneemsFriday, June 10, 2011
  • Ruby Hash •A hash is a dictionary surrounded by curly braces. •Dictionaries match words with their definitions. my_var = {:sup => "dog", :foo => "bar"} my_var[:foo] >> "bar" {:sup => "dog", :foo => "bar"}.class >> Hash@SchneemsFriday, June 10, 2011
  • Ruby Array •An array is a list surrounded by square brackets and separated by commas. array = [ 1, 2, 3, 4 ] array.first >> 1 [ 1, 2, 3, 4 ].class >> Array@SchneemsFriday, June 10, 2011
  • Ruby Array •Zero Indexed array = [ 1, 2, 3, 4 ] array[0] >> 1 array = [ 1, 2, 3, 4 ] array[1] >> 2@SchneemsFriday, June 10, 2011
  • Ruby Blocks •Code surrounded by curly braces 2.times { puts "hello"} >> "hello" >> "hello" •Do and end can be used instead 2.times do puts "hello" end >> "hello" >> "hello"@SchneemsFriday, June 10, 2011
  • Ruby Blocks •Can take arguments • variables surrounded by pipe (|) 2.times do |i| puts "hello #{i}" end >> "hello 0" >> "hello 1"@SchneemsFriday, June 10, 2011
  • Rails why or why-not? • Speed • developer vs computer • Opinionated framework • Quick moving ecosystem@SchneemsFriday, June 10, 2011
  • Rails Architecture • Terminology • DRY • Convention over Configuration • Rails Architecture • MVC (Model View Controller) • ORM (Object Relational Mapping) • RESTful (REpresentational State Transfer)@SchneemsFriday, June 10, 2011
  • DRY Don’t Repeat Yourself Reuse, don’t re-invent the...@SchneemsFriday, June 10, 2011
  • Convention over Configuration Decrease the number of decisions needed, gaining simplicity but without losing flexibility.@SchneemsFriday, June 10, 2011
  • Model-View-Controller • Isolates “Domain Logic” • Can I See it? • View • Is it Business Logic? • Controller • Is it a Reusable Class Logic? • Model@SchneemsFriday, June 10, 2011
  • Model-View-Controller • Generated By Rails • Grouped by Folders • Connected “AutoMagically” • Models • Views • Controllers • Multiple Views Per Controller@SchneemsFriday, June 10, 2011
  • Database Backed Models • Store and access massive amounts of data • Table • columns (name, type, modifier) • rows Table: Users@SchneemsFriday, June 10, 2011
  • SQL • Structured Query Language • A way to talk to databases SELECT * FROM Book WHERE price > 100.00 ORDER BY title;@SchneemsFriday, June 10, 2011
  • SQL operations • insert • query • update and delete • schema creation and modification@SchneemsFriday, June 10, 2011
  • Object Relational Mapping • Maps database backend to ruby objects • ActiveRecord (Rail’s Default ORM) >> userVariable = User.where(:name => "Bob") Generates: SELECT "users".* FROM "users" WHERE (name = bob) >> userVariable.name => Bob@SchneemsFriday, June 10, 2011
  • Object Relational Mapping • >> userVariable = User .where(:name => "Bob") models/user.rb class User < ActiveRecord::Base end the User class inherits from ActiveRecord::Base@SchneemsFriday, June 10, 2011
  • Object Relational Mapping • >> userVariable = User. where(:name => "Bob") where is the method that looks in the database AutoMagically in the User Table (if you made one)@SchneemsFriday, June 10, 2011
  • RESTful REpresentational State Transfer • The state of the message matters • Different state = different message “You Again?” “You Again?”@SchneemsFriday, June 10, 2011
  • RESTful REpresentational State Transfer • Servers don’t care about smiles • They do care about how you access them • (HTTP Methods) • GET • PUT • POST • DELETE@SchneemsFriday, June 10, 2011
  • RESTful REpresentational State Transfer • Rails Maps Actions to HTTP Methods • GET - index, show, new • PUT - update • POST - create • DELETE - destroy@SchneemsFriday, June 10, 2011
  • Work Environment • Version Control - Keep your code safe • RubyGems - Use other’s code • Bundler - Manage Dependencies • RVM - Keep your system clean • Tests - make sure it works@SchneemsFriday, June 10, 2011
  • Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb@SchneemsFriday, June 10, 2011
  • Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb@SchneemsFriday, June 10, 2011
  • Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb@SchneemsFriday, June 10, 2011
  • Version Control • Make note of whats different • See changes over time • revert back to known state • work with a team@SchneemsFriday, June 10, 2011
  • Version Control • Git (recommended) • SVN • Mecurial • Perforce • Many More@SchneemsFriday, June 10, 2011
  • Github http://github.com@SchneemsFriday, June 10, 2011
  • RubyGems • Gems • External code “packages” • Rubygems Manages these “packages” gem install keytar irb >> require “rubygems” => true >> require “keytar” => true@SchneemsFriday, June 10, 2011
  • @SchneemsFriday, June 10, 2011
  • Bundler • Install gem install bundler • Gemfiles • specify dependencies source :rubygems gem rails, 3.0.4 gem unicorn, 3.5.0 gem keytar@SchneemsFriday, June 10, 2011
  • Bundler • Install bundle install • installs all gems listed in gemfile • very useful managing across systems@SchneemsFriday, June 10, 2011
  • RVM • Ruby Version Manager • Clean Sandbox for each project rvm use ruby-1.8.7-p302 rvm use ruby-1.9.2-p180@SchneemsFriday, June 10, 2011
  • RVM • Use fresh gemset for each project rvm gemset use gowalla • Switch projects...switch gemsets rvm gemset use keytar@SchneemsFriday, June 10, 2011
  • Testing • Does your code 6 months ago work? • What did it do again? • Manual Versus Programatic • Save Time in the long road by progamatic Testing@SchneemsFriday, June 10, 2011
  • Testing • Test framework built into Rails • Swap in other frame works • Use Continuous Integration (CI) • All tests green • When your(neverapp breaks, write a test for it web again)@SchneemsFriday, June 10, 2011
  • IDE • Mac: Textmate • Windows: Notepad ++ • Eclipse & Aptana RadRails@SchneemsFriday, June 10, 2011
  • Recap • Rails • Framework • Convention over Configuration • Ruby • Expressive Scripting language@SchneemsFriday, June 10, 2011
  • Questions?@SchneemsFriday, June 10, 2011