SlideShare a Scribd company logo
Ruby on Rails A Basic Introduction for  Non-programmers Mason Chang [email_address]
What is it?
+
Before we start! Let’s talk about…
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
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
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
Ruby
Ruby 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/
Rails
Rails 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/
Full Stack Built-in app server Model => ActiveRecord Controller => ActionController View => ActionView Mailer => ActionMailer Database adapters Test cases and fixtures support
Model-View-Controller
Convention 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
Don’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

More Related Content

Ruby on rails intro

  • 1. Ruby on Rails A Basic Introduction for Non-programmers Mason Chang [email_address]
  • 3. +
  • 4. Before we start! Let’s talk about…
  • 5. 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
  • 6. 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
  • 7. 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
  • 9. Ruby 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/
  • 10. Rails
  • 11. Rails 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/
  • 12. Full Stack Built-in app server Model => ActiveRecord Controller => ActionController View => ActionView Mailer => ActionMailer Database adapters Test cases and fixtures support
  • 14. Convention 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
  • 15. Don’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