1. Set up a focus group (like a study group for peer learning) to work on the Ruby on Rails workshops via Interact tools as a class.
Skipped at this moment, will start on next week.
2. What is meant by “convention over configuration” and how does it reduce coding?
Convention Over Configuration (CoC) is that the framework enforces standard naming conventions for mapping classes to resources. In a general purpose framework, one or more configuration files are required in order to set up the framework. When the complexity and size of applications grow, it is very difficult to maintain the configuration files. Most mapping information can be reflected by the database table structure without the need of any configuration. Therefore, changing the name of the class or method in the source code will not induced any modification of the configuration file because it is automatically propagated through the application. (Chen, 2006)
3. Further work on understanding MVC:
a. See the wiki at http://wiki.rubyonrails.org/rails/pages/UnderstandingMVC
The topic doesn't exist.
b. Do the MVC tutorial at http://wiki.squeak.org/squeak/1767
Done.
4. Got a spare hour or so? I recommend the UC Berkeley RAD lab’s Ruby on Rails Short course at http://youtube.com/watch?v=LADHwoN2LMM
Not have enough time this week, will do it on next week.
5. Read the Flash article using ActionScript by Colin Moock titled “The Model-View-Controller Design Pattern “at http://www.adobe.com/devnet/flash/articles/mv_controller.html
Done.
Recommended time: 1-4 hours.
Challenge Problems:
1. How is Rails structured to follow the MVC pattern?
Consider our project and examine the directories where Rails is located. If the data model is called Taxi (it is convention to name the model beginning with an upper case letter). The model is a Ruby class located in app/models/taxi.rb
The SQL table is taxis – the pluralisation of the model. In our project we have 2 tables as passenger_origin and passenger_destination, where the table row = an object instance and each of the columns = an object attribute.
The controller methods live in app/controllers/taxi_controller.rb
Each controller can access templates to display the input screen and methods for action.
The views are kept is app/views/taxi/*.rhtml, where each *.rhtml maps to a controller method.
In Rails, the view is rendered using RHTML or RXML. According to the wiki page at http://wiki.rubyonrails.org/rails/pages/
UnderstandingViews, RHTML is HTML with embedded Ruby code and RXML is Ruby-generated XML code.
2. Apply the MVC design approach to our Project: Online Taxi Booking System.
HINT: Begin with a single model, single view and single controller classes. This will give you a head start to the next workshop: Online Taxi Booking System: SQL and Database design
From the hint, I will using a Passenger table inside the SQL database as the "Model", then I will create a set of methods (codes) to read, write, modify and delete the data inside the database which is the "Controller" and moreover a "View" which provide a UI for the users which maps with the controller's method.
No comments:
Post a Comment