SlideShare a Scribd company logo
1 of 53
Download to read offline
Beginner To Builder
                        Week 1
                        Richard Schneeman
                        @schneems




June, 2011
Friday, June 10, 2011
Background

                        • Georgia Tech
                        • 5 Years of Rails
                        • Rails dev for Gowalla


@Schneems
Friday, June 10, 2011
About the Class
                        • Why?
                        • Structure
                          • Class & Course Work
                          • Ruby through Rails
                        • 8 Weeks
                          • 1 hour

@Schneems
Friday, June 10, 2011
Rails - Week 1
                        • Ruby
                          • Versus Rails
                          • Data Types
                        • Rails Architecture
                          • MVC (Model View Controller)
                          • ORM (Object Relational Mapping)
                          • RESTful (REpresentational STate)
@Schneems
Friday, 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

@Schneems
Friday, 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




@Schneems
Friday, 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




@Schneems
Friday, June 10, 2011
Technologies
                        • Html - creates a view
                        • Javascript - makes it interactive
                        • css - makes it pretty
                        • Ruby - Makes it a web app



@Schneems
Friday, June 10, 2011
@Schneems
Friday, June 10, 2011
Ruby Resources
            • why’s (poignant) guide to ruby
              • Free, quirky

               • Programming Ruby (Pickaxe)
                 • Not free, encyclopedic

@Schneems
Friday, June 10, 2011
Ruby Resources
             • Metaprogramming Ruby
               • Skips basics
               • Unleash the power of Ruby




@Schneems
Friday, June 10, 2011
Interactive Ruby Console
                   (IRB) or http://TryRuby.org/




@Schneems
Friday, June 10, 2011
Ruby Strings
                   • Characters (letters, digits, punctuation)
                        surrounded by quotes

                         food = "chunky bacon"
                         puts "I'm hungry for, #{food}!"
                         >> "I'm hungry for, chunky bacon!"


                         "I'm hungry for, chunky bacon!".class
                         >> String



@Schneems
Friday, June 10, 2011
Ruby (numbers)

                        123.class
                        >> Fixnum




                        (123.0).class
                        >> Float




@Schneems
Friday, 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




@Schneems
Friday, 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


@Schneems
Friday, 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



@Schneems
Friday, June 10, 2011
Ruby Array
                   •Zero Indexed
                        array = [ 1, 2, 3, 4 ]
                        array[0]
                        >> 1

                        array = [ 1, 2, 3, 4 ]
                        array[1]
                        >> 2



@Schneems
Friday, 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"
@Schneems
Friday, June 10, 2011
Ruby Blocks
                   •Can take arguments
                    • variables surrounded by pipe (|)
                        2.times do |i|
                          puts "hello #{i}"
                        end
                        >> "hello 0"
                        >> "hello 1"




@Schneems
Friday, June 10, 2011
Rails why or why-not?
                        • Speed
                          • developer vs computer
                        • Opinionated framework
                        • Quick moving ecosystem



@Schneems
Friday, June 10, 2011
Rails Architecture
                        • Terminology
                          • DRY
                          • Convention over Configuration
                        • Rails Architecture
                          • MVC (Model View Controller)
                          • ORM (Object Relational Mapping)
                          • RESTful (REpresentational State
                            Transfer)
@Schneems
Friday, June 10, 2011
DRY
                           Don’t Repeat Yourself




                         Reuse, don’t re-invent the...



@Schneems
Friday, June 10, 2011
Convention over
                 Configuration



                       Decrease the number of decisions needed,
                   gaining simplicity but without losing flexibility.

@Schneems
Friday, 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
@Schneems
Friday, June 10, 2011
Model-View-Controller
        • Generated By Rails
          • Grouped by Folders
          • Connected “AutoMagically”
            • Models
            • Views
            • Controllers
          • Multiple Views Per Controller
@Schneems
Friday, June 10, 2011
Database Backed Models
        • Store and access massive amounts of
          data
        • Table
          • columns (name, type, modifier)
          • rows
                        Table: Users




@Schneems
Friday, June 10, 2011
SQL
                        • Structured Query Language
                         • A way to talk to databases
                         SELECT *
                             FROM Book
                             WHERE price > 100.00
                             ORDER BY title;




@Schneems
Friday, June 10, 2011
SQL operations
                        • insert
                        • query
                        • update and delete
                        • schema creation and modification



@Schneems
Friday, 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



@Schneems
Friday, 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




@Schneems
Friday, 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)




@Schneems
Friday, June 10, 2011
RESTful
                              REpresentational State Transfer
                    •   The state of the message matters
                        •   Different state = different message




                        “You Again?”               “You Again?”
@Schneems
Friday, 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



@Schneems
Friday, June 10, 2011
RESTful
                               REpresentational State Transfer
               •        Rails Maps Actions to HTTP Methods
                        •   GET - index, show, new
                        •   PUT - update
                        •   POST - create
                        •   DELETE - destroy




@Schneems
Friday, 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


@Schneems
Friday, June 10, 2011
Version Control
                        • my_last_update_1.rb
                        • my_realy_last_update_2.rb
                        • really_the_good_code_last_final_new.rb




@Schneems
Friday, June 10, 2011
Version Control
                        • my_last_update_1.rb
                        • my_realy_last_update_2.rb
                        • really_the_good_code_last_final_new.rb




@Schneems
Friday, June 10, 2011
Version Control
                        • my_last_update_1.rb
                        • my_realy_last_update_2.rb
                        • really_the_good_code_last_final_new.rb




@Schneems
Friday, June 10, 2011
Version Control
                        • Make note of whats different
                        • See changes over time
                        • revert back to known state
                        • work with a team



@Schneems
Friday, June 10, 2011
Version Control
                        • Git (recommended)
                        • SVN
                        • Mecurial
                        • Perforce
                        • Many More


@Schneems
Friday, June 10, 2011
Github




                        http://github.com

@Schneems
Friday, June 10, 2011
RubyGems	
                        • Gems
                         • External code “packages”
                        • Rubygems Manages these “packages”
                         gem install keytar
                         irb
                         >> require “rubygems”
                         => true
                         >> require “keytar”
                         => true
@Schneems
Friday, June 10, 2011
@Schneems
Friday, 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'


@Schneems
Friday, June 10, 2011
Bundler
                        • Install
                          bundle install

                        • installs all gems listed in gemfile
                        • very useful managing across systems



@Schneems
Friday, 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




@Schneems
Friday, June 10, 2011
RVM
                        • Use fresh gemset for each project
                        rvm gemset use gowalla


                        • Switch projects...switch gemsets
                        rvm gemset use keytar




@Schneems
Friday, 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




@Schneems
Friday, 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)



@Schneems
Friday, June 10, 2011
IDE
                        • Mac: Textmate
                        • Windows: Notepad ++
                        • Eclipse & Aptana RadRails




@Schneems
Friday, June 10, 2011
Recap
               •        Rails
                        •   Framework
                        •   Convention over Configuration
               •        Ruby
                        •   Expressive Scripting language




@Schneems
Friday, June 10, 2011
Questions?



@Schneems
Friday, June 10, 2011

More Related Content

Viewers also liked

AJAX?? Não!! Asynchronous Javascript and... JSON!!
AJAX?? Não!! Asynchronous Javascript and... JSON!!AJAX?? Não!! Asynchronous Javascript and... JSON!!
AJAX?? Não!! Asynchronous Javascript and... JSON!!Lucas Brasilino
 
Rails 3 Beginner to Builder 2011 Week 3
Rails 3 Beginner to Builder 2011 Week 3Rails 3 Beginner to Builder 2011 Week 3
Rails 3 Beginner to Builder 2011 Week 3Richard Schneeman
 
Rails 3 Beginner to Builder 2011 Week 2
Rails 3 Beginner to Builder 2011 Week 2Rails 3 Beginner to Builder 2011 Week 2
Rails 3 Beginner to Builder 2011 Week 2Richard Schneeman
 
Minicurso JSON & Ajax
Minicurso JSON & AjaxMinicurso JSON & Ajax
Minicurso JSON & AjaxWilker Iceri
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentationadamcookeuk
 

Viewers also liked (6)

AJAX?? Não!! Asynchronous Javascript and... JSON!!
AJAX?? Não!! Asynchronous Javascript and... JSON!!AJAX?? Não!! Asynchronous Javascript and... JSON!!
AJAX?? Não!! Asynchronous Javascript and... JSON!!
 
Rails 3 Beginner to Builder 2011 Week 3
Rails 3 Beginner to Builder 2011 Week 3Rails 3 Beginner to Builder 2011 Week 3
Rails 3 Beginner to Builder 2011 Week 3
 
Rails 3 Beginner to Builder 2011 Week 2
Rails 3 Beginner to Builder 2011 Week 2Rails 3 Beginner to Builder 2011 Week 2
Rails 3 Beginner to Builder 2011 Week 2
 
Minicurso JSON & Ajax
Minicurso JSON & AjaxMinicurso JSON & Ajax
Minicurso JSON & Ajax
 
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 

Similar to Rails 3 Beginner to Builder 2011 Week 1

2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web Profile2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web ProfileDavid Blevins
 
AppScale Talk at SBonRails
AppScale Talk at SBonRailsAppScale Talk at SBonRails
AppScale Talk at SBonRailsChris Bunch
 
Are Your Tests Really Helping You?
Are Your Tests Really Helping You?Are Your Tests Really Helping You?
Are Your Tests Really Helping You?LB Denker
 
RVM and Ruby Interpreters @ RSC Roma 03/2011
RVM and Ruby Interpreters @ RSC Roma 03/2011RVM and Ruby Interpreters @ RSC Roma 03/2011
RVM and Ruby Interpreters @ RSC Roma 03/2011Marcello Barnaba
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Leonardo Borges
 
Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Jeff Linwood
 
Consuming the Twitter Streaming API with Ruby and MongoDB
Consuming the Twitter Streaming API with Ruby and MongoDBConsuming the Twitter Streaming API with Ruby and MongoDB
Consuming the Twitter Streaming API with Ruby and MongoDBJeff Linwood
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayWesley Hales
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyBrendan Lim
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyBlazing Cloud
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?DATAVERSITY
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignDATAVERSITY
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011tobiascrawley
 
Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureDmitry Buzdin
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?DATAVERSITY
 

Similar to Rails 3 Beginner to Builder 2011 Week 1 (20)

2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web Profile2011 JavaOne Apache TomEE Java EE 6 Web Profile
2011 JavaOne Apache TomEE Java EE 6 Web Profile
 
AppScale Talk at SBonRails
AppScale Talk at SBonRailsAppScale Talk at SBonRails
AppScale Talk at SBonRails
 
Are Your Tests Really Helping You?
Are Your Tests Really Helping You?Are Your Tests Really Helping You?
Are Your Tests Really Helping You?
 
Selenium
SeleniumSelenium
Selenium
 
RVM and Ruby Interpreters @ RSC Roma 03/2011
RVM and Ruby Interpreters @ RSC Roma 03/2011RVM and Ruby Interpreters @ RSC Roma 03/2011
RVM and Ruby Interpreters @ RSC Roma 03/2011
 
Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011) Clouds against the Floods (RubyConfBR2011)
Clouds against the Floods (RubyConfBR2011)
 
Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2
 
Consuming the Twitter Streaming API with Ruby and MongoDB
Consuming the Twitter Streaming API with Ruby and MongoDBConsuming the Twitter Streaming API with Ruby and MongoDB
Consuming the Twitter Streaming API with Ruby and MongoDB
 
JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
 
Iwmn architecture
Iwmn architectureIwmn architecture
Iwmn architecture
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
 
Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
A Case Study of NoSQL Adoption: What Drove Wordnik Non-Relational?
 
Agile xml
Agile xmlAgile xml
Agile xml
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema Design
 
UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011UCLUG TorqueBox - 03/08/2011
UCLUG TorqueBox - 03/08/2011
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru Architecture
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?
 

More from Richard Schneeman

Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLRichard Schneeman
 
Rails 3 Beginner to Builder 2011 Week 8
Rails 3 Beginner to Builder 2011 Week 8Rails 3 Beginner to Builder 2011 Week 8
Rails 3 Beginner to Builder 2011 Week 8Richard Schneeman
 

More from Richard Schneeman (6)

Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQL
 
Rails 3 Beginner to Builder 2011 Week 8
Rails 3 Beginner to Builder 2011 Week 8Rails 3 Beginner to Builder 2011 Week 8
Rails 3 Beginner to Builder 2011 Week 8
 
Potential Friend Finder
Potential Friend FinderPotential Friend Finder
Potential Friend Finder
 
UT on Rails3 2010- Week 4
UT on Rails3 2010- Week 4 UT on Rails3 2010- Week 4
UT on Rails3 2010- Week 4
 
UT on Rails3 2010- Week 2
UT on Rails3 2010- Week 2UT on Rails3 2010- Week 2
UT on Rails3 2010- Week 2
 
UT on Rails3 2010- Week 1
UT on Rails3 2010- Week 1UT on Rails3 2010- Week 1
UT on Rails3 2010- Week 1
 

Recently uploaded

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Rails 3 Beginner to Builder 2011 Week 1

  • 1. Beginner To Builder Week 1 Richard Schneeman @schneems June, 2011 Friday, June 10, 2011
  • 2. Background • Georgia Tech • 5 Years of Rails • Rails dev for Gowalla @Schneems Friday, June 10, 2011
  • 3. About the Class • Why? • Structure • Class & Course Work • Ruby through Rails • 8 Weeks • 1 hour @Schneems Friday, June 10, 2011
  • 4. Rails - Week 1 • Ruby • Versus Rails • Data Types • Rails Architecture • MVC (Model View Controller) • ORM (Object Relational Mapping) • RESTful (REpresentational STate) @Schneems Friday, June 10, 2011
  • 5. 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 @Schneems Friday, June 10, 2011
  • 6. 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 @Schneems Friday, June 10, 2011
  • 7. Rails is a Web Framework • Develop, deploy, and maintain dynamic web apps • Written using Ruby • Extremely flexible, expressive, and quick development time @Schneems Friday, June 10, 2011
  • 8. Technologies • Html - creates a view • Javascript - makes it interactive • css - makes it pretty • Ruby - Makes it a web app @Schneems Friday, June 10, 2011
  • 10. Ruby Resources • why’s (poignant) guide to ruby • Free, quirky • Programming Ruby (Pickaxe) • Not free, encyclopedic @Schneems Friday, June 10, 2011
  • 11. Ruby Resources • Metaprogramming Ruby • Skips basics • Unleash the power of Ruby @Schneems Friday, June 10, 2011
  • 12. Interactive Ruby Console (IRB) or http://TryRuby.org/ @Schneems Friday, June 10, 2011
  • 13. Ruby Strings • Characters (letters, digits, punctuation) surrounded by quotes food = "chunky bacon" puts "I'm hungry for, #{food}!" >> "I'm hungry for, chunky bacon!" "I'm hungry for, chunky bacon!".class >> String @Schneems Friday, June 10, 2011
  • 14. Ruby (numbers) 123.class >> Fixnum (123.0).class >> Float @Schneems Friday, June 10, 2011
  • 15. Ruby Symbols •Symbols are lightweight strings • start with a colon • immutable :a, :b or :why_the_lucky_stiff :why_the_lucky_stiff.class >> Symbol @Schneems Friday, June 10, 2011
  • 16. 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 @Schneems Friday, June 10, 2011
  • 17. 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 @Schneems Friday, June 10, 2011
  • 18. Ruby Array •Zero Indexed array = [ 1, 2, 3, 4 ] array[0] >> 1 array = [ 1, 2, 3, 4 ] array[1] >> 2 @Schneems Friday, June 10, 2011
  • 19. 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" @Schneems Friday, June 10, 2011
  • 20. Ruby Blocks •Can take arguments • variables surrounded by pipe (|) 2.times do |i| puts "hello #{i}" end >> "hello 0" >> "hello 1" @Schneems Friday, June 10, 2011
  • 21. Rails why or why-not? • Speed • developer vs computer • Opinionated framework • Quick moving ecosystem @Schneems Friday, June 10, 2011
  • 22. Rails Architecture • Terminology • DRY • Convention over Configuration • Rails Architecture • MVC (Model View Controller) • ORM (Object Relational Mapping) • RESTful (REpresentational State Transfer) @Schneems Friday, June 10, 2011
  • 23. DRY Don’t Repeat Yourself Reuse, don’t re-invent the... @Schneems Friday, June 10, 2011
  • 24. Convention over Configuration Decrease the number of decisions needed, gaining simplicity but without losing flexibility. @Schneems Friday, June 10, 2011
  • 25. Model-View-Controller • Isolates “Domain Logic” • Can I See it? • View • Is it Business Logic? • Controller • Is it a Reusable Class Logic? • Model @Schneems Friday, June 10, 2011
  • 26. Model-View-Controller • Generated By Rails • Grouped by Folders • Connected “AutoMagically” • Models • Views • Controllers • Multiple Views Per Controller @Schneems Friday, June 10, 2011
  • 27. Database Backed Models • Store and access massive amounts of data • Table • columns (name, type, modifier) • rows Table: Users @Schneems Friday, June 10, 2011
  • 28. SQL • Structured Query Language • A way to talk to databases SELECT * FROM Book WHERE price > 100.00 ORDER BY title; @Schneems Friday, June 10, 2011
  • 29. SQL operations • insert • query • update and delete • schema creation and modification @Schneems Friday, June 10, 2011
  • 30. 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 @Schneems Friday, June 10, 2011
  • 31. Object Relational Mapping • >> userVariable = User .where(:name => "Bob") models/user.rb class User < ActiveRecord::Base end the User class inherits from ActiveRecord::Base @Schneems Friday, June 10, 2011
  • 32. 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) @Schneems Friday, June 10, 2011
  • 33. RESTful REpresentational State Transfer • The state of the message matters • Different state = different message “You Again?” “You Again?” @Schneems Friday, June 10, 2011
  • 34. RESTful REpresentational State Transfer • Servers don’t care about smiles • They do care about how you access them • (HTTP Methods) • GET • PUT • POST • DELETE @Schneems Friday, June 10, 2011
  • 35. RESTful REpresentational State Transfer • Rails Maps Actions to HTTP Methods • GET - index, show, new • PUT - update • POST - create • DELETE - destroy @Schneems Friday, June 10, 2011
  • 36. 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 @Schneems Friday, June 10, 2011
  • 37. Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb @Schneems Friday, June 10, 2011
  • 38. Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb @Schneems Friday, June 10, 2011
  • 39. Version Control • my_last_update_1.rb • my_realy_last_update_2.rb • really_the_good_code_last_final_new.rb @Schneems Friday, June 10, 2011
  • 40. Version Control • Make note of whats different • See changes over time • revert back to known state • work with a team @Schneems Friday, June 10, 2011
  • 41. Version Control • Git (recommended) • SVN • Mecurial • Perforce • Many More @Schneems Friday, June 10, 2011
  • 42. Github http://github.com @Schneems Friday, June 10, 2011
  • 43. RubyGems • Gems • External code “packages” • Rubygems Manages these “packages” gem install keytar irb >> require “rubygems” => true >> require “keytar” => true @Schneems Friday, June 10, 2011
  • 45. Bundler • Install gem install bundler • Gemfiles • specify dependencies source :rubygems gem 'rails', '3.0.4' gem 'unicorn', '3.5.0' gem 'keytar' @Schneems Friday, June 10, 2011
  • 46. Bundler • Install bundle install • installs all gems listed in gemfile • very useful managing across systems @Schneems Friday, June 10, 2011
  • 47. RVM • Ruby Version Manager • Clean Sandbox for each project rvm use ruby-1.8.7-p302 rvm use ruby-1.9.2-p180 @Schneems Friday, June 10, 2011
  • 48. RVM • Use fresh gemset for each project rvm gemset use gowalla • Switch projects...switch gemsets rvm gemset use keytar @Schneems Friday, June 10, 2011
  • 49. 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 @Schneems Friday, June 10, 2011
  • 50. 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) @Schneems Friday, June 10, 2011
  • 51. IDE • Mac: Textmate • Windows: Notepad ++ • Eclipse & Aptana RadRails @Schneems Friday, June 10, 2011
  • 52. Recap • Rails • Framework • Convention over Configuration • Ruby • Expressive Scripting language @Schneems Friday, June 10, 2011

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n