• Save
MVC for Desktop Application - Part  2
Upcoming SlideShare
Loading in...5
×
 

MVC for Desktop Application - Part 2

on

  • 3,171 views

 

Statistics

Views

Total Views
3,171
Views on SlideShare
2,683
Embed Views
488

Actions

Likes
0
Downloads
0
Comments
0

6 Embeds 488

http://blog.splayer.org 474
http://xianguo.com 7
http://new.xianguo.com 2
http://static.slidesharecdn.com 2
http://translate.googleusercontent.com 2
http://cache.baidu.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MVC for Desktop Application - Part  2 MVC for Desktop Application - Part 2 Presentation Transcript

  • Introduction to MVC for Desktop Application
    Course C1001
    He Shiming2010-9
    射手科技 (SPlayer.org)
  • MVC in Web Applications
    introducing agile web development with ruby on rails
    射手科技 (SPlayer.org)
  • Rails Framework and MVC
    Model represents information, tables and their relations, basic queries of data, the fundamentals of business logic
    View represents user interface, the presentation of data and business logic
    Controller is the glue between View and Model, responding to actions from View, and deciding which Model to use or what kind of logic to follow
    射手科技 (SPlayer.org)
  • Rails Framework and MVC
    Data
    Controller
    View
    Model
    射手科技 (SPlayer.org)
  • Generating A Scaffold Rails App
    rails staff_man
    cd staff_man
    ruby script/generate scaffold Staff name:stringage:int
    rake db:migrate
    射手科技 (SPlayer.org)
  • Rails Model
    app/models/staff.rbclass Staff < ActiveRecord::Baseend
    db/migrate/XXXX_create_staffs.rbclass CreateStaffs < ActiveRecord::Migrationdefself.upcreate_table :staffs do |t|t.string :namet.int :aget.timestamps endenddefself.downdrop_table :staffs endend
    射手科技 (SPlayer.org)
  • Rails View
    app/views/staffs/index.html.erb<h1>Listing staffs</h1><table><tr><th>Name</th><th>Age</th></tr><% @staffs.each do |staff| %><tr><td><%=h staff.name %></td><td><%=h staff.age %></td> </tr><% end %></table>
    射手科技 (SPlayer.org)
  • Rails Controller
    app/controllers/staffs_controller.rbclass StaffsController < ApplicationController# GET /staffs# GET /staffs.xmldefindex@staffs = Staff.all
    respond_to do |format|format.html # index.html.erbformat.xml { render :xml => @staffs } endend
    射手科技 (SPlayer.org)
  • Development of This App
    Database engineers can focus on table design, data validation (Model)
    Front-end designers can focus on visual design, only need to learn HTML-like special tags (View)
    Business logic developers can focus on workflow, logic design, no need to work closely with front-end designers or database engineers (Controller)
    射手科技 (SPlayer.org)
  • Rails Framework Achieved:
    Complete isolation of presentation (UI) and business logic (database and queries)
    Independent and parallel development of web application
    Very low inter-connection of application components (low-coupling)
    射手科技 (SPlayer.org)
  • Recommended Readings
    射手科技 (SPlayer.org)
  • References Regarding Ruby on Rails
    http://www.railsforum.com
    http://rubyonrails.org/
    射手科技 (SPlayer.org)
  • References Regarding MVC and Others
    http://en.wikipedia.org/wiki/Model–View–Controller
    http://www.oracle.com/technetwork/articles/javase/mvc-136693.html
    http://www.djangoproject.com/
    http://code.google.com/webtoolkit/
    射手科技 (SPlayer.org)