ruby on rails intro

15
Ruby on Ruby on Rails Rails A Basic Introduction for Non-programmers Mason Chang [email protected]

Upload: ming-hsuan-chang

Post on 15-May-2015

782 views

Category:

Technology


0 download

DESCRIPTION

An introduction of Ruby on Rails for non-programmers.

TRANSCRIPT

Page 1: Ruby on rails intro

Ruby on RailsRuby on RailsA Basic Introduction for

Non-programmers

Mason [email protected]

Page 2: Ruby on rails intro

What is it?What is it?

Page 3: Ruby on rails intro

++

Page 4: Ruby on rails intro

Before we start!Before we start!Let’s talk about…

Page 5: Ruby on rails intro

What is Programming?What is Programming?

• Make the computer work for you in a systematic way based on pre-defined rules

• The more trivial routines you have, the more powerful the computer can be

• Depending on the level of abstraction, there are high-level and low-level programming languages

• No matter what language you use, there are commonly 5 types of statements

Page 6: Ruby on rails intro

They are..They are..• Calculations

=> arithmetic or logical operations• Assignments

=> set a name to memorize something• Conditionals

=> if, unless and cases• Iterations

=> do, while, and until loops• Controls

=> sending hardware signals

Page 7: Ruby on rails intro

What is Web?What is Web?

• A client-server computing model, of which data transmission is based on the request-response protocol (HTTP)

• The packets are sent in text without encryption• Stateless nature, connection open and close in every

request-response cycle• No request, no response

Page 8: Ruby on rails intro

RubyRuby

Page 9: Ruby on rails intro

Ruby LanguageRuby Language

• Created by Yukihiro Matsumoto(aka. Matz) in 1993• Flexible syntax, make programmers happy• Dynamic typing, everything is an object• Support both OOP and FP styles• Powerful meta-programming capabilities• Good for constructing DSL• Encourage software test• Site: http://www.ruby-lang.org/

Page 10: Ruby on rails intro

RailsRails

Page 11: Ruby on rails intro

Rails FrameworkRails Framework• Created by David H. Hansson(aka. DHH) in 2004• Full stack framework• MVC design patterns• Support RESTful architecture• Convention Over Configuration• Don’t Repeat Yourself• Encourage Agile methodology• Site: http://rubyonrails.org/

Page 12: Ruby on rails intro

Full StackFull Stack

• Built-in app server• Model => ActiveRecord• Controller => ActionController• View => ActionView• Mailer => ActionMailer• Database adapters• Test cases and fixtures support

Page 13: Ruby on rails intro

Model-View-ControllerModel-View-Controller

Page 14: Ruby on rails intro

Convention Over ConfigurationConvention Over Configuration

• Project files layout => all your code goes in app/ => configuration files in config/ => database migrations in db/ => other libraries in lib/ => static resource files in public/ => app test files in test/

• Naming conventions => table name map to model name => column name map to model attribute name => controller action map to view template

Page 15: Ruby on rails intro

Don’t Repeat YourselfDon’t Repeat Yourself

• Code generators => generate project => generate model with db migration => generate controller with views

• Handy helper methods => JavaScript helpers => Form helpers

• Sensible core extensions• Rake automation tasks• Use plug-ins and gems