2.2. Crafting an object: The behavior of a ticket
A ticket is a familiar object, with a known set of properties and behaviors. Let’s take a high-level view at what we expect a ticket-like Ruby object to do and to know about itself.
2.2.1. The ticket object, behavior first
A ticket object should be able to provide data about itself. It should field requests for information about the event it’s for: when, where, name of event, performer, which seat, and how much it costs.
When asked, the ticket will provide the following information, based on an imaginary public reading by Mark Twain in 1903:
01/02/03 Town Hall Author's reading Mark Twain Second Balcony, row J, seat 12 $5.50
The goal is to create an object from which we can easily get all this ...