Web Application Frameworks (WAF)

  • Published on
    10-May-2015

  • View
    356

  • Download
    1

Embed Size (px)

Transcript

<ul><li>1.Web Application Frameworks (WAF) Ako Kaman @scheperson </li></ul> <p>2. What is a WAF? A general purpose software framework Used to build: Dynamic websites Web applications Web API Mostly based on MVC pattern Push based (more popular) Pull based 3. Why should I bother using a WAF? Community support Dont reinvent the wheel Better application structure Decrease development time Free tools and components (more on this later) Hundreds of developers are smarter than your team! (RoR =&gt; 3477) 4. What is included in a typical WAF? Asset management (some WAFs) Generating sprites Pre-compiling assets for production Compiling SASS, Less and Coffescript on the fly (development) Helpers Security Local authentication Using OAuth Controllers Test tools 5. What is included in a typical WAF? (cont.) Scaffolding Command line tools I18n and L10n support Templating engine (View layer) Routing and URL mapping (no Default.aspx)! Database access and abstraction (Model layer) Migrations Caching data Databased agnostic Object oriented database access (ORM) 6. How does MVC work? Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 7. Some WAFs out there PHP Yii Laravel FuelPHP CakePHP Zend Framework CodeIgniter (dead) =&gt; ExpressionEngine Symfony =&gt; Yahoo Bookmarks, Delicious, DailyMotion Python Flask Pylons Django =&gt; Pinterest, Disqus, Instagram, Mozilla, Rdio 8. Some WAFs out there (cont.) Java/Scala Lift =&gt; FourSquare Play =&gt; LinkedIn, Klout, The Guardian Java Grails Spring ASP.NET (C#, VB) :( ASP.NET MVC Ruby :) Sinatra =&gt; Apple, BBC, Heroku Ruby on Rails =&gt;Twitter, GitHub, Basecamp, Groupon, SoundCloud 9. How does MVC work? Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 10. Making an HTTP request Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 11. Making an HTTP request (cont.) http://example.com/books/1 GET /books/1 HTTP/1.1 Host: example.com 12. Routing and URL mapping Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 13. Routing and URL mapping (cont.) get admin/news match "admin/news", to: "admin#posts", as: "manage_news", via: :get Prefix Verb URI Pattern Controller#Action admin_news GET /admin/news admin#news Prefix Verb URI Pattern Controller#Action manage_news GET /admin/news admin#posts 14. Routing and URL mapping (cont.) resources books Note the :id parameter Prefix Verb URI Pattern Controller#Action books GET /books books#index POST /books books#create new_book GET /books/new books#new edit_book GET /books/:id/edit books#edit book GET /books/:id books#show PATCH /books/:id books#update PUT /books/:id books#update DELETE /books/:id books#destroy 15. Migrations, Models and Controllers Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 16. Migrations, Models and Controllers (cont.) class CreateBooks &lt; ActiveRecord::Migration def change create_table :books do |t| t.string :title t.string :isbn t.integer :pages end end end $ rails g migration CreateBooks title isbn pages:integer What is a migration? 17. Migrations, Models and Controllers (cont.) class BooksController &lt; ApplicationController ... def show @book = Book.find(params[:id]) # /books/:id end ... end class Book &lt; ActiveRecord::Base end 18. Views Router Controller Model Browser View Request Dispatch Fetch dataPush data Render Response 19. Views (cont.) </p> <p> Title: </p> <p> ISBN: </p> <p> Pages: </p> <p> | 20. Views (cont.) </p> <p> Title: </p> <p> ISBN: </p> <p> Pages: </p> <p> | Prefix Verb URI Pattern Controller#Action books GET /books books#index edit_book GET /books/:id/edit books#edit 21. The end result 22. Questions? </p>