1 Dr Alexiei Dingli Web Science Stream Introducing Rails.

Slides:



Advertisements
Similar presentations
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Advertisements

Introduction to Model-View-Controller (MVC) Web Programming with TurboGears Leif Oppermann,
Computer Monitoring System for EE Faculty By Yaroslav Ross And Denis Zakrevsky Supervisor: Viktor Kulikov.
Ruby on Rails a popular web application framework, aimed to increase the speed and ease of web development Ruby on Rails, Tim Zappe.
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
UNIT-V The MVC architecture and Struts Framework.
A little engineering on Rails Robert W. Hasker. Goals Intro to the Rails framework ▫Basic concepts: MVC, Active Record ▫A bit of Ruby Using Rails to build.
Ruby on Rails Charles Severance Textbook: Build Your own Ruby on Rails Application by Patrick Lenz (ISBN: )
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
Ruby on Rails CSCI 6314 David Gaspar Jennifer Garcia Avila.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Rails and Grails. To get started Make sure you have java installed You can get the sdk and jre at:
Web Servers Web server software is a product that works with the operating system The server computer can run more than one software product such as .
Server-side Scripting Powering the webs favourite services.
Web Application Programming Carol Wolf Computer Science.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
COMP 410 & Sky.NET May 2 nd, What is COMP 410? Forming an independent company The customer The planning Learning teamwork.
MVC & ActiveRecord by Christian Mohr & Mohamed Souiai.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Pemrograman Web MVC Programming and Design Pattern in PHP 5.
Lecture 11 Rails Topics SaaSSaaS Readings: SaaS book Ch February CSCE 740 Software Engineering.
Ruby on Rails CSE 190M, Spring 2009 Week 6. Overview How to use a database Demo creating a blog application on Rails Explain how the application works.
The Active Record Paradigm Databases in Database-Centric Web Site Development.
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Amir Bishara and Dorin Danial Supervisors: Roiy Zysman Dr. Ilana David.
Ruby/Ruby on Rails Yasushi Osonoi Open Dream corporation
Model View Controller MVC Web Software Architecture.
Ruby on Rails By S. Christopher Hellriegel. Overview 1. What is Ruby on Rails? 2. What is MVC? 3. Simple example 4. Wow, that was cool!
RUBY ON RAILS (RoR) Ishwor Khadka. Why Ruby on Rails?
Representational State Transfer (REST). What is REST? Network Architectural style Overview: –Resources are defined and addressed –Transmits domain-specific.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
RESTful Web Services What is RESTful?
Date : 3/04/2010 Web Technology Solutions Class: PHP Web Application Frameworks.
REST By: Vishwanath Vineet.
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
Chapter 9 Web Application Design. Objectives Describe the MVC design pattern as used with Web applications Explain the role and responsibilities of each.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
START Application Spencer Johnson Jonathan Barella Cohner Marker.
Representational State Transfer COMP6017 Topics on Web Services Dr Nicholas Gibbins –
J2EE Platform Overview (Application Architecture)
The Client-Server Model
API (Application Program Interface)
MVC Architecture, Symfony Framework for PHP Web Apps
Software Design.
REST- Representational State Transfer Enn Õunapuu
Sarang Nazari California State University, Los Angeles
Representational State Transfer
PHP / MySQL Introduction
SQL – Application Persistence Design Patterns
Bruce Scharlau, University of Aberdeen, 2017
WEB API.
Lecture 1: Multi-tier Architecture Overview
Web Application Architectures
$, $$, $$$ API testing Edition
Web Application Architectures
REST APIs Maxwell Furman Department of MIS Fox School of Business
Web Application Architectures
SQL – Application Persistence Design Patterns
Presentation transcript:

1 Dr Alexiei Dingli Web Science Stream Introducing Rails

2 Open source web application framework for Ruby Intended for agile programming Create by David Heinemeier Hansson Released originally in 2004 but only became popular 2007 when it was distributed with Mac OS X Leopard What is Rails?

3 Development Testing Production 3 Environments

4 Changes to source code immediately visible (just reload) Speed is not critical Provide insight to developer –Errors are easily spotted by showing the stack trace Development

5 Fill database using dummy data Unit and functional testing are fully automated Invoked from the command line Testing

6 Update to code base infrequent Production environment can be optimised Focus on performance Errors can be sent by to the developer Production

7 /config/Database.yml development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 production: adapter: mysql database: newMySqlProductionDB username: root password: superSecretPassword timeout: 5000 Setting our database

8 Database Server DevelopmentTable 1Table 2TestTable 1Table 2ProductionTable 1Table 2 Database architecture

9 Models –Handling data and business logic Controllers –Handling the user interface and application logic Views –Handling GUI and persistent objects Model-View-Controller Architecture

10 MVC Process

11 Improves scalability –Upgrade parts of the system without changing other components (Eg just the database) Makes maintenance easier –Components have low dependency on each other Promotes reuse –Model may be reused by multiple views (or vice- versa) Why MVC?

12 appcontrollershelpersmodelsviews MVC in Rails

13 Called Active Records –Connect to database –Retrieve data from tables –Store data in tables Abstracts from the database –Can connect immediately to SQLite, MySQL and PostgreSQL –RubyGems provide access to other Databases The model

14 Active Records abstract database specific code thus making it easy to shift between different databases Another magic of Rails is migration which saves us from creating any SQL Database Abstraction

15 Active Controller –Is the glue between the application data, presentation layer and the web browser –Decides how to handle a request –Retrieve data from the model to be passed –Gather information from browser request The controller

16 Class names should be written with each word beginning with a capital letter and no spaces between words –StoryBook –AgeCalculator Filenames are written in lowercase with undderscores separating each word –story_book –age_calculator Some conventions

17 Action View –Should only contain presentation logic –Can contain HTML and also Ruby code using the embded Ruby (ERb) syntax The View

18 The template has a one-to-one mapping to the action of a controller –Add should be in Add.html.erb The folder that stores the template should be named after the controller Views conventions

19 html.erb Standard HTML template which might contan ERb tags xml.builder Output XML (Eg RSS feeds) js.rjs Return JavaScript instructions Views extensions

20 REpresentational State Transfer –Design pattern not restricted to the WWW –Offers a resource centric approach where Client uses a resource Every resource needs to be addressed uniquely Interactions with resources are exposed as operations Most common are the CRUD operations –Create, Read, Update, Delete Lets have some REST

21 The protocol used is –Stateless Each request to the server is completely independent –Cacheable Proxies –Layered Routers Firewalls More REST

22 CRUDHTTP CREATEPOST READGET UPDATEPUT (Not implemented) DELETEDELETE (Not implemented) RESTing on the WWW

23 Deep relationship to provide assistance for easy construction of URLs Rails uses modified POST requests to implement the PUT and DELETE methods The REST of Rails

24 Rails generate the application’s structure easily Simply use the generate script Try –ruby script/generate Magical Generation

25 Convention over configuration –Developers only specify unconventional aspects –Eg if we have a class Sale in the model, the table will be called sales automatically –Leads to less code and less repetition –If the convention is not kept then more programming is needed Rails Philosophy (1)

26 Don’t Repeat Yourself (DRY) –Information located in a single unambiguous place –Eg using Active Records, no columns or tables are specified, everything is done automatically. Rails Philosophy (2)

27 Questions?