Catch Up Day V: Ruby
This class is an introduction to the Ruby programming language, presented with an eye to the emphasis Ruby places on using object-oriented concepts. This class assumes you have interest in learning how to write programs and some familiarity with computer systems in general, but you don't need to know any Ruby at all.
If you have a favorite computer language you use, and would like to learn what the corresponding Ruby commands are, join in the discussion by all means!
We will take up a "real-life" use case - a type of task commonly required for repetitive data entry, and write a simple script to solve at least part of the task. We will use this example to cover the following topics:
- Some common data types, the way other languages use them
- Nil and nothingness
- Important helpers provided by Ruby for your basic tasks
- puts and variable insertion
- Ruby core goodies: File Regexp
- Environment and command line: ENV, ARGV
- Is everything an object?
- What do you mean, "everything is an object"?
- A second look at the common data types... a= is the same as a=Array.new, etc.
- Member variable and methods
- Understanding class scope - instance variables and class variables
- Ruby Blocks: what they are and when to write them (short answer: all the time!)
- Loops are blocks
- Array slices are blocks
- Managing errors and exceptions in your code
- Thinking the Ruby way
- Introducing a simple task (read a web page, parse a data item, store it to a database)
- Break it down, write pseudo-code, think objects all the way
- Let's search on the Internet for the real class names for the pseudo-code we've written
- Let's write the real Ruby program
- Run it, break it
- Add exceptions