Skip to main content

Class 2: Getting started with Ruby

Held: Wednesday, 25 January 2017

We start to investigate some issues in Ruby.

Preliminaries

Overview

  • A brief introduction to Ruby
  • Some exercises

Updates

News / Etc.

  • Welcome to day two of CSC 321!
  • Yes, I will take attendance.
  • Today and Thursday, we will continue to explore the wonders of Ruby.
  • Your mentor will be giving up some class time to have evening mentor sessions (increasingly so as the first half of the semester continues).
  • I’m still working on the course Web site.
  • Yes, I know the assignments were time-consuming. But we want you to practice getting up to speed quickly. I’m limiting the work for Thursday.
  • Some concerns and comments
    • If I’m going to use your reading journals to prepare class, I really do need them in on time. (That’s my fault for not giving a clear due time.) They will be due at 8 p.m.
    • When I write “Email your ids for the various services to the mentor and to me”, that means you should send it to both of us.
    • Please follow the instructions for giving titles to email messages. You should know why.

Upcoming Work

Good things to do

Academic

  • Community time today at 11:00 am in JRC 101.
  • CS Table today in the Whale Room.
  • CS Extras Thursday at 4:15 pm.
  • Rosenfield Symposium next week.

Peer

  • ???

A Quick Overview of Ruby

  • Modern programming language.
  • “One” designer.
  • Imperative, functional, and OOP characteristics.
  • Good at “Get the job done quickly.”

Ruby

What’s something familiar?

What’s something new and exciting you’ve discovered about Ruby?

How does Ruby handle a programmer’s need for multiple inheritance?

What is something particularly confusing or puzzling in the reading?

Some Ruby Problems

Write sums_to_n?(vals,val) that returns true if any pair of values from vals sums to val.

Write multiple_of_4?(bitstring) that takes a string of 0’s and 1’s (representing an unsigned integer) as input and returns true if the string represents an integer divisible by four.

Write starts_with_consonant?(str) that determines if a string starts with a consonant.