CHAPTER 2
Designing Classes with a Single Responsibility
The foundation of an object-oriented system is the message, but the most visible organizational structure is the class. Messages are at the core of design, but because classes are so obvious, this chapter starts small and concentrates on how to decide what belongs in a class. The design emphasis will gradually shift from classes to messages over the next several chapters.
What are your classes? How many should you have? What behavior will they implement? How much do they know about other classes? How much of themselves should they expose?
These questions can be overwhelming. Every decision seems both permanent and fraught with peril. Fear not. At this stage, your first obligation is to ...
Get Practical Object-Oriented Design: An Agile Primer Using Ruby, 2/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.