SlideShare a Scribd company logo
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 3
Richard 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 2
Richard Schneeman
 
Minicurso JSON & Ajax
Minicurso JSON & AjaxMinicurso JSON & Ajax
Minicurso JSON & Ajax
Wilker Iceri
 
Ruby on Rails for beginners
Ruby on Rails for beginnersRuby on Rails for beginners
Ruby on Rails for beginners
Vysakh Sreenivasan
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
adamcookeuk
 

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 SBonRails
Chris 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/2011
Marcello 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 MongoDB
Jeff 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
 
Iwmn architecture
Iwmn architectureIwmn architecture
Iwmn architecture
Lenz Gschwendtner
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
Brendan 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_many
Blazing Cloud
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
Reuven Lerner
 
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 Design
DATAVERSITY
 
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 & NoSQL
Richard 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 8
Richard Schneeman
 
Potential Friend Finder
Potential Friend FinderPotential Friend Finder
Potential Friend Finder
Richard Schneeman
 
UT on Rails3 2010- Week 4
UT on Rails3 2010- Week 4 UT on Rails3 2010- Week 4
UT on Rails3 2010- Week 4
Richard Schneeman
 
UT on Rails3 2010- Week 2
UT on Rails3 2010- Week 2UT on Rails3 2010- Week 2
UT on Rails3 2010- Week 2
Richard Schneeman
 
UT on Rails3 2010- Week 1
UT on Rails3 2010- Week 1UT on Rails3 2010- Week 1
UT on Rails3 2010- Week 1
Richard 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

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

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