Tuesday, April 7, 2009

WORKSHOP 2


1. Setup a focus group to work on the Ruby on Rails workshop via interact tools as a class.

To work on the workshops using Ruby on Rails we had setup a forum group where we can discuss end help each other. For this forum, a group was created in Google, tool known as GoogleGroups. The group’s name is “ITC594” where all students are expect to participate helping each other, please visit
http://groups.google.com.au/group/itc594?hl=en.

Screenshot of the course’s Google Group.


2. What is meant by “convention over configuration” and how does it reduce coding?

Convention over Configuration (CoC) is considered for many experts the new and optimum way of developing web applications. And as mentioned in the previous workshop, there are a lot of things to consider developing web applications, and one of them is structuring things. It is well known that all these web applications have a lot in common, so many time is spend doing things over and over again.

Convention means that developing on Rails its only necessary to consider non-conventional features of the application due “it is built around a set of opinions about how to build web applications”. This leads to minimize the developers time reducing the configuration code and less repetition.


3. Further work on understanding MVC:
a. See the wiki at
http://wiki.rubyonrails.org/rails/pages/UnderstandingMVC
A message is displayed “This topic does not exist yet”.


b. Do the MVC tutorial at
http://wiki.squeak.org/squeak/1767

This is a good tutorial to understand from the origins of the MVC.
The Model View Controller was developed by Trygve Reenskaug in 1979, and important to mention that this was before the concept of design pattern. It is considered one of the most successful and earliest design approaches. The author emphasises that MVC was the pattern behind Smalltalk-80, which interface with overlapping windows was latter used by Macintosh and Windows.

The model have been so successful that is still used for developing new frameworks interfaces, for instance Java Swing and Ruby on Rails.

4. Got a spare hour or so? I recomended the UC Berkeley RD lab’s Ruby on Rails Short course at
http://youtube.com/watch?v=LADHwoN2LMM

This is a great video, worth so see it. Even if is quite long it will help you to understand Ruby on Rails pretty much from the beginning.

There are a lot of content and I will not going specifically through of them, because you have to see it.

The video starts with a simple and clear introduction about Webs applications, RPC protocol = HTTP, and how it works in a short “one slide resume”. He talks first about frameworks and its common structures, to start speaking about Ruby on Rails. After the general idea he gives some easy examples (“hello world”). Then he shows how Ruby on Rails works with an MVC approach and explains it well. Then with this content, he speaks about SQL and the design of tables using the mentioned approach with some examples (you can see similar examples executed later on this workshop or in the next one). Finally he closes the video emphasising Rail’s “convention over configuration” which we already explained in previous questions.

So if you have not much idea about Ruby on Rails, this video is an excellent way to start understanding Ruby and its environment.


5. Read the Flash article using ActionScript by Colin Moock tittled “The Model-View_Controler Design Pattern” at http://www.adobe.com/devnet/flash/articles/mv_controller.html

Once again the article’s main topic is MVC. Is a pretty good one do, and its going a bit deeper defining MVC. It explains the beginnings of MVC paradigm as in the question 3 article.


It well defines the three classes: Model, View, Control, as defined in workshop one. However, even we already read about same topic is always good have different approach and different examples to reach a better understanding.

Challenge problems - Workshop 2
In this part of the second workshop we will be using some Ruby on Rails applications to work in our project called “Online Taxi Booking System”. Where we will be using database design techniques and the MVC design approach.
The database has two tables: passenger_origin and passenger_destination, where into each of them, some fields have been created and defined to describe the table, like name, addresses, contact numbers, etc.
There are several steps we have to follow, and to make it clearer some screenshots will be pasted for easy understanding.

· The first step is to create the application, just typing >Rails (and the name of the application) in our case “taxi”, as shown in the following screen shot:
· Then we create the taxi sqlite3 database and migrate it, to check if the application is talking to the database.

· After that we need to create the scaffold for both passenger_origin and passenger_destination with all the data to describe our tables. Using the command to generate scaffold as shown in the screenshot:



· Finally, to create the table in the database we need to apply the migration file as follows:


· Now run the server and open your browser on http://localhost:3000/passenger_origins

You should see something like this:




· If you click on the link for a new passenger the following page shoul show up:



· Important to validate the data, this is for example, defining a value as a number or non blank space, so if in that field is required to entry a value, and is not entry, an error message should display:


· Once the information is entry properly and create this page is to be seen:



· Finally back to the main page to see the register created.







For the passenger destination the same steps are to be used.


So the application is done and working properly, and the best, it does not take much time, right?
So important to practice some new application or practice modifying the databases or any other function. The important think is understand the logic behind and learn to read the files that rails create. There are plenty of useful tutorials to go further for use Rails.

References:
Building web applications (n.d). Ruby Lessons podcasts. Retrieved March 20, 2009, from http://www.buildingwebapps.com/podcasts

Wikipedia. The free Encyclopaedia. Retrieved March 28, 2009 from http://en.wikipedia.org/





























No comments: