Software Development (CSC 321 2015F) : EBoards

CSC321.01 2015F, Class 02: An Introduction to Software Engineering and SaaS


Overview

Preliminaries

Admin

Questions

The Semi-Flipped Classroom

Software Engineering

Thoughts from the Readings

Three things that you were excited about after doing these readings and exercises.

Experiences with Ruby

We'll first consider some of your programs.

How did you solve: (a) sum_to_n

def sum_to_n?(vals,val)
  vals.combination(2).each {|x,y| if (x+y) == val return true}
  return false;
end

def sum_to_n(vals,val)
  sums = Hash.new{0}
  vals.each do |x|
    vals.each do |y|
      if (x!=y) then
        sum = x+y
        sums[sum] += 1
      end
    end
  end
  return sums[val] > 0
end

# Will this work for `sum_to_n?([7,7], 14)`?  No.
# What does "distinct values" mean?  Yay vague specs!

def sum_to_n(vals,val)
  for i in 0 ... vals.length
    for j in i+1 ... vals.length
      if vals[i]+vals[j] == val
        return true
      end
    end
  end
  return false
end

def sum_to_n?(vals,val)
  nums = Hash.new(false)
  vals.each {|x| nums[x] = true}
  vals.any {|x| (nums[val-x]) }
  return false;
end

# Returns true for `sum_to_n?([6],12)`
# But it's O(n), which is great

How did you solve: (b) multiple_of_4?

Make sure that it's not the empty string
Make sure that it contains only 0's and 1's by checking whether length
  = #0's + #1's
Convert to an integer and see if it's divisible by 100

/^[01]+$/.match(str) # is it all 0's and 1's
if /[^01]/.match(str) return false

str.to_i(base=2)
str.to_i(2)

/^[01]*00$/.match(str) || /^0$/.match(str)

How did you solve: (c) starts_with_consonant?

# Get the ASCII value of each letter and check for non-letters

# Alternate
if (!/^[[:alpha:]]/.match(str)) return false
return !(/^[^aeiouAEIOU]/.match(str))
return !(/[^aeiouAEIOU]/.match(str[0]))

tmp = str.downcase.capitalize  
if (tmp == nil) return false
return ['A','E','I','O','U'].contains(tmp[0])

We'll then consider some general issues.

Nope, didn't get to this.

User Stories

Nope, didn't get to this. Moved to 322.

User Stories Exercise

Nope, didn't get to this. Moved to 322.

You are building the Grinnell online teaching system (GOTS) for the Ruby programming language

Work Time

Hah! We didn't have time for work time.

Start looking at HW1 with your partner.