SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado

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
 

Destacado (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 a 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
 
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
 
Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Jeff 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 a 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)
 
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
 
Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2Twitter streamingapi rubymongodbv2
Twitter streamingapi rubymongodbv2
 
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?
 

Más de 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
 

Más de 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
 

Último

How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 

Último (20)

How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.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

Notas del editor

  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