Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to MVC for Desktop Application<br />Course C1001<br />He Shiming2010-9<br />射手科技 (SPlayer.org)<br />
MVC in Web Applications<br />introducing agile web development with ruby on rails<br />射手科技 (SPlayer.org)<br />
Rails Framework and MVC<br />Model represents information, tables and their relations, basic queries of data, the fundamen...
Rails Framework and MVC<br />Data<br />Controller<br />View<br />Model<br />射手科技 (SPlayer.org)<br />
Generating A Scaffold Rails App<br />rails staff_man<br />cd staff_man<br />ruby script/generate scaffold Staff name:strin...
Rails Model<br />app/models/staff.rbclass Staff < ActiveRecord::Baseend<br />db/migrate/XXXX_create_staffs.rbclass CreateS...
Rails View<br />app/views/staffs/index.html.erb<h1>Listing staffs</h1><table><tr><th>Name</th><th>Age</th></tr><% @staffs....
Rails Controller<br />app/controllers/staffs_controller.rbclass StaffsController < ApplicationController# GET /staffs# GET...
Development of This App<br />Database engineers can focus on table design, data validation (Model)<br />Front-end designer...
Rails Framework Achieved:<br />Complete isolation of presentation (UI) and business logic (database and queries)<br />Inde...
Recommended Readings<br />射手科技 (SPlayer.org)<br />
References Regarding Ruby on Rails<br />http://www.railsforum.com<br />http://rubyonrails.org/<br />射手科技 (SPlayer.org)<br />
References Regarding MVC and Others<br />http://en.wikipedia.org/wiki/Model–View–Controller<br />http://www.oracle.com/tec...
Upcoming SlideShare
Loading in …5
×

MVC for Desktop Application - Part 2

3,700 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

MVC for Desktop Application - Part 2

  1. 1. Introduction to MVC for Desktop Application<br />Course C1001<br />He Shiming2010-9<br />射手科技 (SPlayer.org)<br />
  2. 2. MVC in Web Applications<br />introducing agile web development with ruby on rails<br />射手科技 (SPlayer.org)<br />
  3. 3. Rails Framework and MVC<br />Model represents information, tables and their relations, basic queries of data, the fundamentals of business logic<br />View represents user interface, the presentation of data and business logic<br />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<br />射手科技 (SPlayer.org)<br />
  4. 4. Rails Framework and MVC<br />Data<br />Controller<br />View<br />Model<br />射手科技 (SPlayer.org)<br />
  5. 5. Generating A Scaffold Rails App<br />rails staff_man<br />cd staff_man<br />ruby script/generate scaffold Staff name:stringage:int<br />rake db:migrate<br />射手科技 (SPlayer.org)<br />
  6. 6. Rails Model<br />app/models/staff.rbclass Staff < ActiveRecord::Baseend<br />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<br />射手科技 (SPlayer.org)<br />
  7. 7. Rails View<br />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><br />射手科技 (SPlayer.org)<br />
  8. 8. Rails Controller<br />app/controllers/staffs_controller.rbclass StaffsController < ApplicationController# GET /staffs# GET /staffs.xmldefindex@staffs = Staff.all<br />respond_to do |format|format.html # index.html.erbformat.xml { render :xml => @staffs } endend<br />射手科技 (SPlayer.org)<br />
  9. 9. Development of This App<br />Database engineers can focus on table design, data validation (Model)<br />Front-end designers can focus on visual design, only need to learn HTML-like special tags (View)<br />Business logic developers can focus on workflow, logic design, no need to work closely with front-end designers or database engineers (Controller)<br />射手科技 (SPlayer.org)<br />
  10. 10. Rails Framework Achieved:<br />Complete isolation of presentation (UI) and business logic (database and queries)<br />Independent and parallel development of web application<br />Very low inter-connection of application components (low-coupling)<br />射手科技 (SPlayer.org)<br />
  11. 11. Recommended Readings<br />射手科技 (SPlayer.org)<br />
  12. 12. References Regarding Ruby on Rails<br />http://www.railsforum.com<br />http://rubyonrails.org/<br />射手科技 (SPlayer.org)<br />
  13. 13. References Regarding MVC and Others<br />http://en.wikipedia.org/wiki/Model–View–Controller<br />http://www.oracle.com/technetwork/articles/javase/mvc-136693.html<br />http://www.djangoproject.com/<br />http://code.google.com/webtoolkit/<br />射手科技 (SPlayer.org)<br />

×