03 Lesson 1: Introduction, Classes, Objects, and Variables

= Lesson 1: Introduction, Classes, Objects, and Variables

== Reading

If you're using the second edition on paper or pdf, the reading is ....

If you're using the first edition on the web, the reading is the
following sections:

Foreword: http://www.rubycentral.com/book/foreword.html
Preface: http://www.rubycentral.com/book/preface.html
Roadmap: http://www.rubycentral.com/book/roadmap.html
Ruby.new: http://www.rubycentral.com/book/intro.html
Classes, Objects, and Variables: http://www.rubycentral.com/book/tut_classes.ht
ml

(Don't worry, the first three links are introductory material for the
book itself...)

== Homework

(As usual, you can of course do as much or as little as you like. If
you don't have time to answer every single question, you should still
post what you have done)

=== Questions

1. Any questions about the reading? Anything that you didn't
understand, or want to know more about?

2. For those who know other programming languages, what are some ways
that Ruby is different from other languages you know?

3. What's the difference between an instance variable and class
variable?

4. What's the difference between a variable and an attribute?

=== Problems

1. Defining classes: photo gallery. Think about what classes you
would need to define to write a web photo gallery application. For
now, don't think of the actual implementation details of handling
web requests, displaying images, etc. Obviously you'll need to
represent a photo. What attributes does it have? What other
objects do you need?
post what you have done)

=== Questions

1. Any questions about the reading? Anything that you didn't
understand, or want to know more about?

2. For those who know other programming languages, what are some ways
that Ruby is different from other languages you know?

3. What's the difference between an instance variable and class
variable?

4. What's the difference between a variable and an attribute?

=== Problems

1. Defining classes: photo gallery. Think about what classes you
would need to define to write a web photo gallery application. For
now, don't think of the actual implementation details of handling
web requests, displaying images, etc. Obviously you'll need to
represent a photo. What attributes does it have? What other
objects do you need?

2. Defining classes: /proc. (This might not be as interesting for
windows users). On unix, the /proc filesystem is a virtual
filesystem containing information about the running processes
(among other things). It contains a directory for each running
process, which contains information about the process, such as the
command line, the amount of memory it's using, etc). Define a set
of classes to represent the process data in /proc.

Bonus: Actually write a program to look at the data in proc and do
something with it. A good start would be to print out the pids and
command lines. You might want to look up the File and Dir classes.

Thats it, Lesson 2 (covering chapters 4-6: Containers, Blocks, and
Iterators; Standard Types; More About Methods) will be posted Nov 28
(in 2 weeks).

--
Laurel Fan
http://dreadnought.gorgorg.org