Friday, May 15, 2009

Workshop 8: Ruby on Rails Workshops Report and Evaluation

Evaluation and Report

Please answer each question in this evaluation section. In your answer, please consider content/topics presented and the technologies and teaching strategies used during the Ruby on Rails Workshops. Results will be collated and used to modify the workshop series.
This form is just a format guide to you evaluation and report. Thank you for your time to complete workshop 8.

1. List what you consider to be the three strengths of Ruby on Rails workshop series


2. List what you consider to be the three weaknesses of Ruby on Rails workshop series:


3. List what aspects of Ruby on Rails workshop series that you found to be most difficult.


4. List what improvements could be made to the Ruby on Rails workshop series:


Free response and reflective questions:

5. Reflect on your experiences with the other Web framework used in this subject: Was it effective? How can it be improved? Should other Web frameworks be used as well or instead of Ruby on Rails?

6. Did the Developer’s or IT managers Team that you joined after workshop 4 have a preference towards using other tools to facilitate collaboration? Comment on the differences between these use of the sub-forum or Interact wiki tools from your experiences in this subject.

7. Further comments to add?

Workshop 7: End of the Line: production site migration and maintenance (BLUE team)

What are the hosting solutions?
Will our Rails applications run on a cloud computing service in future?
Can we make a deployment and maintenance plan by team consensus?

Build upon the Blue team wiki inside Interact, from Workshop 6 by beginning a new page to add your ideas for policy planning and documentation about production site deployment and maintenance solutions.

Administration, scaling, reliability and integration with existing and future services are issues.

Consider all the business options of both in-house deployment and outsourcing as shown by hosting sites like http://www.engineyard.com/

Worshop 7: End of the Line: production site migration and maintenance (RED team):

Developers conclude their work with the OTBS and look at the options for deployment of the site. Examine the various platforms/software tools used for deployment such as UNIX environment suggested in the Discussion Notes, Mongrel or Mongrel cluster, Nginx, Subversion or Capistrano (during development stage), JRuby in the Java environment.

Which way?

The choice is up to you as this workshop present just one option and you may like to use another, such as deploying the OTBS in a .NET or J2EE environment

Can you get the OTBS Running in production mode as a minimal production server?

Share your success by posting progress comments and links etc to the Developers sub-forum site that has been set up for the Red team.

Wednesday, May 6, 2009

Workshop 6: Enjoying the Ride: Web framework alternatives, scalability and flexibility (BLUE team)

Are we certain that Ruby on Rails is the right platform for Web development?

Your findings should answer that question using the Blue team wiki inside Interact.

Blue team IT managers need to write a team report on the wiki about the alternative frameworks, focusing on issues of scalability, flexibility. In addition a plan for capacity planning, performance testing, site maintenance and future development of the OTBS is presented. Chapter 17 of Hartl et al (2008) is a good place to start. The structure and content and comments made in the wiki report is up to you and your team members.

[This is open to include current alternative frameworks offered by Google Apps, JQUERY, Django, Adobe as well as Java and .NET frameworks that can be included. Your research may also expand the scope to include content management systems.]

Workshop 6: Enjoying the Ride: Web framework alternatives, scalability and flexibility (RED team)

Developers may continue to build upon work with the OTBS using the topic reading to help with user registration and advanced login features from Hartl et al (2008).

o generate a controller and an action by adding a method(s) to a controller;
o create a view template for each action and to link to actions from views;
o use AJAX to improve the user experience;

Share your success by posting progress comments and links etc to the Developers sub-forum site that has been set up for the Red team.

Saturday, April 18, 2009

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part C Online Taxi Business Process 3.:

END of the RIDE

a. At the end of the ride there is no delay for making a payment so the taxi driver would help the customer get out of the car and would have their luggage ready waiting for them and say goodbye.

b. The business process concludes when the company uses the taxi vehicle’s GPS location data again to send a final friendly thank you, suggests feedback via SMS and offers a goodbye message.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part C Online Taxi Business Process 2.:

DURING the RIDE

a. When the taxi arrives, the driver greets the customer by name and helps them with their luggage and then opens the car door.

b. The taxi driver would initiate a conversation and continue with it if they are interested or show interest if they started talking first.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part C Online Taxi Business Process 1.:

Apart from the business basics of offering a clean car, safe driving, being on time, consider the business processes involved and construct a Simple Online Taxi business process model using any suitable drawing tool.

The following description is a helpful guide, but don’t be restricted from including your own ideas to extend or limit the business process model:

BEFORE the RIDE

a. The business process will begin with ordering the cab by telephone, SMS, or online and getting customer recognition if the customer has made a booking previously.

b. During registration, the company would collect data for good customer relations and the electronic payment method. All data collected has to also achieve a quick ordering process and be used ethically and securely.

c.SMS reminders, and updates via SMS, GPS and Google maps provide location-based information to re-assure that the taxi is on the way and on time for the booking.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part B The enhanced customer experience 1.:

Use a table to describe how the customer experience is improved by:

a. Horizontal scalability (eg ordering a taxi by mobile phone call or SMS, mobile Internet, desktop or laptop computer)

b. Service oriented features (eg SMS updates using location data, knowing the driver’s name before the ride and being greeted by your name etc)

c. Other customer services enabled by Web 2.0 (eg reputation system)

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part A Survey of mobile device 2.:

Describe any new hardware, networking, software, systems, procedures and personnel that would be needed by the taxi company Website to support this stage 2 development.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (BLUE team) Part A Survey of mobile device 1.:

Find out and recommend what type of mobile devices are suitable for:

a. Just the SMS message service;
b. The full user experience via SMS, GPS Taxi tracking and Google Maps

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 11.:

Report your progress or findings in your Developers Blog.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 10.:

Submit the forms data. What do you find?

How it works

When you use the params method in Rails, it implements the details of the parameter hash to be changed without breaking existing code. For example, the params hash for radios1 will contain the value of the radio button and the data is extracted in the cabtype action. With the multiple list box example in Rails, using the select controls, the params hash of building1 is an associative array (dictionary) holding the users multiple selections and is not just a drop-down list.

Rails supports other HTML controls for forms processing via text fields, check boxes, radio buttons and list select controls etc. As an example start_form_tag abd stop_form_tag as well as methods for each item such as the create field method text_field_tag

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 9.:

Start the Web server and go to the opening page of this application at http://localhost:3000/input.html

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 8.:

Edit the view template cabtype.rhtml

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 7.:

Edit the vehicle_controller.rb here is a start. The data in each form element in the Rails application can be accessed via its name and a hash called params

class VehicleController< ApplicationController
def cabtype
@data1 = params[:text1]
@data2 = params[:check1]
@data3 = params[:radios1]
@data4 = params[:building1]
end
end

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 6.:

Create a file in the public directory - \cabs\public called input.html

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 5.:

Save the view and restart the Web server and navigate to http://localhost:3000/cabs/cabtype

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 4.:

Add a view template - cabs\app\views\vehicle\cabtype.rhtml
We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 3.:

Add an action to vehicle_controller.rb as the method called cabtype

class VehicleController< ApplicationController
def cabtype
end
end

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 2.:

Create a controller called Vehicle in cabs\app\controllers

cabs> ruby script/generate controller Vehicle

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part C Screen layouts: passing data 1.:

Create a new application called cabs in the same projects directory to demonstrate the use of an active view.

> rails cabs
> cd cabs

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 9.:

Restart the Web server and navigate the browser to http://localhost:3000/demo/rubycode

Data has been passed from the action to the view as it is done with SQL requests. The instance variables of a Ruby class are available to view templates by referencing the action’s instance variables by name in the view .rhtml template.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 8.:

Then modify and save the corresponding view template in \app\views\demo\rubycode.rhtml by adding a call by reference to the action’s instance variable:

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 7.:

Modify and save the rubycode action with a value for the time instance variable in the DemoController class in app\controllers\demo_controller.rb

class DemoController< ApplicationController
def rubycode
@time_now = Time.now
end
end

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 6.:

Use the Time.now example to pass data from an action to a view.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 5.:

Save and restart the Web server and navigate to http://localhost:3000/scenery/rubycode

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 4.:

Add a view template - scenery\app\views\demo\rubycode.rhtml
We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 3.:

Add an action to demo_controller.rb as the method called rubycobe

class DemoController< ApplicationController
def rubycode
end
end

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 2.:

Create a controller called Demo in scenery\app\controllers

scenery> ruby script/generate controller Demo

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part B The active view: passing data 1.:

Create a new application called scenery in the same projects directory to demonstrate the use of an active view.

> rails scenery
> cd scenery

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 8.:

Try Ruby code and HTML in the action view by using the <%....%> wrapper around the inserted Ruby code. Here are some snippets to try from workshop 4:



NOTE: in practise you normally perform calculations in the action (method) and pass the results to the view.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 7.:

Create and save a view in that directory by using a text editor to create a view called breathe.rhtml



Restart the WEBrick serve r and browse again at http://localhost:3000/mammals/breathe

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 6.:

Start the WEBrick server and browse at http://localhost:3000/mammals/breathe where you will get a “missing template” message since it is missing a view for the breathe method.

Rails is trying to connect the breathe method action of the mammal controller to a view, by using the action’s name – breathe. This view template is created as breathe.rhtml and stored in the \projects\animals\views\mammal directory.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 5.:

Create an action by editing and saving the mammal_controller.rb class in projects\animals\app\controllers using your text editor to add the method below:

class MammalController< ApplicationController
def breathe
end
end

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 4.:

Test the controller by starting the WEBrick server and navaigatibng the browser to http://localhost:3000/mammal Note how the controller name is appended to the end of the URL and that no action resulted because there are no controller methods.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 3.:

Create the controller to make the application do an action. This is under the controller-action/model-view structure.

Stop the WEBrick server each time you edit Ruby classes and then re-start or refresh the views you are testing. Use the Ruby command below:

>ruby script/generate controller Mammal

The mammal_controller.rb contains just a bare class description:

class MammalController< ApplicationController
end

and the ApplicationController class inherits from ActionController::Base class in the ActionController module under Rails.

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 2.:

Running the application on localhost:3000 using the WeBrick ruby server (or Mongrel as alternative) and access via Web browser at http://localhost:3000/

Workshop 5: Admiring the secenery Forms, AJAX screen layout and and mobile interfraces: To Do (RED team) Part A Viewing the action 1.:

Create the Rails application framework in the projects folder: C:\InstantRails\...\projects\>rails animals

Tuesday, April 7, 2009

Saturday, March 21, 2009

Workshop 4: Riding the Rails with Ruby - Challenge Problem: 2

Write a Ruby program called fizzbuzz.rb that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

Workshop 4: Riding the Rails with Ruby - Challenge Problem: 1

Create, test and debug a Ruby program called dognames.rb or catnames.rb to accept 3 names from the keyboard and to display each name on the screen in alphabetical order WITHOUT using a data structure such as a list.

Workshop 4: Riding the Rails with Ruby - To do: 3

While Ruby and Python are quite similar, can you find some similarities between Ruby and Javascript?

Workshop 4: Riding the Rails with Ruby - To do: 2

What are the syntax differences in the way that Ruby and Javascript use the if statement?

Workshop 4: Riding the Rails with Ruby - To do: 1

Spend some time moving your way through the 46 Ruby coding examples in the Ruby Tutorial with Code from http://www.fincher.org/tips/Languages/Ruby/

Workshop 3: Online Taxi Booking System: MySQL and Database design - To do: 5

Further work on understanding MySQL under Rails by David Mertz:

a. See “Fast-track your Web apps with Ruby on Rails” at http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/

b. The “Rolling with Ruby on Rails” series and “Cookbook recipes by Curt Hibbs and others beginning at http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html

Workshop 3: Online Taxi Booking System: MySQL and Database design - To do: 4

Generate the Passenger model by creating the MySQL database and ‘passengers’ table from the information above.

Workshop 3: Online Taxi Booking System: MySQL and Database design - To do: 3

Once Rails is running you at http://localhost:3000, you need to configure database access. Connection to the database is specified in the config/database.yml file.

Workshop 3: Online Taxi Booking System: MySQL and Database design - To do: 2

Rails will setup a new application directory for each of your Web application projects. Get InstantRails (Windows) or Locomotive (MacOS) running on your machine. Both packages install Ruby, Rails, a Web server or one called ‘Mongrel’ or another small Ruby Web server called ‘WEBrick’, and MySQL “inside a bubble” as I call it so that others parts of your system are not modified (Similarly ZOPE does with installing its own Web server and Python versions).

Workshop 3: Online Taxi Booking System: MySQL and Database design - To do: 1

Set up the MySQL tools on your computer as described in section 6 above.

Workshop 2: Model View Controller design approach - Challenge Problems: 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

Workshop 2: Model View Controller design approach - 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.

Workshop 2: Model View Controller design approach - 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.

Comments and Suggestions

Please place your comments & suggestions here....

Thank you !

Workshop 2: Model View Controller design approach - To do: 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

Workshop 2: Model View Controller design approach - To do: 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

Workshop 2: Model View Controller design approach - To do: 3

Further work on understanding MVC:

a. See the wiki at http://wiki.rubyonrails.org/rails/pages/UnderstandingMVC

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

Workshop 2: Model View Controller design approach - To do: 2

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

Workshop 2: Model View Controller design approach - To do: 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.

Workshop 1: Setting up model railway - Challenge Problems: 6

Describe the steps involved with the MVC design approach.

Workshop 1: Setting up model railway - Challenge Problems: 5

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

Workshop 1: Setting up model railway - Challenge Problems: 4

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

Workshop 1: Setting up model railway - Challenge Problems: 3

What is Rails and how does it work with Ruby?

Workshop 1: Setting up model railway - Challenge Problems: 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.

Workshop 1: Setting up model railway - 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.

Workshop 1: Setting up model railway - To do: 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.

Workshop 1: Setting up model railway - To do: 2

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

Workshop 1: Setting up model railway - 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