Chat with us, powered by LiveChat
Ladies Learning Ruby @ Calgary's Assembly Working Space

Ladies Learning Ruby @ Calgary’s Assembly Working Space

In Calgary with Sarah and Kayt for Ladies Learning Code’s Class on Ruby

The class, taught by Calgary’s Lori Olson, was fantastic. The biggest takeaway I have is the vocabulary of programming in Ruby – something I lack in every language. I hear people use terms like “methods” and “objects”, but I don’t really know what they mean (for the record, I often refer to methods as the thing with dot in front of it that does stuff). I can finally see that this is actually a huge hurdle for me to overcome, and I will need to learn the terminology at some point (which I’ve been fighting tooth and nail) if I actually want to know what I’m doing.

We were lucky enough to meet a bunch of #yycers, including The Geek Chic co-founder and Calgary #llc  co-chapter lead Kylie Toh, and mine and Sarah’s awesome Comp Sci-ing mentor Carrie Mah.


Here are my notes from the class, which will mean nothing to anyone but me:

Ruby is an interpreted language
Java, c sharp are static, compiled languages. This means you write your program in that language, and hand that program to another program and say ” run this.” Ruby translates everything on the fly. (dynamic vs static languages)

Fixnum = number

Putting quotes around anything makes it a string
ruby methods:

variable naming llc = “ladies learning code”

you “assign” a variable a value.  Next time you use it, you use the “value” of your variable. a programmer would say a variable “points” to the object “ladies learning code”

ducktype: if it walks like a duck and quacks like a duck, it’s a duck. if variable acts like a string, it’s a string. if it acts like a number, it’s a number

variable pointing at values is an important concept. if llc points and c99 and you assign copycat the value of llc, then you change the value of llc, copycat retains the original value, not the value of llc

numbers (without decimals) = integers
number (with decimals) = floating point values
letters/words/text = string

everything in ruby is an object

An object is an instance of a class

a class defines what something could be. a definition
when you get an object back, it’s called an instance of a class

Classes define objects and what can be done with them.

The things you can do to a class are called methods

Ruby comes with lots of built in classes – string, integer, file, hash, array, etc

key terms: classes, instances, objects, methods

If you want the value of a variable to change, you have to tell it explicitly to change

.chomp removes the carriage return

object.methods lists all methods

type irb to run ruby command, and exit to go back to terminal

DRY = don’t repeat yourself

drying up your code = minimizing your code

#{i} = string interpolation
string interpolation requires double quotes

%w( Jan Feb March)  %w takes the place of quotes

months = %w( Jan Feb Mar )

puts “Okay, on the count of 5 …”
[1, 2, 3, 4, 5].each do |i|
puts i
sleep 1
puts “GO!”
“i” = variable name (can be anything)