<- Writing good programs
Functions ->

About this chapter

You just learned how to create your own data structures. In this chapter we go to the next step. We will turn these structures into our very own classes, Address, Person and Addressbook, with their own methods.

These will be full-fleged classes, on par with Integer, String, Array and Hash.

Creating your own classes has many powerful advantages:

Code reuse

Remember how many lines it took to print the addressbook? Wouldn't it be nice if we could write that just once, and then type "puts addressbook" every time we want to print it?

In this chapter we are going to do just that.

Data abstraction

This is geek-speak which essentially means you can write the class and the forget about the "details" of how you did it. Do you know how the class String was made? No, but you still know how to use it.

<- Writing good programs
Functions ->