Sunday, May 17, 2009

Workshop 4: Riding the Rails with Ruby

Topic objectives

  1. To learn about the Ruby language and its classes and methods;
  2. To use Ruby via an interpreter console window with Windows, Linux or MacOS
  3. To select and test a Ruby IDE
  4. To explain how Rails framework is built upon inheritance of Ruby classes and methods.

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/

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

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

Challenge Problems:

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.

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".

3. Compare the Ruby and Python versions of the dog years calculator:

No comments:

Post a Comment