Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language The amazing productivity claims of Rails is



Similar documents
Ruby On Rails. CSCI 5449 Submitted by: Bhaskar Vaish

Evaluation. Chapter 1: An Overview Of Ruby Rails. Copy. 6) Static Pages Within a Rails Application

Ruby on Rails. a high-productivity web application framework. blog.curthibbs.us/ Curt Hibbs <curt@hibbs.com>

Web Development Frameworks

Building and Deploying Web Scale Social Networking Applications Using Ruby on Rails and Oracle. Kuassi Mensah Group Product Manager

Ruby on Rails. Object Oriented Analysis & Design CSCI-5448 University of Colorado, Boulder. -Dheeraj Potlapally

Outline. Lecture 18: Ruby on Rails MVC. Introduction to Rails

Pete Helgren Ruby On Rails on i

1. Was ist das? II. Wie funktioniert das? III. Wo funktioniert das nicht?

An Introduction to the Development of Web Applications using Ruby on Rails with Ajax

Rails Cookbook. Rob Orsini. O'REILLY 8 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

The IBM i on Rails + + Anthony Avison anthony@powerruby.com. Copyright 2014 PowerRuby, Inc.

BEST WEB PROGRAMMING LANGUAGES TO LEARN ON YOUR OWN TIME

Introduction to Ruby on Rails

Agile Web Development with Rails 4

This tutorial has been designed for beginners who would like to use the Ruby framework for developing database-backed web applications.

Web Development Frameworks Ruby on Rails VS Google Web Toolkit

An Introduction to Ruby on Rails

A Tour of Ruby on Rails

Web Frameworks. web development done right. Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.

Integrate Rails into an Existing IIS Web infrastructure using Mongrel

Introduction to Ruby on Rails

10CS73:Web Programming

ActiveRecord and Models. Model Associations. Migrations

Short notes on webpage programming languages

VOIP and Ruby. The Convergence of Web and Voice Applications using Open Source Software. Justin Grammens Localtone Interactive

LDAPCON Sébastien Bahloul

A COMPONENT BASED METHODOLOGY FOR WEB APPLICATION DEVELOPMENT USING RUBY ON RAILS. Presentation 1 13 th July 2009 by Brett Nisbett

Dynamic website development using the Grails Platform. Joshua Davis Senior Architect Cognizant Technology Solutions

Object Oriented Database Management System for Decision Support System.

CS169.1x Lecture 5: SaaS Architecture and Introduction to Rails " Fall 2012"

Using Database Metadata and its Semantics to Generate Automatic and Dynamic Web Entry Forms

Modern Software Development Tools on OpenVMS

The Learn-Verified Full Stack Web Development Program

Ruby On Rails. James Reynolds

Ruby - A Brief History

Ruby on Rails. Mitchell Craig; Tam Nguyen; Becker Luu; Eliezer Mar Manarang; and Colin Williams University of Calgary SENG 403 Dr.

A Framework for Service-Oriented Extensions to Ruby on Rails

Rhomobile cross-platfrom

Course Number: IAC-SOFT-WDAD Web Design and Application Development

Are you sure you want to be here? Me: IBM Software Developer. Rails: The hottest technology.

Rapid Application Development. and Application Generation Tools. Walter Knesel

Software Development Kit

Web Development Frameworks. Matthias Korn

Modern Web Application Framework Python, SQL Alchemy, Jinja2 & Flask

A review and analysis of technologies for developing web applications

Skills for Employment Investment Project (SEIP)

DTWMS Required Software Engineers. 1. Senior Java Programmer (3 Positions) Responsibilities:

Ruby on Rails in GlassFish Sun Microsystems

Introduction to CloudScript

easyobject modern web applications made easy Project presentation

About ZPanel. About the framework. The purpose of this guide. Page 1. Author: Bobby Allen Version: 1.1

THE ROAD TO CODE. ANDROID DEVELOPMENT IMMERSIVE May 31. WEB DEVELOPMENT IMMERSIVE May 31 GENERAL ASSEMBLY

A Comparative Study of Web Development Technologies Using Open Source and Proprietary Software

The NetBeans TM Ruby IDE: You Thought Rails Development Was Fun Before

Mastering Tomcat Development

Using Actian PSQL as a Data Store with VMware vfabric SQLFire. Actian PSQL White Paper May 2013

Building Views and Charts in Requests Introduction to Answers views and charts Creating and editing charts Performing common view tasks

Server-Side Scripting and Web Development. By Susan L. Miertschin

White paper FUJITSU Software Enterprise Postgres

Expansion Through Acquisitions

Rails 4 Quickly. Bala Paranj.

Portals, Portlets & Liferay Platform

Oracle Application Express MS Access on Steroids

Building Web Applications, Servlets, JSP and JDBC

Seamless Web Data Entry for SAS Applications D.J. Penix, Pinnacle Solutions, Indianapolis, IN

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Glassfish, JAVA EE, Servlets, JSP, EJB

Other Language Types CMSC 330: Organization of Programming Languages

Installing Rails 2.3 Under Windows XP and Apache 2.2

Oracle Application Development Framework Overview

by Pearson Education, Inc. All Rights Reserved.

Web Development with Flask and the Raspberry Pi Leading by Example CUAUHTEMOC CARBAJAL ITESM CEM 22/04/2014

Elgg 1.8 Social Networking

Grails 1.1. Web Application. Development. Reclaiming Productivity for Faster. Java Web Development. Jon Dickinson PUBLISHING J MUMBAI BIRMINGHAM

The Decaffeinated Robot

AGILE PROGRAMMING AND DESIGN PATTERNS IN WEB DEVELOPMENT -A CASE STUDY

Oracle Identity Analytics Architecture. An Oracle White Paper July 2010

Have you ever done something the long way and then

CSCI110 Exercise 4: Database - MySQL

FileMaker Server 9. Custom Web Publishing with PHP

tibbr Now, the Information Finds You.

JBoss Portal 2.4. Quickstart User Guide

Inside the Digital Commerce Engine. The architecture and deployment of the Elastic Path Digital Commerce Engine

ITG Software Engineering

INSTALLING, CONFIGURING, AND DEVELOPING WITH XAMPP

Grails: Accelerating J2EE Application Development

Installing buzztouch Self Hosted

Aptana RadRails: An IDE for Rails Development

7 Why Use Perl for CGI?

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

CrownPeak Playbook CrownPeak Hosting with PHP

Web development... the server side (of the force)

Aspire Systems - Experience in Digital Marketing and Social Media

Sisense. Product Highlights.

Open Source Content Management System for content development: a comparative study

What s really under the hood? How I learned to stop worrying and love Magento

Case Study. SaaS Based Multi-Store Market Place Brainvire Infotech Pvt. Ltd Page 1 of 5

Framework as a master tool in modern web development

Transcription:

Chris Panayiotou

Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language The amazing productivity claims of Rails is the current buzz in the web development community

Can only be used for web-based, specifically HTML-based, applications Designed for small to medium CRUD-based applications Cross-platform Can use same tools and middleware on Windows, Linux and OS X Easy-install packages for Eclipse (with RADRails and Ruby editor plugins), MySQL, Apache, and other Eclipse plugins, eg Subversion

Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun. In Ruby, everything is an object Ruby is an interpreted scripting language, just like Perl, Python and PHP Ruby successfully combines Smalltalk's conceptual elegance, Python's ease of use and learning and Perl's pragmatism Ruby originated in Japan in 1993 by Yukihiro matz Matsumoto, and has started to become popular worldwide in the past few years as more English language books and documentation have become available Ruby is a metaprogramming language Metaprogramming is a means of writing software programs that write or manipulate other programs thereby making coding faster and more reliable

Rails is an open source Ruby framework for developing database-backed web applications Created by David Heinemeier Hansson DHH Partner, derived from the 37Signals project The Rails framework was extracted from real-world web applications The result is an easy to use and cohesive framework that's rich in functionality, and at the same time it does its best to stay out of your way All layers in Rails are built to work together so you Don t Repeat Yourself and can use a single language from top to bottom Everything in Rails (templates to control flow to business logic) is written in Ruby Except for configuration files - YAML

Metaprogramming techniques use programs to write programs Other frameworks use extensive code generation, which gives users a one-time productivity boost but little else, and customization scripts let the user add customization code in only a small number of carefully selected points Metaprogramming replaces these two techniques and eliminates their disadvantages Ruby is one of the best languages for metaprogramming, and Rails uses this capability well Scaffolding You often create temporary code in the early stages of development to help get an application up quickly and see how major components work together Rails automatically creates much of the scaffolding you'll need

Convention over configuration Most Web development frameworks for.net or Java force you to write pages of configuration code If you follow suggested naming conventions, Rails doesn't need much configuration. In fact, you can often cut your total configuration code by a factor of five or more over similar Java frameworks just by following common conventions Naming your data model class with the same name as the corresponding database table id as the primary key name Rails introduces the Active Record framework, which saves objects to the database The Rails version of Active Record discovers the columns in a database schema and automatically attaches them to your domain objects using metaprogramming This approach to wrapping database tables is simple, elegant, and powerful

Rails implements the model-view-controller (MVC) architecture. The MVC design pattern separates the component parts of an application Model encapsulates data that the application manipulates, plus domain-specific logic View is a rendering of the model into the user interface Controller responds to events from the interface and causes actions to be performed on the model. MVC pattern allows rapid change and evolution of the user interface and controller separate from the data model

Rails embraces test-driven development. Unit testing: testing individual pieces of code Functional testing: testing how individual pieces of code interact Integration testing: testing the whole system Three environments: development, testing, and production Database Support: Oracle, DB2, SQL Server, MySQL, PostgreSQL, SQLite

No big corporate backer Very few expert Ruby programmers Runs slowly (Java ~ 5 times faster but Ruby may be improved by new VM - YARV) Poor editor support and very slow debugger No clustering, failover No two-phase commit Does not support compound primary keys Internationalization support is weak No off-the-shelf reporting tool

Ruby on Rails Request Flow

Uses Convention over Configuration, and Reflection Therefore very little configuration compared to other frameworks ActiveRecord configuration can use SQL Uses YAML (easy to read) rather than XML development: adapter: oci host: 192.168.0.50/examplesid username: exampleuser password: examplepass

Rails will run on many different Web servers Most of your development will be done using WEBrick, but you'll probably want to run production code on one of the alternative servers Apache, Lighttpd (Lighty),Mongrel Development Environment Windows, Linux and OS X No IDE needed although there a few available like Eclipse, RadRails Installing Ruby for Windows Download the One-Click Ruby Installer from http://rubyinstaller.rubyforge.org Installing Ruby for Mac It s already there! RubyGems is a package manager that provides a standard format for distributing Ruby programs and libraries Installing Rails >gem install rails include-dependencies

Controller (DispatchServlet) orchestrates the application: Extracts parameters and interacts with the Model through an ActionController subclass: Example: http://localhost/item/delete/100 directs to ItemController (defined in item_controller.rb) and passes to the method delete the value 100 Invokes the View providing the rendering of the Model ActionController and ActionView form the Action Pack: core requests processing and responses generation

View: a combination of templates, partials and layouts using Ruby code tag libraries (similar to Java tag libraries): Allows data display and input, but never handles incoming data ActionView module provides templates rendering (HTML or XML):.rxml templates render XML pages, while.rhtml templates render HTML pages writing a view = writing a template (i.e. HTML fragments are interwoven with Ruby code statements) Controller instance variables and public methods accessible from templates (actions communicate data to templates)

Model: ActiveRecord wrapping framework ActiveRecord subclass wraps a row in a database table/view, encapsulates access/domain logic, and acts as the gatekeeper Wraps class hierarchies to relational tables through single table inheritance (a string column TYPE is added to every table) Wraps classic table relationships (one-to-one, one-tomany, many-to-many) through declarations in the model (belongs-to, has-one, has-many, has-andbelongs-to-many), and also supports: acts_as_tree, acts_as_list Differs from other ORM (Object Relational Mapping) implementations through its convention over configuration principle which implies a sensible set of defaults 16

Model Relations Has_one => One to One relationship Belongs_to => Many to One relationship (Many) Has_many => Many to One relationship (One) Has_and_belongs_to_many =>Many to Many relationships

Create the Rails Application Execute the script that creates a new Web application project >Rails projectname This command executes an already provided Rails script that creates the entire Web application directory structure and necessary configuration files

App> contains the core of the application /models> Contains the models, which encapsulate application business logic /views/layouts> Contains master templates for each controller /views/controllername> Contains templates for controller actions /helpers> Contains helpers, which you can write to provide more functionality to templates Config> contains application configuration, plus perenvironment configurability - contains the database.yml file which provides details of the database to be used with the application Db> contains a snapshot of the database schema and migrations Log> application specific logs, contains a log for each environment Public> contains all static files, such as images, javascripts, and style sheets Script> contains Rails utility commands Test> contains test fixtures and code Vendor> contains add-in modules.

Need a controller and a view >ruby script/generate controller Greeting Edit app/controllers/greeting_controller.rb Add an index method to your controller class class GreetingController < ApplicationController def index render :text => "<h1>hello Rails World!</h1>" end end Renders the content that will be returned to the browser as the response body If you use blank for the name of the action it maps to the index action Start the WEBrick server >ruby script/server http://localhost:3000

Add another method to the controller def hello end Add a template app/views/greeting>hello.rhtml <html> <head> <title>hello Rails World!</title> </head> <body> <h1>hello from the Rails View!</h1> </body> </html>

ERb - Embedded Ruby: Embedding the Ruby programming language into HTML document An erb file ends with.rhtml file extension. Similar to ASP, JSP and PHP, requires an interpreter to execute and replace it with designated HTML code and content Making it Dynamic <p>date/time: <%= Time.now %></p> Making it Better by using an instance variable to the controller @time = Time.now.to_s Reference it in.rhtml <%= @time %> Linking Pages using the helper method link_to() <p>time to say <%= link_to "Goodbye!", :action => "goodbye" %>

Books Agile Web Development with Rails Programming Ruby Web sites Ruby Language http://www.ruby-lang.org/en/ Ruby on Rails http://www.rubyonrails.org/ Rails API Start the Gem Documentation Server Gem_server http://localhost:8808 MVC architectural paradigm http://en.wikipedia.org/wiki/model-view-controller http://java.sun.com/blueprints/patterns/mvc-detailed.html