In this chapter, we explored the process of class design. Although many volumes exist on design and existing design patterns, we agree that design starts with the consideration of our requirements.
It's easy to get wrapped up in building a class that does a hundred incredible things, but narrowing the focus of your class provides several benefits. Most importantly, a narrow focus makes your code easier to maintain because your classes do simple things. You can also reuse these focused classes in different combinations with other code, so you lower the risk of duplication.
Getting data in and out of your classes can be achieved through a combination of properties and methods, methods with parameters, or static methods that don't require an instance of the class. Your requirements, and the volume of data and processes you need to deal with, will dictate which combinations make the most sense.
Classes can also act as shells for related data. These classes are perfectly suited for use in an object/relational framework, such as ObjectSpaces. These objects can be grouped together in various collections and can be bound to data controls.
Finally, test-driven development can help you focus on getting just what you need out of your class without overdoing it.