ruby on rails

24
by amol.pujari puts 'hello ruby on rails' Why should you switch to Ruby? If you are happy with Perl or Python, you don't have to. But if you do feel there must be a better language, Ruby may be your language of choice. Learning a new language is harmless. It gives you new ideas and insights. You don't have to switch, just learn and try it. You may find yourself comfortable enough with Ruby to decide to switch to it. - Matz (Yukihiro Matsumoto), written ruby in 1995

Upload: amol-pujari

Post on 15-May-2015

306 views

Category:

Technology


0 download

DESCRIPTION

My first presentation on what is Ruby on Rails

TRANSCRIPT

Page 1: Ruby on rails

by amol.pujari

puts 'hello ruby on rails'

Why should you switch to Ruby? If you are happy with Perl or Python, you don't have to. But if you do feel there must be a better language, Ruby may be your language of choice. Learning a new language is harmless. It gives you new ideas and insights. You don't have to switch, just learn and try it. You may find yourself comfortable enough with Ruby to decide to switch to it.

- Matz (Yukihiro Matsumoto), written ruby in 1995

Page 2: Ruby on rails

Agenda.items.each {|item| puts item}

RoR - Market Trend

Know ruby

Principles Features

Ruby on rails

Principles Building blocks Caching Security Community Support

Page 3: Ruby on rails

Market Trend - Need for Ruby on Rails

Less “Time To Market”

Quick to build & deploy

Its free

Rapid application development

Handle traffic – when needed

Huge free libraries with strong community support

Page 4: Ruby on rails

Who is using Ruby on Rails

Page 5: Ruby on rails

Ruby on Rails – Todays world

Visits/sec

twitter 642

scribd 940

blingee 1170

yellowpages 1734

penny-arcade 2069

43things 4190

kongregate 4488

potchforkmedia 4740

projectpath 5041

funnyordie 5089

1621

232

1041

327

78

158

Around 4000 companies have RubyOnRails adopted in last 4 years

Page 6: Ruby on rails

So what is Ruby..?

Page 7: Ruby on rails

Ruby

A scripting language

Purely Object Oriented

Extreme dynamic

Easy to learn, simple

Influenced by Python, Perl and Lisp

Open source and free

Cross Platform

Page 8: Ruby on rails

Ruby - Programming is fun, enjoy it

You don't want to fight with the language, feel natural

Be creative

Page 9: Ruby on rails

Ruby - concise and succinct

Concentrate on the problems

Its like pseudo-code, simple

Focus on human factor

Page 10: Ruby on rails

Ruby - extreme dynamic

eval, meta-programming, reflection, Open Classes

Page 11: Ruby on rails

Ruby - features

Dynamic yet strong typing

Regular expressions, symbols, mutable strings

Blocks, Iterators, generators

Collections, arrays, hashes

Interpolation, default arguments

Operator overloading

exception handling

Native threads

Custom dispatch behavior (method_missing)

Garbage collection

Page 12: Ruby on rails

often my code requires no comments - amol.pujari

if you want to try out all these examples given then download ruby from http://www.ruby-lang.org/en/downloads/ open console, type irb, and enter have fun …end# so simple

Page 13: Ruby on rails

ruby on rails

extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by 37signals

Page 14: Ruby on rails

Ruby on Rails: Rapid application development

Web application framework

Free

Very less code

Fast development & client appreciation

Quick incremental development model

Multiple Databases support

Testing support

Continues Integration support

Deployment support

Cloud ready solution

Page 15: Ruby on rails

Ruby on Rails: Principles - CoC

Conventions Over Configurations Database table name: books { id(pk), created_at, updated_at }:unicode

Database migration: app/db/migrate/<ts>_create_books.rb

Model: class Book => app/models/book.rb

Views: app/views/books/

Controller: class BooksController => app/controllers/books_controller.rb

Unit tests: app/test/unit/book_test.rb

Fixtures: app/test/fixtures/books.yml

Functional tests: test/functional/books_controller_test.rb

Routes: resources :books =>

Page 16: Ruby on rails

Ruby on Rails: Principles - DRY

Don't Repeat Yourself

Page 17: Ruby on rails

Rails: building blocks

ORM: Active Record

Action Pack

Action Dispatch Action Controller Action View

Active Support

Active Model, Active Resource, Action Mailer

Railties

Page 18: Ruby on rails

Rails: Active Record

CRUD support

Model level validations

Callbacks

migrations

Associations

Query interface

Page 19: Ruby on rails

Rails: Active Record: Association

Page 20: Ruby on rails

Rails: Active Record: Association

Page 21: Ruby on rails

Rails: inbuilt caching

SQL Caching

caches_page :index

caches_action :index

Fragment caching => <% cache do %> ...<% end %>

ActiveSupport::Cache::Store

config.cache_store = :memory_store

# :FileStore, :mem_cache_store, :redis,

Page 22: Ruby on rails

Rails: Security

Session Hijacking

Stealing a user’s session_id Use database store and SSL

Session Fixation

Attacker fixes a session id known to her Issue a new session identifier (reset_session in RAILS)

Cross-Site Request Forgery (CSRF)

Rails includes a security token in non-GET requests SQL Injection

Unauthorized reading/writing Model.first(:conditions => ["login = ? AND password = ?",

entered_user_name, entered_password]) attr_protected :is_admin

HTML/JavaScript Injection

h @book.description # => 'alert('script inside');'

Page 23: Ruby on rails

Ruby on Rails – wider support Databases

Ibm db2

Oracle

MsSql

Mysql

Postgres

Sqlite

Mongodb

Cassandra

BerkleyDB

UI

HTML 5

Flash

Flex

Scripts

Ajax

Jquery

Prototype

Css 3

Coffeescript

Performance

J-meter

Yslow, Firebug

Five-runs

New-relic

Http-perf

Memcache, redis

Apache benchmark

Standards

XML/REST

MVC/ORM

Deployment

Apache

NGINX

Mongrel

Glassfish

phusion-passanger

WebSphere

Rack

metal

Development

Neatbeans

Apatana

Eclipse

Radrails

Project Management

Redmine

Trac

Basecamp

Spring loop

Assembla

Repositories

Svn, cvs

Github

Mercurial

Visual Source Safe

Continues Integration

Capistrano

Cruise Control

moonshine

Security

Md5, Kerberos

Sha1, Sha2

Platforms

All flavors of linux

Windows, MS DOS, Mac

CMS

Wordpress, Mephisto

Comatoes, Radiant

spree

Testing

Cuccumber, Rspec

Factory-girl, selenium

Flavors

Jruby

Iron ruby

Rubinies

Ruby shoes

Sinatara

Merb

Page 24: Ruby on rails

Thanks. :)

any queries?