SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
Ruby on Rails
           Rapid Application Development




Petronela-Alina Dănilă
Andreea- Mădălina Lazăr
Table of contents


     1. Introduction
     2. Overview
     3. Architecture
            3.1. Rails modules
            3.2. MVC pattern
     4. Application example
            4.1. Creating a project
            4.2. Creating a controller
            4.3. Creating a view
     5. Comparisons
     6. Conclusions
     7. Bibliography
1. Introduction

         We decided to choose as a development environment Ruby on Rails because we felt
the need in challenging our selves and learn something new in a short period of time.
         This paper covers the steps of developing a Ruby On Rails web application including
theory and practical work. We start of by pointing the language used, framework and RAD
that we used, including small technical details.
         Further we present the architecture of the Rad that we have chosen, a small glimpse at
it’s architecture and after that shortly pointing out the modules
         In the Application Example module we present a path in creating a web application
using Ruby on Rails: creating a new project, controller and view and describing some of the
framework’s features involving the method that we used in development.
         To close it all we propose a chapter of comparisons between Rails, Ruby on Rails and
other frameworks, RAD’s with pro’s and cont’s.
2. Overview

Ruby
        Is a general purpose, cross platform programming language. It supports multiple
paradigms, including functional, object oriented, imperative and reflective. The language is
interpreted and dynamic typed, having automatic memory management. Ruby was designed
to have an elegant syntax and made as human readable as possible.

Rails
       Is an open source web application framework written in the Ruby programming
language, based on the Model-View-Controller pattern.

Ruby on Rails (RoR)
        The framework includes tools that make web development easier, and it was created
as a response to heavy web frameworks as J2EE and .NET.
        In order to make the development faster, Ruby on Rails uses coding by convention
and assumptions, eliminating configuration code.
        Many of the common tasks for web development are built-in in the framework,
including email management, object database mappers, file structure, code generation,
elements naming and organization and so on.

     Ruby on Rails framework has the following features:
   ● Model-View-Controller architecture
   ● REST for web services
   ● Support for major databases (MySQL, Oracle, MS SQL Server, PostgresSQL, IBM
     DB2)
   ● Convention over configuration
   ● Script generators
   ● YAML machine, for human readable data serialization
   ● Extensive use of javascript libraries
3. Architecture




                          Figure 1. Overall framework architecture


3.1. Rails modules

Action Mailer
       Is the module responsible for providing e-mail services. It handles incoming and
outgoing mails, using simple text or rich-format emails. It has common built-in as welcome
messages or sending forgotten passwords.

Action Pack
        Provides the controller and view layers of the MVC pattern. This module captures the
user requests made by the browser/ client and maps the requests to the actions defined in the
controller layer. After the action is executed, a view is rendered to be displayed in browser.
        This module contains 3 sub-modules:
    ● Action Dispatch - handles the routing of the request (dispatching);
    ● Action Controller - the request is routed to the corresponding controller, which
        contains actions to control the model and view, as well as managing user sessions;
    ● Action View - renders the representation of the web page, which can be made from
        templates, feeds and other presentation formats.
Active Model
       Represents the interface between Action Pack and Active Record.

Active Record
        Is used to manage data in relational databases through objects. This module connects
the database tables with the representation in Ruby classes. Rails provide CRUD
functionality with zero configuration.

Active Resource
       This module manages the connection between RESTful web services and objects. It
maps model classes to remote REST resources.

Active Support
       Represents the collection of utility classes and standard Ruby libraries.

Railties
       Is the core of Rails framework that connects all the modules and handles all processes.


3.2. MVC pattern

Model
        This layer represents the business logic of the application. Usually, the models are
backed by database, but they can also be ordinary Ruby classes that implement a set of
interfaces provided by Active Model.

View
        Is the front-end of the application. The views are HTML files with embedded Ruby
code (.erb files). They usually contain loops and conditionals, displaying data received from
the controller.

Controller
        This layer is responsible for handling incoming HTTP requests. The controller
interacts with models and views by manipulating the model and rendering the view. They
process data from models and pass it to view.
4. Application example

       Before development, you must first install Ruby on Rails (http://rubyonrails.org/
download) and find an IDE (RubyMine, Eclipse, NetBeans, RubyInSteel, RadRails).
       As an example, we propose an application that gathers information from three web
services: www.slideshare.net, www.eventbrite.com and www.twitter.com for a user given
query.

4.1. Creating a project
        This can be made using the IDE or running a command in the console. All the
projects have the same structure, with the file structure containing directories for models,
views, controllers and configuration files.
        An important configuration file is routes.rb, which specifies the application routing:

get "home/index"
get "home/respond"

4.2. Creating a controller
       In Ruby on Rails, a Controller is a class inheriting ApplicationController:
(class HomeController < ApplicationController), that contains a number of predefined
methods equaly ( regarding both the name and the number) to the number and name of the
application’s views.
       Calling REST services
       The default method is using the standard Ruby RestClient.

              # create the request
              query_params = {:api_key => SLIDESHARE_KEY,
                               :ts => ts,
                               :hash => hash,
                               :q => query,
                               :page => '1',
                               :items_per_page => SLIDESHARE_MAX_COUNT}
              response = RestClient.get(SLIDESHARE_SEARCH_URL, :params
              => query_params)


4.3. Creating a view
        A view is mapped to a method in the controller, as specified in the routing file. When
a page is requested, the corresponding controller handles the request (if necessary interacts
with the model) and passes the control to the view.
In our example, we have the respond method, that is mapped to the respond view.

                def respond
                     if !params["query"].nil?
                     @slideshare = slideshare_get (params["query"])
                     @twitter = twitter_get (params["query"])
                     @event = eventbrite_get (params["query"])
end
                  end

        To better ensure the quality of reading, under the params hash variable, you can find
the data sent by the user, from your controller. There are two types of parameters: the first are
as part of your URL(everything after “?” in your URL), and the second type the ones sent
from a POST request.
        Usually views, in RoR are html.erb documents. They use the html format in order to
render text visually in the browser, and the .erb extension in order to bind the Rails instance
variables that holds information from the controller and shares it with the current view. The
content of these variables can be used by embedding the <% %> and <%= %> tags.
        In this example :

            <% index = 0%>
            <%@slideshare.each do |p| %>
                  <li     id     ='slides_<%=index%>'><%=                           image_tag
       p.thumbnail,       :class        =>       "thumbnail"                             %><p
       class="titles"><%=p.title%></p></li>
                  <% index= index+1%>
            <% end %>

you can see the usage of both these tags. The difference between the two is that the one using
the “=” sign actually puts the value of the variable inside the statement, whereas the other
one simply resembles and embeds Ruby code.
       Another thing that you can spot from the statement above is the usage of <%=
image tag %>. This is one of the many helper methods that Rails comes to the
developer’s aid in that it replaces bulks of html code with one easy and intuitive call. These
kind of helpers can be used for forms(<%= form_tag %>), links (<%= link_to %>),images
(as above), meta tags( link tag for css - <%= stylesheet_link_tag          "main" %>, <%=
csrf_meta_tags %>), scripts( <%= javascript_include_tag "application" %>).
5. Comparisons




                            Figure 2. Rails vs PHP vs Java




                     Figure 3. Google trends, search comparison

Why use Ruby on Rails:
  ● Ruby is more elegant than other languages
   ● quicker launch - it could take about half of the development time with other
      frameworks
  ● easier changes - future modifications can be made more quickly
  ● convenient plugins
  ● code testing

When to use Ruby on Rails
●   e-commerce
   ●   membership sites - this option is built-in in Rails and there are a variety of plugins
   ●   content management
   ●   custom database solutions

Why not to use Ruby (on Rails)
  ● Ruby is slow
  ● Ruby is new
  ● not very scalable
6. Conclusions

       Since the first version was launched, Ruby on Rails has received widespread support,
especially from the open-source community. It’s purpose is rapid application development
and AGILE practices.
       The framework architecture meets most of it’s intended goals, but not without any
flaws.


       “Ruby is optimized for programmer happiness and sustainable productivity”.
7. Bibliography

http://rubyonrails.org/
http://en.wikipedia.org/wiki/Ruby_on_Rails#Technical_overview
http://www.adrianmejiarosario.com/content/ruby-rails-architectural-design
http://www.slideshare.net/jonkinney/ruby-on-rails-overview
http://en.wikipedia.org/wiki/Ruby_%28programming_language%29
https://github.com/rails/rails
http://en.wikipedia.org/wiki/Comparison_of_Web_application_frameworks
http://en.wikipedia.org/wiki/Ruby_on_Rails
http://en.wikipedia.org/wiki/Convention_over_Configuration
https://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130
http://www.slideshare.net/dosire/when-to-use-ruby-on-rails-1308900
http://on-ruby.blogspot.com/2006/11/tim-bray-comparing-intrisics.html
http://www.google.com/trends?
q=symfony,+ruby+on+rails,+cakephp,+django+python,+asp.net+mvc&ctab=0&geo=all&
date=all&sort=3

Weitere ähnliche Inhalte

Was ist angesagt?

Rails
RailsRails
RailsSHC
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISGeert Pante
 
Spring HATEOAS
Spring HATEOASSpring HATEOAS
Spring HATEOASYoann Buch
 
Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)PawanMM
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1PawanMM
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsPawanMM
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkGuo Albert
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
 
[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3Huu Dat Nguyen
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by GoogleASG
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCJohn Lewis
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable linksStephen Richard
 
Session 33 - Session Management using other Techniques
Session 33 - Session Management using other TechniquesSession 33 - Session Management using other Techniques
Session 33 - Session Management using other TechniquesPawanMM
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using CookiesPawanMM
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSINGAaqib Hussain
 

Was ist angesagt? (19)

Rails
RailsRails
Rails
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 
Spring HATEOAS
Spring HATEOASSpring HATEOAS
Spring HATEOAS
 
Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)Session 37 - JSP - Part 2 (final)
Session 37 - JSP - Part 2 (final)
 
Rest
Rest Rest
Rest
 
Intro lift
Intro liftIntro lift
Intro lift
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
 
[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3[Laptrinh.vn] lap trinh Spring Framework 3
[Laptrinh.vn] lap trinh Spring Framework 3
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Approaches to machine actionable links
Approaches to machine actionable linksApproaches to machine actionable links
Approaches to machine actionable links
 
Session 33 - Session Management using other Techniques
Session 33 - Session Management using other TechniquesSession 33 - Session Management using other Techniques
Session 33 - Session Management using other Techniques
 
Spring
SpringSpring
Spring
 
Session 32 - Session Management using Cookies
Session 32 - Session Management using CookiesSession 32 - Session Management using Cookies
Session 32 - Session Management using Cookies
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
 

Ähnlich wie Ruby on rails RAD

Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentSonia Simi
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails SiddheshSiddhesh Bhobe
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsanides
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon RailsPaul Pajo
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to railsEvgeniy Hinyuk
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukPivorak MeetUp
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails DevelopersEdureka!
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction Tran Hung
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRSumanth krishna
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsVictor Porof
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantNitin Sawant
 

Ähnlich wie Ruby on rails RAD (20)

Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
Rails interview questions
Rails interview questionsRails interview questions
Rails interview questions
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Jasig Rubyon Rails
Jasig Rubyon RailsJasig Rubyon Rails
Jasig Rubyon Rails
 
Lecture #5 Introduction to rails
Lecture #5 Introduction to railsLecture #5 Introduction to rails
Lecture #5 Introduction to rails
 
Introduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy HinyukIntroduction to Rails by Evgeniy Hinyuk
Introduction to Rails by Evgeniy Hinyuk
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
 
Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 

Kürzlich hochgeladen

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Kürzlich hochgeladen (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Ruby on rails RAD

  • 1. Ruby on Rails Rapid Application Development Petronela-Alina Dănilă Andreea- Mădălina Lazăr
  • 2. Table of contents 1. Introduction 2. Overview 3. Architecture 3.1. Rails modules 3.2. MVC pattern 4. Application example 4.1. Creating a project 4.2. Creating a controller 4.3. Creating a view 5. Comparisons 6. Conclusions 7. Bibliography
  • 3. 1. Introduction We decided to choose as a development environment Ruby on Rails because we felt the need in challenging our selves and learn something new in a short period of time. This paper covers the steps of developing a Ruby On Rails web application including theory and practical work. We start of by pointing the language used, framework and RAD that we used, including small technical details. Further we present the architecture of the Rad that we have chosen, a small glimpse at it’s architecture and after that shortly pointing out the modules In the Application Example module we present a path in creating a web application using Ruby on Rails: creating a new project, controller and view and describing some of the framework’s features involving the method that we used in development. To close it all we propose a chapter of comparisons between Rails, Ruby on Rails and other frameworks, RAD’s with pro’s and cont’s.
  • 4. 2. Overview Ruby Is a general purpose, cross platform programming language. It supports multiple paradigms, including functional, object oriented, imperative and reflective. The language is interpreted and dynamic typed, having automatic memory management. Ruby was designed to have an elegant syntax and made as human readable as possible. Rails Is an open source web application framework written in the Ruby programming language, based on the Model-View-Controller pattern. Ruby on Rails (RoR) The framework includes tools that make web development easier, and it was created as a response to heavy web frameworks as J2EE and .NET. In order to make the development faster, Ruby on Rails uses coding by convention and assumptions, eliminating configuration code. Many of the common tasks for web development are built-in in the framework, including email management, object database mappers, file structure, code generation, elements naming and organization and so on. Ruby on Rails framework has the following features: ● Model-View-Controller architecture ● REST for web services ● Support for major databases (MySQL, Oracle, MS SQL Server, PostgresSQL, IBM DB2) ● Convention over configuration ● Script generators ● YAML machine, for human readable data serialization ● Extensive use of javascript libraries
  • 5. 3. Architecture Figure 1. Overall framework architecture 3.1. Rails modules Action Mailer Is the module responsible for providing e-mail services. It handles incoming and outgoing mails, using simple text or rich-format emails. It has common built-in as welcome messages or sending forgotten passwords. Action Pack Provides the controller and view layers of the MVC pattern. This module captures the user requests made by the browser/ client and maps the requests to the actions defined in the controller layer. After the action is executed, a view is rendered to be displayed in browser. This module contains 3 sub-modules: ● Action Dispatch - handles the routing of the request (dispatching); ● Action Controller - the request is routed to the corresponding controller, which contains actions to control the model and view, as well as managing user sessions; ● Action View - renders the representation of the web page, which can be made from templates, feeds and other presentation formats.
  • 6. Active Model Represents the interface between Action Pack and Active Record. Active Record Is used to manage data in relational databases through objects. This module connects the database tables with the representation in Ruby classes. Rails provide CRUD functionality with zero configuration. Active Resource This module manages the connection between RESTful web services and objects. It maps model classes to remote REST resources. Active Support Represents the collection of utility classes and standard Ruby libraries. Railties Is the core of Rails framework that connects all the modules and handles all processes. 3.2. MVC pattern Model This layer represents the business logic of the application. Usually, the models are backed by database, but they can also be ordinary Ruby classes that implement a set of interfaces provided by Active Model. View Is the front-end of the application. The views are HTML files with embedded Ruby code (.erb files). They usually contain loops and conditionals, displaying data received from the controller. Controller This layer is responsible for handling incoming HTTP requests. The controller interacts with models and views by manipulating the model and rendering the view. They process data from models and pass it to view.
  • 7. 4. Application example Before development, you must first install Ruby on Rails (http://rubyonrails.org/ download) and find an IDE (RubyMine, Eclipse, NetBeans, RubyInSteel, RadRails). As an example, we propose an application that gathers information from three web services: www.slideshare.net, www.eventbrite.com and www.twitter.com for a user given query. 4.1. Creating a project This can be made using the IDE or running a command in the console. All the projects have the same structure, with the file structure containing directories for models, views, controllers and configuration files. An important configuration file is routes.rb, which specifies the application routing: get "home/index" get "home/respond" 4.2. Creating a controller In Ruby on Rails, a Controller is a class inheriting ApplicationController: (class HomeController < ApplicationController), that contains a number of predefined methods equaly ( regarding both the name and the number) to the number and name of the application’s views. Calling REST services The default method is using the standard Ruby RestClient. # create the request query_params = {:api_key => SLIDESHARE_KEY, :ts => ts, :hash => hash, :q => query, :page => '1', :items_per_page => SLIDESHARE_MAX_COUNT} response = RestClient.get(SLIDESHARE_SEARCH_URL, :params => query_params) 4.3. Creating a view A view is mapped to a method in the controller, as specified in the routing file. When a page is requested, the corresponding controller handles the request (if necessary interacts with the model) and passes the control to the view. In our example, we have the respond method, that is mapped to the respond view. def respond if !params["query"].nil? @slideshare = slideshare_get (params["query"]) @twitter = twitter_get (params["query"]) @event = eventbrite_get (params["query"])
  • 8. end end To better ensure the quality of reading, under the params hash variable, you can find the data sent by the user, from your controller. There are two types of parameters: the first are as part of your URL(everything after “?” in your URL), and the second type the ones sent from a POST request. Usually views, in RoR are html.erb documents. They use the html format in order to render text visually in the browser, and the .erb extension in order to bind the Rails instance variables that holds information from the controller and shares it with the current view. The content of these variables can be used by embedding the <% %> and <%= %> tags. In this example : <% index = 0%> <%@slideshare.each do |p| %> <li id ='slides_<%=index%>'><%= image_tag p.thumbnail, :class => "thumbnail" %><p class="titles"><%=p.title%></p></li> <% index= index+1%> <% end %> you can see the usage of both these tags. The difference between the two is that the one using the “=” sign actually puts the value of the variable inside the statement, whereas the other one simply resembles and embeds Ruby code. Another thing that you can spot from the statement above is the usage of <%= image tag %>. This is one of the many helper methods that Rails comes to the developer’s aid in that it replaces bulks of html code with one easy and intuitive call. These kind of helpers can be used for forms(<%= form_tag %>), links (<%= link_to %>),images (as above), meta tags( link tag for css - <%= stylesheet_link_tag "main" %>, <%= csrf_meta_tags %>), scripts( <%= javascript_include_tag "application" %>).
  • 9. 5. Comparisons Figure 2. Rails vs PHP vs Java Figure 3. Google trends, search comparison Why use Ruby on Rails: ● Ruby is more elegant than other languages ● quicker launch - it could take about half of the development time with other frameworks ● easier changes - future modifications can be made more quickly ● convenient plugins ● code testing When to use Ruby on Rails
  • 10. e-commerce ● membership sites - this option is built-in in Rails and there are a variety of plugins ● content management ● custom database solutions Why not to use Ruby (on Rails) ● Ruby is slow ● Ruby is new ● not very scalable
  • 11. 6. Conclusions Since the first version was launched, Ruby on Rails has received widespread support, especially from the open-source community. It’s purpose is rapid application development and AGILE practices. The framework architecture meets most of it’s intended goals, but not without any flaws. “Ruby is optimized for programmer happiness and sustainable productivity”.
  • 12. 7. Bibliography http://rubyonrails.org/ http://en.wikipedia.org/wiki/Ruby_on_Rails#Technical_overview http://www.adrianmejiarosario.com/content/ruby-rails-architectural-design http://www.slideshare.net/jonkinney/ruby-on-rails-overview http://en.wikipedia.org/wiki/Ruby_%28programming_language%29 https://github.com/rails/rails http://en.wikipedia.org/wiki/Comparison_of_Web_application_frameworks http://en.wikipedia.org/wiki/Ruby_on_Rails http://en.wikipedia.org/wiki/Convention_over_Configuration https://picasaweb.google.com/Dikiwinky/Ruby#5116531304417868130 http://www.slideshare.net/dosire/when-to-use-ruby-on-rails-1308900 http://on-ruby.blogspot.com/2006/11/tim-bray-comparing-intrisics.html http://www.google.com/trends? q=symfony,+ruby+on+rails,+cakephp,+django+python,+asp.net+mvc&ctab=0&geo=all& date=all&sort=3