Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ruby on Rails: a brief introduction


Published on

Introduction to Ruby on Rails for the Linguaggi e Ambienti Multimediali course at Politecnico di Torino, academic year 2011/2012

Published in: Education, Technology

Ruby on Rails: a brief introduction

  1. 1. Ruby on Rails: a brief introductionLuigi De RussisDipartimento di Automatica e InformaticaPolitecnico di
  2. 2. What is Ruby on Rails? A web framework ◦ created in 2003 ◦ open-source ◦ for the Ruby programming language ◦ based on  the MVC (Model-View-Controller) pattern  the CoC (Convention over Configuration) principle  the DRY (Don’t Repeat Yourself) principle Website: 2
  3. 3. Ruby on Rails Provides many tools to quickly develop common feature, such as: ◦ interfacing to DBMS systems ◦ data management and validation ◦ creation of user interfaces ◦ creation of pages according to the MVC pattern ◦ etc. Built-in support for Ajax 3
  4. 4. Is Ruby on Rails used in “real-world” application? Yes, for example by… ◦ Twitter ◦ Yellow Pages ◦ Github ◦ Hulu ◦ Groupon ◦ Ruby website ◦ SUSE studio ◦ Urban Dictionary ◦ … 4
  5. 5. What is Ruby? A programming language ◦ released in Japan in 1995 ◦ inspired by other programming language  Perl, Smalltalk, Eiffel, Ada, and Lisp ◦ open-source ◦ interpreted ◦ object-oriented Website: 5
  6. 6. Ruby vs. Java (I) Like Java, in Ruby: ◦ memory is managed for you via a garbage collector ◦ objects are strongly typed ◦ there are public, private, and protected methods ◦ there are embedded doc tools (RDoc) Linguaggi e Ambienti Multimediali A 6
  7. 7. Ruby vs. Java (II) Unlike Java, in Ruby: ◦ you use the end keyword after defining things like classes, instead of having to put braces around blocks of code ◦ require instead of import ◦ all member variables are private ◦ nil instead of null ◦ there is no casting ◦ everything is an object 7
  8. 8. About variables and methods… Variables and constants ◦ variables start with lowercase letters ◦ constants start with uppercase letters ◦ typically “_” is used among terms No static type checking Methods ◦ must start with lowercase letters ◦ are defined by the keyword def… end ◦ return statement is optional  they implicit return the last evaluated expression 8
  9. 9. Let’s try! 9
  10. 10. Some resources… tutorial-book 10