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 ...

Get Polished Ruby Programming 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.