[Courses] [Ruby] Lesson 1: Classes

Anne G anne at wjh.harvard.edu
Thu Nov 24 05:41:17 EST 2005


Happy Thanksgiving, for those who celebrate it.

I have a project I am working on, parsing subject data that
has been concatennated into one giant file. I figure I can
write a class and small methods as an exercise...

but it is just as easy to process the file line by line with
a few switches here and there, without specifying any new
class (other than an array instance etc)..

The song example in the book is a database.  What are other
examples of common objects? When is it worth creating an
object, versus plain code?

I understand the theory about encapsulation, but in practice
my code is fairly short, and I only use functions to
identify what different sections of the code do. I use
globals to avoid the hastle of passing info to the fxs.

so I don't really know, how do you figure out what part
of the code would be a good candidate for a class.

Anne






More information about the Courses mailing list