Download ppt - Ruby on Rails Tutorial

Transcript
Page 1: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Peter Mosca

April, 2007

Page 2: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Ruby History

Invented 12 years ago in Japan by Yukihiro Matsumoto

Spent first 5 years in Japan Experienced tremendous growth in

international community since 2000

Page 3: Ruby on Rails Tutorial

Ruby on Rails Tutorial

What is Ruby?

Ruby is a dynamically typed OO scripting language similar to Perl and Python

Simple syntax– Principal of Least Surprise (POL)

Advanced language features Scales better than most languages Well-established and robust

Page 4: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Ruby on Rails History

Developed by David Heinemeier Hansson in 2004

Extracted from the Basecamp project

Page 5: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Ruby on Rails

“Ruby on Rails is a framework that makes it easier to develop, deploy, and maintain web applications”– Dave Thomas, author of The Pragmatic

Programmer

Page 6: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Ruby on Rails

Rails is framework, written in Ruby, for developing database-backed web applications

Open Source “Full-Stack” framework

Page 7: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Opinionated Software

Trade flexibility at the infrastructure level to gain flexibility at the application level

Designed for the 98% solution, not the 99.9% Push best practices at no extra cost Quick, but not dirty

Page 8: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Rails is Opinionated

Convention over Configuration DRY principal Generate boilerplate code

– Get it working quickly, then evolve it Rails makes “best practices” assumptions

– MVC pattern, Unit tests, 3 databases

Page 9: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Rails is Opinionated

MVC: Model View Controller pattern– Decouples the domain, presentation, and

workflow 3 Separate Databases

– Development– Test– Production

Page 10: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Active Record

“Database Wrapping” instead of “Database Mapping”

Each active record object represents a row in a table

Each record object has CRUD methods for database access

Page 11: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Active Record

Adds attributes automatically, based on the columns in the database

Adds relational management through a custom internal language

Naming convention allow database to discover specific fields

Schema migration “baked in” Rails

Page 12: Ruby on Rails Tutorial

Ruby on Rails Tutorial

What’s Driving Rails Use?

Rails is fun Rails is powerful Rails development is fast!

Page 13: Ruby on Rails Tutorial

Ruby on Rails Tutorial

Rails vs J2EE