0% found this document useful (0 votes)
2K views

Intro Session On Ruby MVC RoR

This document introduces the Ruby on Rails web application framework. It discusses that Ruby on Rails follows the model-view-controller (MVC) pattern, with ActiveRecord for the model, ActionView for views, and ActionController for controllers. The document provides an overview of the benefits of MVC and how Rails implements MVC, separation of concerns, and conventions over configuration. It also briefly mentions features like generators, migrations, and plugins.

Uploaded by

Sumanth Krishna
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Intro Session On Ruby MVC RoR

This document introduces the Ruby on Rails web application framework. It discusses that Ruby on Rails follows the model-view-controller (MVC) pattern, with ActiveRecord for the model, ActionView for views, and ActionController for controllers. The document provides an overview of the benefits of MVC and how Rails implements MVC, separation of concerns, and conventions over configuration. It also briefly mentions features like generators, migrations, and plugins.

Uploaded by

Sumanth Krishna
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Introducing

Ruby
MVC Framework
Ruby on Rails
TAG Cloud

Java Ruby PHP Object oriented ActiveRecord

python Ruby on Rails Rails J2EE Hibernate

Framework MVC RadRails Aptana NetBeans

Struts IDE Architecture ActionPack gems


Webserver Testing plugins OpenSource Helpers
 webrick Methods
Do we need???

Another Language...
Another Framework...
A new design pattern...
Wide range of new tools...
...
...
...
So let's dive in...
Ruby is...
 An interpreted language
 - a.k.a dynamic, scripting

- e.g., perl

Modules allow addition of behaviors to a class
 Object Oriented
 Single inheritance
 High level

- Good support for system calls, regex and CGI
 Relies heavily on convention for syntax
Ruby is...
 All classes derived from Object including Class (like Java) but
there are no primitives (not like Java at all)

Ruby uses single-inheritance

Mixins give you the power of multiple inheritance
without the headaches

Modules allow addition of behaviors to a class

Things like ‘=‘ and ‘+’ that you might think are operators are
actually methods (like Smalltalk)

Variables are not typed

Automatic memory allocation and garbage collection
Traditional Applications

Browser directly accesses page.


- Do not offer centralized control
 - No separation of content/style
- Difficult to maintain
MVC Applications
Browser accesses a “controller”
- Centralizes control
- Clean separation of content/style
- More involved to produce
- Easier to maintain and expand
MVC

MVC is an Architectural Design Pattern


Separates a web application into three different
modules.
Model | View | Controller
MVC Advantages
Separation of interests.
Model centralizes business logic.
View centralizes display logic.
Controller centralizes application flow.
Clean separation of content/style.
Improved decoupling.
Easier testing.
Allow multiple people to work on different parts.
RAILS & MVC

Rails in an MVC framework


”…Rails is such a framework that tries to remove the
complexity and drudgery of MVC, while still
allowing you to realize all the benefits.” - DHH
(David Heinemeier Hansson)
Model - ActiveRecord

ActiveRecord is a design pattern. (Martin Fowler)


Object wraps a row in the database.
Encapsulates data access.
Contains business logic.
Handles relationships.
Handles validation.
View - ActionView

Renders the view.


Both .rhtml and .rxml files.
Provides master layouts.
Uses ERb (embedded ruby) for templating and
control.
Controller – ActionController

Controls application flow.


Controls which view to use.
Makes data available as instance variables @var
Contains several actions/defs
Controls rendering and redirection.
What it looks like?
Walk through...
Folder Structure
RAILS in 10 points

Don’t Repeat Yourself

Convention Over Configuration

Model View Controller

Agile Development

Configuring DB

ActiveRecord (Built-in ORM support)

CRUD – operations

Generators

Migrations

Plugins
Worth diving. Isn't it?
Who's using...
Applications...
References...

http://wiki.rubyonrails.org
http://rubyonrails.org
http://www.workingwithrails.com
http://www.37signals.com
...
...
Thanks!
Sumanth Krishna. A
www.sumanthkrishna.com
[email protected]

You might also like