Sunday, April 18, 2010

Workshop 1

Workshop 1 - Setting up the model railway

Topic objectives

• Install Ruby on Rails on your computer (InstantRails or Locomotive);
• Learn about the Model View Controller (MVC) approach to Web application design;
• Revise database techniques with MySQL
• Learn how to use the Ruby on Rails development environment
• Set up a focus group (like a study group for peer learning) to work on the Ruby on Rails workshops via Interact tools


Topic Resources

Many resources exist online to help to learn about Ruby on Rails, so this list of resources can be our point of departure. The workshop reading is RailsSpace: Building a Social Networking Website with Ruby on Rails and is a Safari online book and is accessed through the CSU Library and is explained below. Another list of books exist at http://www.buildingwebapps.com/books/list?category=5

The Learning Rails Podcast series at http://www.buildingwebapps.com/podcasts
may suit you and the Javascript Videos 1-4 at http://video.yahoo.com/watch/111593/1710507
by Douglas Crockford on The JavaScript Programming Language is useful if looking at the use of AJAX with Rails.

Topic reading from Safari Books Online

Hartl, M & Prochazka, A, (2008). RailsSpace: Building a Social Networking Website with Ruby on Rails, Pearson Education

The workshop reading is a Safari online book and is accessed through the CSU Library.

Use the keyword ‘railsspace” to search for access to this eBook via your CSU Library access.‘RailsSpace’ shows how to build large-scale projects with Rails by developing a social networking website like MySpace or Facebook.

This raises issues around scalability, flexibility, capacity planning and performance testing. The companion website at http://railsspace.com/book
has many resources for each chapter, sample code and the final application as a zip file. The same development approach in ‘RailsSpace’ can also be applied to the Online Taxi Booking Service where regular customers can be included as members of an online community business model or an extended customer relationship management model.

Discussion

One way to learn a Web application framework is by building a project. It’s like driving a train – you can’t learn to do it by reading a book. In this workshop series we shall use the Online Taxi Booking System as the “train”, you the developers are the passengers, and the train rides the Rails under commands from Ruby.





The Project

The sample Ruby on Rails Project is the Online Taxi Booking System as briefly described in the subject outline with more details added later during session via the forum or CSU Interact. Use database design techniques and the model view controller design (MVC) approach. The database-driven website is developed and tested on your local PC using Ruby on rails and Web browser, before being migrated to a production site on the CSU network.

The database called taxi has TWO tables called passenger_origin and passenger_destination:

Passenger_origin:

Name, Contact No., Suburb, Street, Street No., Building (Unit, house or business);

Passenger_destination:

Suburb, No. of passengers (1 to 4), taxi type, time required;


To do:

1. Download iTunes from http://www.apple.com/itunes/download/ and subscribe to the “Leraning Rails” Podcasts from http://www.buildingwebapps.com/podcasts

Done

2. Install Ruby on Rails on your computer by using the material and downloads from http://www.rubyonrails.org/

Done
3. Rather than get Ruby on Rails running manually, you use the pre-packaged solutions. These include everything in one bundle: Web server, database, Ruby, Rails, the works.

a. For OS X, there's Locomotive.

b. For Windows, there's Instant Rails. 

Windows platform selected. Done.


Recommended time: 1-4 hours.


Challenge Problems:

1. Make a list of all programming languages and Web development tools used by you in prior experiences. Describe what you know about Web application frameworks before we begin.

As I stated in my introduction, I have no experience on any Web development tools in my prior experience. I have been learnt a lot of programming languages during my college in 1989-1992. They are Pascal, C, C++, Prolog, Lisp, Ada, Assembly language for 68000.

From my understanding, a Web application frameworks is a package of tools (program language, library, interface design, etc.) which can help to develop the Web application in an efficient way. Unlike the old style programming language in the past, programmer needs not to take care a lot of ground work like HW configuration, GUI coding, connectivity issues.

2. Ruby is “an interpreted scripting language” for quick and easy object-oriented programming”. Find out about the Ruby language and discover what this means.
 
Ruby is created by Yukihiro "matz" Mastsumoto and publice release in 1995. Matz (2001) metions that he wanted a scripting language that was powerful than Perl and more object-oriented than Python.

It is based on Matz's favorite languages (Perl, Smalltalk, Eiffel, Ada adn Lisp) and is a balanced functional programming with imperative programming. It can be use, copy, modify and distribute freely.
 
Everything in Ruby is an object and any information and code can has its own properties and actions (even numbers and other primitive types). Ruby has a high flexibility, it allows users to alter its parts. Essentail parts can be removed or redefined, existing parts can be added. On purpose, Ruby features single inheritanc only and it is a much clearer way than multiple inheritance (complex and restrictive).

Besides that, Ruby has a lot of other features, such as exception handling, a true mark-and-sweep garbage collector for objects, a SWIG interface, load extension libraries dynamically, OS independent threading and highly portable. (ruby-lang.org, 2010)

3. What is Rails and how does it work with Ruby?

Rails is a Web development framework written in Ruby language which can make programming  web applications easier by writing less code and accomplishing more than other languages and frameworks. It is an opinionated software (add-on) for Ruby. The main philosophy for Rails are "Don't Repoeat Yourself"(DRY) in writing the same code, Converntion Over Configuration (COC) - assume what you do and how you do, and Web application in RESTful practice (Rubyonrails.org, 2010).

4. What is meant by “convention over configuration” in regards to the use of Rails in Web application development?

COC means Rails assumes what the users want to do and how they are going to do it. It will save a lot of time for the user to tweak every little things by go through different configuration files (Rubyonrails.org, 2010).

5. When did Model-View-Controller begin and where is it used?

Model-View-Controller (MVC) was begun in 1979 by Trygve Reenskagu and working on Smalltalk at Xerox PARC (wikipedia, 2010).

6. Describe the steps involved with the MVC design approach.

MVC design approach specifies that an application consists of a data mode (Model), presentation information (View) and control information (Controller). For example in a Java web application design, the Model is a collection of Java classes that perform  the actual work of the application  (business logic), the View is a collection of JSP that produces the actuall web pages for the users to see and the Controller is one or more servlets that handle the browser requests by telling the Model what to do and then transfer it over to the View to respond.

No comments:

Post a Comment