Chapter 2: Designing Useful Custom Classes
In the previous chapter, you learned about how to get the most out of Ruby's core classes. However, outside of small scripts, you'll probably want to create your own classes to organize your code. How you design and structure your classes has a huge effect on how intuitive and maintainable your code is. This chapter will help you learn when a new class is a good idea, how to apply some important object-oriented design principles, how to determine class size, and whether it is worthwhile to introduce a custom data structure.
In this chapter, you'll learn the following principles for designing custom classes:
- Learning when to create a custom class
- Handling trade-offs in SOLID design
- Deciding on larger classes or more classes
- Learning when to use custom data structures
By the end of this chapter, you'll have a better understanding of the principles of Ruby class design and the trade-offs between...